diff options
author | Manuel Schneider | 2014-12-03 17:46:22 +0100 |
---|---|---|
committer | Manuel Schneider | 2014-12-03 17:46:22 +0100 |
commit | b6f69dc419bfc81ba1963ad9ba0d917ef5fcca3b (patch) | |
tree | 8e12ff114969c5f85128e7a7487629ecc38ff1b3 | |
parent | Make color and duplex options whitelisted. [NEEDS TESTING] (diff) | |
download | printergui-b6f69dc419bfc81ba1963ad9ba0d917ef5fcca3b.tar.gz printergui-b6f69dc419bfc81ba1963ad9ba0d917ef5fcca3b.tar.xz printergui-b6f69dc419bfc81ba1963ad9ba0d917ef5fcca3b.zip |
Add Dell option. Cleanup code.
-rw-r--r-- | src/maingui/printergui.cpp | 61 |
1 files changed, 7 insertions, 54 deletions
diff --git a/src/maingui/printergui.cpp b/src/maingui/printergui.cpp index 595bdee..bbe58c0 100644 --- a/src/maingui/printergui.cpp +++ b/src/maingui/printergui.cpp @@ -121,10 +121,10 @@ void PrinterGui::on_printerList_currentItemChanged(QTreeWidgetItem *current, QTr res = ::atoi(type); } - ui->comboBoxSides->hide(); - ui->comboBoxColor->hide(); - ui->label_color->hide(); - ui->label_duplex->hide(); +// ui->comboBoxSides->hide(); +// ui->comboBoxColor->hide(); +// ui->label_color->hide(); +// ui->label_duplex->hide(); ppd_file_t *ppd = ppdOpenFile(cupsGetPPD2(CUPS_HTTP_DEFAULT, dest->name)); if (ppd != NULL) @@ -135,7 +135,7 @@ void PrinterGui::on_printerList_currentItemChanged(QTreeWidgetItem *current, QTr // Check for each option if it matches an _colorOptionName.clear(); QStringList knownColorOptions; - knownColorOptions << "XRXColor"; // TODO read from a file + knownColorOptions << "ColorModel" << "XRXColor"; // TODO read from a file for (ppd_option_t *o = ppdFirstOption(ppd); o != NULL; o = ppdNextOption(ppd)) { @@ -227,21 +227,6 @@ void PrinterGui::on_buttonPrint_clicked() { QString cmd; -// // Wenn Farbe möglich ist. Aber trotzdem Graustufen gewählt -// // Schieb file durch ghostscript -// if (ui->comboBoxColor->isEnabled() && ui->comboBoxColor->currentIndex() == 0) { -// // Run ghostscript to make file grayscale -// cmd = QString::fromUtf8("gs -sDEVICE=ps2write -sProcessColorModel=DeviceGray -sColorConversionStrategy=/Gray -dNOPAUSE -dBATCH -dQUIET -dSAFER -sOutputFile=\"%1.conv\" \"%1\"") -// .arg(QString::fromUtf8(this->file)); -// if (system(cmd.toUtf8().constData())) { -// QMessageBox::critical(this, "PrinterGUI", "Kann Druckauftrag nicht in Graustufen konvertieren."); -// return; -// } else { -// strcat(this->file, ".conv"); -// } - -// } - /* * Print via cups lib * */ // Destination / Queue @@ -263,39 +248,6 @@ void PrinterGui::on_buttonPrint_clicked() ui->comboBoxSides->itemData(ui->comboBoxSides->currentIndex()).toString().toStdString().c_str(), dest->num_options, &(dest->options)); - - qDebug() << ui->comboBoxColor->currentIndex(); - qDebug() << ui->comboBoxSides->currentIndex(); - qDebug() << ui->comboBoxColor->itemData(ui->comboBoxColor->currentIndex()).toString().toStdString().c_str(); - qDebug() << ui->comboBoxSides->itemData(ui->comboBoxSides->currentIndex()).toString().toStdString().c_str(); - - - - -// // Duplex -// if (ui->comboBoxSides->isEnabled()) { -// switch (ui->comboBoxSides->currentIndex()) { -// case 0: -// dest->num_options = cupsAddOption ("Duplex", -// "None", -// dest->num_options, -// &(dest->options)); -// break; -// case 1: -// dest->num_options = cupsAddOption ("Duplex", -// "DuplexNoTumble", -// dest->num_options, -// &(dest->options)); -// break; -// case 2: -// dest->num_options = cupsAddOption ("Duplex", -// "DuplexTumble", -// dest->num_options, -// &(dest->options)); -// break; -// } -// } - // Kopien if (ui->lineEditCopies->isEnabled()) { dest->num_options = cupsAddOption ("copies", @@ -318,7 +270,8 @@ void PrinterGui::on_buttonPrint_clicked() } else { //this->bgTimeout = 0; QCoreApplication::instance()->exit(0); - this->hide(); + this->hide(); + QTimer::singleShot(4000, QCoreApplication::instance(), SLOT(quit())); } } |