1 /**************************************************************************
2 * Copyright (C) 2005-2020 by Oleksandr Shneyder *
3 * <o.shneyder@phoca-gmbh.de> *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program. If not, see <https://www.gnu.org/licenses/>. *
16 ***************************************************************************/
17
18 #include "printercmddialog.h"
19 #include "x2goclientconfig.h"
20 #ifdef Q_OS_WIN
21 #include "printwidget.h"
22 #endif
PrinterCmdDialog(QString * cmd,bool * stdinpr,bool * ps,QWidget * parent)23 PrinterCmdDialog::PrinterCmdDialog ( QString* cmd, bool* stdinpr,
24 bool* ps, QWidget* parent )
25 : QDialog ( parent )
26 {
27 ui.setupUi ( this );
28 printCmd=cmd;
29 printStdIn=stdinpr;
30 printPs=ps;
31 ui.leCmd->setText ( *printCmd );
32 if ( *printStdIn )
33 ui.rbStdIn->setChecked ( true );
34 else
35 ui.rbParam->setChecked ( true );
36 if ( *printPs )
37 ui.rbPS->setChecked ( true );
38 else
39 ui.rbPDF->setChecked ( true );
40 connect ( ui.buttonBox,
41 SIGNAL ( accepted() ),this,SLOT ( slot_ok() ) );
42 #ifdef Q_OS_WIN
43 QString txt=tr ( "Please enter your customized or"
44 " individual printing command.\n"
45 "Example:\n");
46
47 QString ver,path;
48 if(PrintWidget::gsViewInfo(ver,path))
49 txt+=path+" -query -color";
50 else
51 txt+=tr("<Path to gsprint.exe> -query -color");
52 ui.label->setText (txt);
53 if(!PrintWidget::gsInfo(ver,path))
54 {
55 ui.rbPDF->setChecked ( true );
56 ui.rbPS->setEnabled(false);
57 }
58 #endif
59
60 }
61
62
~PrinterCmdDialog()63 PrinterCmdDialog::~PrinterCmdDialog()
64 {
65 }
66
67
68
slot_ok()69 void PrinterCmdDialog::slot_ok()
70 {
71 *printCmd=ui.leCmd->text();
72 *printPs=ui.rbPS->isChecked();
73 *printStdIn=ui.rbStdIn->isChecked();
74 accept();
75 }
76