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"?>
<!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>
<data>
<variable>EnvironmentId</variable>

View File

@ -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<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()) {
// 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;
}

View File

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

View File

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