diff --git a/buckshot/buckshot.pro.user b/buckshot/buckshot.pro.user index 0b4ea68..76653a2 100644 --- a/buckshot/buckshot.pro.user +++ b/buckshot/buckshot.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/buckshot/mainwindow.cpp b/buckshot/mainwindow.cpp index 45c6b2d..51c53e2 100644 --- a/buckshot/mainwindow.cpp +++ b/buckshot/mainwindow.cpp @@ -6,7 +6,8 @@ #include "qtimer.h" #include "qmessagebox.h" #include "qinputdialog.h" - +#include "qformlayout.h" +#include "qdialogbuttonbox.h" const QString MainWindow::programName = QString("buckshot"); const QString MainWindow::version = QString("0.02"); const QString MainWindow::imageName = QString("saved"); @@ -48,6 +49,21 @@ MainWindow::MainWindow(QWidget *parent) : << "640 x 400 - Classic Size" << "640 x 480 - Classic Size"; ui->comboBox_inputResolution->addItems(inputResolutions); + + // POPULATE DITHERING COMBOBOX + QStringList ditheringAlgorithms; + ditheringAlgorithms << "Default" + << "1- Floyd-Steinberg" + << "2- Jarvis" + << "3- Stucki" + << "4- Atkinson" + << "5- Burkes" + << "6- Sierra" + << "7- Sierra Two" + << "8- Sierra Lite" + << "9- Buckels"; + ui->comboBox_dithering->addItems(ditheringAlgorithms); + // HANDLE DISPLAY MODE SELECTION (COMPATIBILITY) updateDisplayModes(); @@ -251,7 +267,12 @@ void MainWindow::on_pushButton_preview_clicked() args << colorBleedArg; } - args << "V"; // MUST HAVE! OUR PREVIEW IMAGE + if (ui->comboBox_dithering->currentIndex() > 0) { + QString ditherArg = QString("D%1").arg(ui->comboBox_dithering->currentIndex()); + args << ditherArg; + } + + args << "V"; // MUST HAVE! V FLAG GENERATES OUR PREVIEW IMAGE // RUN THE CONVERTER SCRIPT process.start(converterPath,args); @@ -530,11 +551,11 @@ void MainWindow::on_pushButton_saveToProdos_clicked() if (ui->comboBox_outputFormat->currentText() == "LR") { savedFilename = QString("%1/%2.SLO").arg(tmpDirPath,imageName.toUpper()); a2Filename = QString("%1.SLO").arg(imageName.toUpper()); - auxtype = "400"; // different auxtype (not that is matters) + auxtype = "0400"; // different auxtype (not that it matters) } else if (ui->comboBox_outputFormat->currentText() == "DLR") { savedFilename = QString("%1/%2.DLO").arg(tmpDirPath,imageName.toUpper()); a2Filename = QString("%1.DLO").arg(imageName.toUpper()); - auxtype = "400"; // different auxtype (not that is matters) + auxtype = "0400"; // different auxtype (not that it matters) } else if (ui->comboBox_outputFormat->currentText() == "HGR") { savedFilename = QString("%1/%2CH.BIN").arg(tmpDirPath,imageName.toUpper()); a2Filename = QString("%1CH.BIN").arg(imageName.toUpper()); @@ -547,10 +568,55 @@ void MainWindow::on_pushButton_saveToProdos_clicked() } - bool ok; - QString prodosFileName = QInputDialog::getText(this, tr("Save Image to ProDOS as"), - tr("ProDOS Name (max 15 chars):"), QLineEdit::Normal, - a2Filename, &ok); + bool ok = false; + QString prodosFileName; + + + // manually build name/auxtype dialog + QDialog dialog(this); + // Use a layout allowing to have a label next to each field + QFormLayout form(&dialog); + + // Add some text above the fields + form.addRow(new QLabel(tr("Save Image to ProDOS"))); + + // Add the lineEdits with their respective labels + QList fields; + + QLineEdit *lineEdit = new QLineEdit(&dialog); + lineEdit->setText(a2Filename); + QString label = QString("ProDOS Name (max 15 chars):"); + form.addRow(label, lineEdit); + + QLineEdit *lineEdit2 = new QLineEdit(&dialog); + lineEdit2->setText(auxtype); + lineEdit2->setInputMask("HHHh"); + QString label2 = QString("Change auxtype (optional): $"); + form.addRow(label2, lineEdit2); + + fields << lineEdit << lineEdit2; + + + // Add some standard buttons (Cancel/Ok) at the bottom of the dialog + QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, + Qt::Horizontal, &dialog); + form.addRow(&buttonBox); + QObject::connect(&buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept())); + QObject::connect(&buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject())); + + // Show the dialog as modal + if (dialog.exec() == QDialog::Accepted) { + // If the user didn't dismiss the dialog, do something with the fields + prodosFileName = fields[0]->text(); + auxtype = fields[1]->text(); + ok = true; + } + + + + + + if (ok && !prodosFileName.isEmpty()) { // COPY IT ... OVER EXISTING NAME? QString saveFile = QString("%1/%2").arg(tmpDirPath,prodosFileName); @@ -633,3 +699,8 @@ void MainWindow::on_pushButton_saveToProdos_clicked() return; } + +void MainWindow::on_comboBox_dithering_currentIndexChanged(int index) +{ + updateNeeded = 1; +} diff --git a/buckshot/mainwindow.h b/buckshot/mainwindow.h index 150fb09..b38c65b 100644 --- a/buckshot/mainwindow.h +++ b/buckshot/mainwindow.h @@ -41,6 +41,8 @@ private slots: void on_pushButton_saveToProdos_clicked(); + void on_comboBox_dithering_currentIndexChanged(int index); + private: Ui::MainWindow *ui; void updateInputSize(); diff --git a/buckshot/mainwindow.ui b/buckshot/mainwindow.ui index c660e40..d7a23e2 100644 --- a/buckshot/mainwindow.ui +++ b/buckshot/mainwindow.ui @@ -19,8 +19,8 @@ 10 40 - 331 - 241 + 311 + 221 @@ -30,9 +30,9 @@ 10 - 25 - 306 - 210 + 24 + 291 + 191 @@ -59,7 +59,7 @@ 11 - 22 + 24 280 192 @@ -83,7 +83,11 @@ - + + + true + + @@ -110,8 +114,8 @@ - 320 - 407 + 305 + 378 31 16 @@ -123,8 +127,8 @@ - 320 - 439 + 305 + 410 31 16 @@ -136,7 +140,7 @@ - 420 + 360 260 101 30 @@ -150,8 +154,8 @@ 147 - 438 - 161 + 408 + 151 22 @@ -163,7 +167,7 @@ 8 - 296 + 266 134 20 @@ -179,8 +183,8 @@ 147 - 294 - 201 + 264 + 181 26 @@ -189,7 +193,7 @@ 0 - 438 + 408 140 20 @@ -205,7 +209,7 @@ 105 - 380 + 350 37 16 @@ -221,7 +225,7 @@ 0 - 400 + 370 140 30 @@ -237,7 +241,7 @@ 28 - 326 + 296 114 16 @@ -253,8 +257,8 @@ 147 - 348 - 201 + 318 + 181 26 @@ -263,8 +267,8 @@ 147 - 404 - 161 + 374 + 151 22 @@ -279,7 +283,7 @@ 150 - 326 + 296 211 16 @@ -292,7 +296,7 @@ 21 - 350 + 320 121 20 @@ -308,7 +312,7 @@ 150 - 380 + 350 211 16 @@ -336,15 +340,15 @@ - 370 + 360 380 - 291 + 301 79 - 9 + 10 @@ -364,10 +368,10 @@ - 350 - 290 + 330 + 270 20 - 181 + 201 @@ -387,6 +391,32 @@ Save To ProDOS + + + + 20 + 440 + 121 + 20 + + + + Dithering: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 147 + 440 + 181 + 26 + + +