]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiPrint.cpp
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[lyx.git] / src / frontends / qt4 / GuiPrint.cpp
index 7227064ab35a900219df051f3325545d606f0172..20003e48ac5376f816bc34fc716369cd5d16c9fb 100644 (file)
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "FuncRequest.h"
-#include "support/gettext.h"
+#include "LyXRC.h"
 
 #include "support/convert.h"
 #include "support/FileFilterList.h"
 #include "support/filetools.h"
+#include "support/gettext.h"
 #include "support/os.h"
 
 #include <QLineEdit>
@@ -41,10 +42,9 @@ namespace frontend {
 
 
 GuiPrint::GuiPrint(GuiView & lv)
-       : GuiDialog(lv, "print")
+       : GuiDialog(lv, "print", qt_("Print Document"))
 {
        setupUi(this);
-       setViewTitle(_("Print Document"));
 
        connect(printPB, SIGNAL(clicked()), this, SLOT(slotOK()));
        connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
@@ -85,13 +85,10 @@ void GuiPrint::change_adaptor()
 
 void GuiPrint::browseClicked()
 {
-       docstring name =
-               browseRelFile(docstring(), from_utf8(buffer().filePath()),
-                            _("Print to file"),
-                            FileFilterList(_("PostScript files (*.ps)")),
-                            true);
-       QString file = toqstr(name);
-       if (!file.isNull()) {
+       QString file =
+               browseRelFile(QString(), bufferFilepath(), qt_("Print to file"),
+                            FileFilterList(_("PostScript files (*.ps)")), true);
+       if (!file.isEmpty()) {
                fileED->setText(file);
                changed();
        }
@@ -161,22 +158,18 @@ void GuiPrint::updateContents()
 
 void GuiPrint::applyView()
 {
-       PrinterParams::Target t = PrinterParams::PRINTER;
-       if (fileRB->isChecked())
-               t = PrinterParams::FILE;
-
-       params_ = PrinterParams(t,
-               fromqstr(printerED->text()),
-               support::os::internal_path(fromqstr(fileED->text())),
-               allRB->isChecked(),
-               fromED->text().toUInt(),
-               toED->text().toUInt(),
-               oddCB->isChecked(),
-               evenCB->isChecked(),
-               copiesSB->text().toUInt(),
-               collateCB->isChecked(),
-               reverseCB->isChecked()
-       );
+       params_.target        = fileRB->isChecked()
+               ?  PrinterParams::FILE : PrinterParams::PRINTER;
+       params_.printer_name  = fromqstr(printerED->text());
+       params_.file_name     = os::internal_path(fromqstr(fileED->text()));
+       params_.all_pages     = allRB->isChecked();
+       params_.from_page     = fromED->text().toUInt();
+       params_.to_page       = toED->text().toUInt();
+       params_.odd_pages     = oddCB->isChecked();
+       params_.even_pages    = evenCB->isChecked();
+       params_.count_copies  = copiesSB->text().toUInt();
+       params_.sorted_copies = collateCB->isChecked();
+       params_.reverse_order = reverseCB->isChecked();
 }
 
 
@@ -185,7 +178,8 @@ bool GuiPrint::initialiseParams(string const &)
        /// get global printer parameters
        string const name = support::changeExtension(buffer().absFileName(),
                                        lyxrc.print_file_extension);
-       params_ = PrinterParams(PrinterParams::PRINTER, lyxrc.printer, name);
+       params_ = PrinterParams();
+       params_.file_name = name;
 
        setButtonsValid(true); // so that the user can press Ok
        return true;