add dithering, auxtype

This commit is contained in:
Dagen Brock 2017-02-03 23:33:30 -06:00
parent 9977d4af9c
commit e4f5e7ebb9
4 changed files with 146 additions and 43 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.1.0, 2016-12-18T20:27:08. --> <!-- Written by QtCreator 4.1.0, 2017-01-15T22:47:33. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>

View File

@ -6,7 +6,8 @@
#include "qtimer.h" #include "qtimer.h"
#include "qmessagebox.h" #include "qmessagebox.h"
#include "qinputdialog.h" #include "qinputdialog.h"
#include "qformlayout.h"
#include "qdialogbuttonbox.h"
const QString MainWindow::programName = QString("buckshot"); const QString MainWindow::programName = QString("buckshot");
const QString MainWindow::version = QString("0.02"); const QString MainWindow::version = QString("0.02");
const QString MainWindow::imageName = QString("saved"); const QString MainWindow::imageName = QString("saved");
@ -48,6 +49,21 @@ MainWindow::MainWindow(QWidget *parent) :
<< "640 x 400 - Classic Size" << "640 x 400 - Classic Size"
<< "640 x 480 - Classic Size"; << "640 x 480 - Classic Size";
ui->comboBox_inputResolution->addItems(inputResolutions); 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) // HANDLE DISPLAY MODE SELECTION (COMPATIBILITY)
updateDisplayModes(); updateDisplayModes();
@ -251,7 +267,12 @@ void MainWindow::on_pushButton_preview_clicked()
args << colorBleedArg; 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 // RUN THE CONVERTER SCRIPT
process.start(converterPath,args); process.start(converterPath,args);
@ -530,11 +551,11 @@ void MainWindow::on_pushButton_saveToProdos_clicked()
if (ui->comboBox_outputFormat->currentText() == "LR") { if (ui->comboBox_outputFormat->currentText() == "LR") {
savedFilename = QString("%1/%2.SLO").arg(tmpDirPath,imageName.toUpper()); savedFilename = QString("%1/%2.SLO").arg(tmpDirPath,imageName.toUpper());
a2Filename = QString("%1.SLO").arg(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") { } else if (ui->comboBox_outputFormat->currentText() == "DLR") {
savedFilename = QString("%1/%2.DLO").arg(tmpDirPath,imageName.toUpper()); savedFilename = QString("%1/%2.DLO").arg(tmpDirPath,imageName.toUpper());
a2Filename = QString("%1.DLO").arg(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") { } else if (ui->comboBox_outputFormat->currentText() == "HGR") {
savedFilename = QString("%1/%2CH.BIN").arg(tmpDirPath,imageName.toUpper()); savedFilename = QString("%1/%2CH.BIN").arg(tmpDirPath,imageName.toUpper());
a2Filename = QString("%1CH.BIN").arg(imageName.toUpper()); a2Filename = QString("%1CH.BIN").arg(imageName.toUpper());
@ -547,10 +568,55 @@ void MainWindow::on_pushButton_saveToProdos_clicked()
} }
bool ok; bool ok = false;
QString prodosFileName = QInputDialog::getText(this, tr("Save Image to ProDOS as"), QString prodosFileName;
tr("ProDOS Name (max 15 chars):"), QLineEdit::Normal,
a2Filename, &ok);
// 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<QLineEdit *> 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()) { if (ok && !prodosFileName.isEmpty()) {
// COPY IT ... OVER EXISTING NAME? // COPY IT ... OVER EXISTING NAME?
QString saveFile = QString("%1/%2").arg(tmpDirPath,prodosFileName); QString saveFile = QString("%1/%2").arg(tmpDirPath,prodosFileName);
@ -633,3 +699,8 @@ void MainWindow::on_pushButton_saveToProdos_clicked()
return; return;
} }
void MainWindow::on_comboBox_dithering_currentIndexChanged(int index)
{
updateNeeded = 1;
}

View File

@ -41,6 +41,8 @@ private slots:
void on_pushButton_saveToProdos_clicked(); void on_pushButton_saveToProdos_clicked();
void on_comboBox_dithering_currentIndexChanged(int index);
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
void updateInputSize(); void updateInputSize();

View File

@ -19,8 +19,8 @@
<rect> <rect>
<x>10</x> <x>10</x>
<y>40</y> <y>40</y>
<width>331</width> <width>311</width>
<height>241</height> <height>221</height>
</rect> </rect>
</property> </property>
<property name="title"> <property name="title">
@ -30,9 +30,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>25</y> <y>24</y>
<width>306</width> <width>291</width>
<height>210</height> <height>191</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
@ -59,7 +59,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>11</x> <x>11</x>
<y>22</y> <y>24</y>
<width>280</width> <width>280</width>
<height>192</height> <height>192</height>
</rect> </rect>
@ -83,7 +83,11 @@
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLineEdit" name="lineEdit_sourceFilename"/> <widget class="QLineEdit" name="lineEdit_sourceFilename">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="pushButton_sourceFilename"> <widget class="QPushButton" name="pushButton_sourceFilename">
@ -110,8 +114,8 @@
<widget class="QLabel" name="label_crossHatch"> <widget class="QLabel" name="label_crossHatch">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>320</x> <x>305</x>
<y>407</y> <y>378</y>
<width>31</width> <width>31</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -123,8 +127,8 @@
<widget class="QLabel" name="label_colorBleed"> <widget class="QLabel" name="label_colorBleed">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>320</x> <x>305</x>
<y>439</y> <y>410</y>
<width>31</width> <width>31</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -136,7 +140,7 @@
<widget class="QCheckBox" name="checkBox_livePreview"> <widget class="QCheckBox" name="checkBox_livePreview">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>420</x> <x>360</x>
<y>260</y> <y>260</y>
<width>101</width> <width>101</width>
<height>30</height> <height>30</height>
@ -150,8 +154,8 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>147</x> <x>147</x>
<y>438</y> <y>408</y>
<width>161</width> <width>151</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
@ -163,7 +167,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>8</x> <x>8</x>
<y>296</y> <y>266</y>
<width>134</width> <width>134</width>
<height>20</height> <height>20</height>
</rect> </rect>
@ -179,8 +183,8 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>147</x> <x>147</x>
<y>294</y> <y>264</y>
<width>201</width> <width>181</width>
<height>26</height> <height>26</height>
</rect> </rect>
</property> </property>
@ -189,7 +193,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>438</y> <y>408</y>
<width>140</width> <width>140</width>
<height>20</height> <height>20</height>
</rect> </rect>
@ -205,7 +209,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>105</x> <x>105</x>
<y>380</y> <y>350</y>
<width>37</width> <width>37</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -221,7 +225,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>400</y> <y>370</y>
<width>140</width> <width>140</width>
<height>30</height> <height>30</height>
</rect> </rect>
@ -237,7 +241,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>28</x> <x>28</x>
<y>326</y> <y>296</y>
<width>114</width> <width>114</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -253,8 +257,8 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>147</x> <x>147</x>
<y>348</y> <y>318</y>
<width>201</width> <width>181</width>
<height>26</height> <height>26</height>
</rect> </rect>
</property> </property>
@ -263,8 +267,8 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>147</x> <x>147</x>
<y>404</y> <y>374</y>
<width>161</width> <width>151</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>
@ -279,7 +283,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>150</x> <x>150</x>
<y>326</y> <y>296</y>
<width>211</width> <width>211</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -292,7 +296,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>21</x> <x>21</x>
<y>350</y> <y>320</y>
<width>121</width> <width>121</width>
<height>20</height> <height>20</height>
</rect> </rect>
@ -308,7 +312,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>150</x> <x>150</x>
<y>380</y> <y>350</y>
<width>211</width> <width>211</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -336,15 +340,15 @@
<widget class="QPlainTextEdit" name="plainTextEdit_lastCmd"> <widget class="QPlainTextEdit" name="plainTextEdit_lastCmd">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>370</x> <x>360</x>
<y>380</y> <y>380</y>
<width>291</width> <width>301</width>
<height>79</height> <height>79</height>
</rect> </rect>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>9</pointsize> <pointsize>10</pointsize>
</font> </font>
</property> </property>
</widget> </widget>
@ -364,10 +368,10 @@
<widget class="Line" name="line"> <widget class="Line" name="line">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>350</x> <x>330</x>
<y>290</y> <y>270</y>
<width>20</width> <width>20</width>
<height>181</height> <height>201</height>
</rect> </rect>
</property> </property>
<property name="orientation"> <property name="orientation">
@ -387,6 +391,32 @@
<string>Save To ProDOS</string> <string>Save To ProDOS</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>20</x>
<y>440</y>
<width>121</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Dithering:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QComboBox" name="comboBox_dithering">
<property name="geometry">
<rect>
<x>147</x>
<y>440</y>
<width>181</width>
<height>26</height>
</rect>
</property>
</widget>
</widget> </widget>
<widget class="QMenuBar" name="menuBar"> <widget class="QMenuBar" name="menuBar">
<property name="geometry"> <property name="geometry">