Merge pull request #7 from digarok/preview-palettes

add the palette code and clean/fix project for qt 5.7 -> 5.12
This commit is contained in:
Dagen Brock 2018-12-28 09:55:04 -06:00 committed by GitHub
commit fe7564078d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 257 additions and 167 deletions

View File

@ -11,6 +11,13 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = buckshot
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
CONFIG += c++11
SOURCES += main.cpp\
mainwindow.cpp

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.1.0, 2017-01-15T22:47:33. -->
<!-- Written by QtCreator 4.8.0, 2018-12-27T23:10:19. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{604923ac-6650-4c69-8172-ab5bd4c4d88b}</value>
<value type="QByteArray">{30a1729f-a912-4116-992a-f04331cbb1d0}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
@ -54,19 +54,27 @@
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
<valuemap type="QVariantMap">
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey"/>
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
<value type="bool" key="ClangTools.BuildBeforeAnalysis">false</value>
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.7.0 clang 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.7.0 clang 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.57.clang_64_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.12.0 clang 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.12.0 clang 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5120.clang_64_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dbrock/Google Drive/appleiigs/buckshot/build-buckshot-Desktop_Qt_5_7_0_clang_64bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dbrock/Google Drive/appleiigs/buckshot/build-buckshot-Desktop_Qt_5_12_0_clang_64bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -84,13 +92,11 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
@ -103,13 +109,11 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
@ -120,13 +124,13 @@
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dbrock/Google Drive/appleiigs/buckshot/build-buckshot-Desktop_Qt_5_7_0_clang_64bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dbrock/Google Drive/appleiigs/buckshot/build-buckshot-Desktop_Qt_5_12_0_clang_64bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -137,20 +141,18 @@
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
@ -163,13 +165,11 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
@ -180,13 +180,13 @@
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dbrock/Google Drive/appleiigs/buckshot/build-buckshot-Desktop_Qt_5_7_0_clang_64bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dbrock/Google Drive/appleiigs/buckshot/build-buckshot-Desktop_Qt_5_12_0_clang_64bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -197,20 +197,18 @@
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
@ -223,13 +221,11 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
@ -240,7 +236,7 @@
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
@ -254,7 +250,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy Configuration</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
@ -305,18 +301,18 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">buckshot</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/Users/dbrock/Google Drive/appleiigs/buckshot/buckshot/buckshot.pro</value>
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">buckshot.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/Users/dbrock/Google Drive/appleiigs/buckshot/build-buckshot-Desktop_Qt_5_7_0_clang_64bit-Release/buckshot.app/Contents/MacOS</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseDyldImageSuffix">false</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/Users/dbrock/Google Drive/appleiigs/buckshot/build-buckshot-Desktop_Qt_5_12_0_clang_64bit-Debug/buckshot.app/Contents/MacOS</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
@ -327,10 +323,10 @@
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">18</value>
<value type="int">20</value>
</data>
<data>
<variable>Version</variable>
<value type="int">18</value>
<value type="int">20</value>
</data>
</qtcreator>

View File

@ -64,6 +64,28 @@ MainWindow::MainWindow(QWidget *parent) :
<< "9- Buckels";
ui->comboBox_dithering->addItems(ditheringAlgorithms);
// POPULATE PALETTE COMBOBOX
QStringList previewPalettes;
previewPalettes << "Kegs32 RGB"
<< "CiderPress RGB"
<< "Old AppleWin NTSC"
<< "New AppleWin NTSC"
<< "Wikipedia NTSC"
<< "tohgr NTSC DHGR"
<< " (N/A) -- Imported"
<< "Legacy Canvas"
<< "Legacy Win16"
<< "Legacy Win32"
<< "Legacy VGA BIOS"
<< "Legacy VGA PCX"
<< "Super Convert RGB"
<< "Jace NTSC"
<< "Cybernesto-Munafo NTSC"
<< "Pseudo Palette"
<< "tohgr NTSC HGR";
ui->comboBox_previewPalette->addItems(previewPalettes);
// HANDLE DISPLAY MODE SELECTION (COMPATIBILITY)
updateDisplayModes();
@ -73,19 +95,27 @@ MainWindow::MainWindow(QWidget *parent) :
connect(previewTimer, SIGNAL(timeout()), this, SLOT(previewTimerTimeout()));
}
//---- display modes
// 0 "40 x 48 - Full Scale LGR (LGR ONLY)"
// 1 "80 x 48 - Full Scale DLGR (DLGR ONLY)"
// 2 "140 x 192 - Full Scale (HGR & DHGR)"
// 3 "280 x 192 - Double Width Scale (HGR & DHGR)"
// 4 "320 x 200 - Classic Size"
// 5 "560 x 384 - Quadruple Width, Double Height Scale"
// 6 "640 x 400 - Classic Size"
// 7 "640 x 480 - Classic Size";
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::updateDisplayModes() {
QList<int> disabledList = QList<int>();
//---- display modes
// 0 "40 x 48 - Full Scale LGR (LGR ONLY)"
// 1 "80 x 48 - Full Scale DLGR (DLGR ONLY)"
// 2 "140 x 192 - Full Scale (HGR & DHGR)"
// 3 "280 x 192 - Double Width Scale (HGR & DHGR)"
// 4 "320 x 200 - Classic Size"
// 5 "560 x 384 - Quadruple Width, Double Height Scale"
// 6 "640 x 400 - Classic Size"
// 7 "640 x 480 - Classic Size";
// Enable all first
QList<int> enabledList = QList<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7;
QListIterator<int> e(enabledList);
@ -136,17 +166,10 @@ void MainWindow::updateDisplayModes() {
}
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_sourceFilename_clicked()
{
QString filename = QFileDialog::getOpenFileName();
if (filename != NULL) {
if (filename != nullptr) {
ui->lineEdit_sourceFilename->setText(filename);
QPixmap mypix(filename);
ui->label_source->setPixmap(mypix);
@ -199,8 +222,8 @@ void MainWindow::updateInputSize()
}
QSize sourceSize = ui->label_source->pixmap()->size();
double sx = (double)inputWidth / sourceSize.width();
double sy = (double)inputHeight / sourceSize.height();
double sx = static_cast<double>(inputWidth) / sourceSize.width();
double sy = static_cast<double>(inputHeight) / sourceSize.height();
QString scaleString = QString("%1 x %2").arg(sx).arg(sy);
ui->label_scaleFactor->setText(scaleString);
}
@ -214,10 +237,13 @@ void MainWindow::livePreview()
// This is the actual preview generation/main logic function
void MainWindow::on_pushButton_preview_clicked()
{
if (ui->label_source->pixmap() == NULL) {
ui->plainTextEdit_lastCmd->document()->setPlainText("Please open a source image first!");
if (ui->label_source->pixmap() == nullptr) {
QString noImage = "Please open a source image first";
ui->plainTextEdit_lastCmd->setPlainText(noImage);
repaint();
return;
}
// GET SCALE FACTOR
@ -272,13 +298,20 @@ void MainWindow::on_pushButton_preview_clicked()
args << ditherArg;
}
args << "V"; // MUST HAVE! V FLAG GENERATES OUR PREVIEW IMAGE
// MUST ALWAYS HAVE A "V" FLAG TO GENERATE OUR PREVIEW IMAGE
if (ui->comboBox_previewPalette->currentIndex() > -1) {
QString ppalArg = QString("V%1").arg(ui->comboBox_previewPalette->currentIndex());
args << ppalArg;
}
args << ui->lineEdit_addArgs->text();
// RUN THE CONVERTER SCRIPT
process.start(converterPath,args);
process.waitForFinished(); // BLOCKS!!!
QString commandString = QString("%1 %2").arg(converterPath, args.join(" "));
qDebug() << commandString;
ui->plainTextEdit_lastCmd->document()->setPlainText(commandString);
// ALL DONE SO TRY TO LOAD PREVIEW
@ -288,16 +321,20 @@ void MainWindow::on_pushButton_preview_clicked()
int scale = 3;
realScale = scale;
previewPix = previewPix.scaled(80*scale, 48*scale);
qDebug() << "W80";
}
if (previewPix.width() == 560) {
float scale = 0.5f;
realScale = scale;
previewPix = previewPix.scaled((int)(560*scale),(int)(384*scale), Qt::KeepAspectRatio,Qt::SmoothTransformation);
previewPix = previewPix.scaled(qRound(560*scale),qRound(384*scale), Qt::KeepAspectRatio,Qt::SmoothTransformation);
qDebug() << "W560";
}
ui->label_preview->setPixmap(previewPix);
ui->groupBox_preview->setTitle(QString("Preview - Scale %1").arg(realScale));
ui->groupBox_preview->setTitle(QString("Preview - Scale %1").arg(qRound(realScale)));
repaint();
}
// When this timer is running, it checks to see if a
// preview update has been requested, and handles it if so.
void MainWindow::previewTimerTimeout()
@ -329,14 +366,14 @@ void MainWindow::on_horizontalSlider_colorBleed_valueChanged(int value)
updateNeeded = 1;
}
void MainWindow::on_comboBox_outputFormat_currentIndexChanged(int index)
void MainWindow::on_comboBox_outputFormat_currentIndexChanged(int /*unused*/)
{
updateNeeded = 1;
updateDisplayModes();
}
void MainWindow::on_comboBox_inputResolution_currentIndexChanged(int index)
void MainWindow::on_comboBox_inputResolution_currentIndexChanged(int /*unused*/)
{
updateNeeded = 1;
}
@ -366,13 +403,13 @@ void MainWindow::on_actionWhat_is_this_triggered()
"Once you are satisfied with your conversion settings, click \"Save Image File\" to save in one of the Apple ][ image formats based on the display mode. "
"If you want to save that image file directly to a ProDOS volume, that is now supported via the \"Save To ProDOS\" function!\n\n"
"Then you can load it up in your favorite emulator, or transfer it to real disks/flash storage to view on glorious vintage hardware.\n\n"
"(c)2016-2017 Dagen Brock *\n\n\n * bmp2dhr is by Bill Buckels and CADIUS is by Brutal Deluxe.");
"(c)2016-2019 Dagen Brock *\n\n\n * bmp2dhr is by Bill Buckels and CADIUS is by Brutal Deluxe.");
msgBox.exec();
}
void MainWindow::on_pushButton_saveImage_clicked()
{
if (ui->label_preview->pixmap() == NULL) {
if (ui->label_preview->pixmap() == nullptr) {
ui->plainTextEdit_lastCmd->document()->setPlainText("Please open a source image and run a preview first!");
return;
}
@ -404,7 +441,7 @@ void MainWindow::on_pushButton_saveImage_clicked()
}
// PROMPT FOR SAVE FILENAME AND COPY (HOPEFULLY) TO SAVE FILENAME
QString saveFile = QFileDialog::getSaveFileName(0, "Save file", QDir::currentPath(), filters, &defaultFilter);
QString saveFile = QFileDialog::getSaveFileName(nullptr, "Save file", QDir::currentPath(), filters, &defaultFilter);
if (QFile::exists(saveFile)) {
QFile::remove(saveFile);
}
@ -422,7 +459,7 @@ void MainWindow::on_pushButton_saveToProdos_clicked()
{
// @Todo: This isn't appropriate when someone changes res/source and has
// a previous preview pixmap, it will think we are all OK.
if (ui->label_preview->pixmap() == NULL) {
if (ui->label_preview->pixmap() == nullptr) {
ui->plainTextEdit_lastCmd->document()->setPlainText("Please open a source image and run a preview first!");
return;
}
@ -442,7 +479,7 @@ void MainWindow::on_pushButton_saveToProdos_clicked()
// PROMPT FOR SAVE FILENAME AND COPY (HOPEFULLY) TO SAVE FILENAME
QString prodosImageFile = QFileDialog::getSaveFileName(0, "Choose ProDOS Image to Save to", QDir::currentPath(), filters, &defaultFilter, QFileDialog::DontConfirmOverwrite);
QString prodosImageFile = QFileDialog::getSaveFileName(nullptr, "Choose ProDOS Image to Save to", QDir::currentPath(), filters, &defaultFilter, QFileDialog::DontConfirmOverwrite);
// ALSO GENERATE PRODOS SAFE BASENAME
QFileInfo fi(prodosImageFile);
@ -493,7 +530,7 @@ void MainWindow::on_pushButton_saveToProdos_clicked()
// NOW CHECK AGAIN TO SEE IF OUR IMAGE FILE GOT CREATED
if (check_file.exists() && check_file.isFile()) {
qDebug() << "IMAGE FILE CREATED.";
// qDebug() << "IMAGE FILE CREATED.";
} else {
ui->plainTextEdit_lastCmd->document()->setPlainText(QString("Failed creating image with command: %1").arg(commandString));
return;
@ -512,7 +549,7 @@ void MainWindow::on_pushButton_saveToProdos_clicked()
cat_process.start(cadiusPath,cat_args);
cat_process.waitForFinished(); // BLOCKS!!!
QString cat_output = QString(cat_process.readAllStandardOutput());
qDebug() << "CATALOG OUTPUT (cat_output)\n " << cat_output;
//qDebug() << "CATALOG OUTPUT (cat_output)\n " << cat_output;
// regex scanner index
int pos = 0;
@ -532,7 +569,7 @@ void MainWindow::on_pushButton_saveToProdos_clicked()
while ((pos = rx.indexIn(cat_output, pos)) != -1) {
list << rx.cap(1);
qDebug() << rx.cap(1);
//qDebug() << rx.cap(1);
pos += rx.matchedLength();
}
@ -628,7 +665,7 @@ void MainWindow::on_pushButton_saveToProdos_clicked()
// GENERATE OUR STUPID _FileInformation.txt in the same directory
QString fileinfo_text = QString("%1=Type(%2),AuxType(%3),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)").arg(prodosFileName, filetype, auxtype);
QString fileinfo_file = QString("%1/_FileInformation.txt").arg(tmpDirPath);
qDebug() << "TMP FILE: " << fileinfo_file;
//qDebug() << "TMP FILE: " << fileinfo_file;
QFile file( fileinfo_file );
if (file.open(QIODevice::ReadWrite)) {
QTextStream stream( &file );
@ -654,7 +691,7 @@ void MainWindow::on_pushButton_saveToProdos_clicked()
// ../tools/Cadius DELETEFILE <[2mg|hdv|po]_image_path> <prodos_file_path>
// YES - DELETE
QString deleteFile = QString("%1%2").arg(prodosVolumeName,prodosFileName);
qDebug() << "DELETEFILE : " <<deleteFile;
// qDebug() << "DELETEFILE : " <<deleteFile;
QProcess delfile_process;
QStringList delfile_args;
delfile_args << "DELETEFILE";
@ -682,7 +719,7 @@ void MainWindow::on_pushButton_saveToProdos_clicked()
return;
}
} else {
if (ui->label_preview->pixmap() == NULL) {
if (ui->label_preview->pixmap() == nullptr) {
ui->plainTextEdit_lastCmd->document()->setPlainText("Save cancelled because file exists.");
return;
}
@ -703,7 +740,12 @@ void MainWindow::on_pushButton_saveToProdos_clicked()
return;
}
void MainWindow::on_comboBox_dithering_currentIndexChanged(int index)
void MainWindow::on_comboBox_dithering_currentIndexChanged(int /*unused*/)
{
updateNeeded = 1;
}
void MainWindow::on_comboBox_previewPalette_currentIndexChanged(int /*unused*/)
{
updateNeeded = 1;
}

View File

@ -18,7 +18,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
@ -28,7 +28,7 @@ private slots:
void on_horizontalSlider_crossHatch_valueChanged(int value);
void on_horizontalSlider_colorBleed_valueChanged(int value);
void on_comboBox_outputFormat_currentIndexChanged(int index);
void on_comboBox_outputFormat_currentIndexChanged(int);
void on_comboBox_inputResolution_currentIndexChanged(int index);
void on_checkBox_livePreview_stateChanged(int arg1);
@ -40,8 +40,9 @@ private slots:
void on_pushButton_saveImage_clicked();
void on_pushButton_saveToProdos_clicked();
void on_comboBox_dithering_currentIndexChanged(int index);
void on_comboBox_previewPalette_currentIndexChanged(int index);
private:
Ui::MainWindow *ui;

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>671</width>
<height>534</height>
<height>576</height>
</rect>
</property>
<property name="windowTitle">
@ -17,10 +17,10 @@
<widget class="QGroupBox" name="groupBox_source">
<property name="geometry">
<rect>
<x>10</x>
<x>20</x>
<y>40</y>
<width>311</width>
<height>221</height>
<height>211</height>
</rect>
</property>
<property name="title">
@ -32,7 +32,7 @@
<x>10</x>
<y>24</y>
<width>291</width>
<height>191</height>
<height>181</height>
</rect>
</property>
<property name="text">
@ -98,24 +98,11 @@
</item>
</layout>
</widget>
<widget class="QPushButton" name="pushButton_preview">
<property name="geometry">
<rect>
<x>530</x>
<y>260</y>
<width>131</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string>Preview</string>
</property>
</widget>
<widget class="QLabel" name="label_crossHatch">
<property name="geometry">
<rect>
<x>305</x>
<y>378</y>
<x>310</x>
<y>385</y>
<width>31</width>
<height>16</height>
</rect>
@ -127,8 +114,8 @@
<widget class="QLabel" name="label_colorBleed">
<property name="geometry">
<rect>
<x>305</x>
<y>410</y>
<x>310</x>
<y>415</y>
<width>31</width>
<height>16</height>
</rect>
@ -140,8 +127,8 @@
<widget class="QCheckBox" name="checkBox_livePreview">
<property name="geometry">
<rect>
<x>360</x>
<y>260</y>
<x>380</x>
<y>265</y>
<width>101</width>
<height>30</height>
</rect>
@ -154,8 +141,8 @@
<property name="geometry">
<rect>
<x>147</x>
<y>408</y>
<width>151</width>
<y>415</y>
<width>161</width>
<height>22</height>
</rect>
</property>
@ -166,8 +153,8 @@
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>8</x>
<y>266</y>
<x>10</x>
<y>265</y>
<width>134</width>
<height>20</height>
</rect>
@ -183,8 +170,8 @@
<property name="geometry">
<rect>
<x>147</x>
<y>264</y>
<width>181</width>
<y>265</y>
<width>191</width>
<height>26</height>
</rect>
</property>
@ -193,9 +180,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>408</y>
<y>415</y>
<width>140</width>
<height>20</height>
<height>16</height>
</rect>
</property>
<property name="text">
@ -208,14 +195,14 @@
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>105</x>
<y>350</y>
<x>101</x>
<y>355</y>
<width>37</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Scale:</string>
<string>Scale</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -225,9 +212,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>370</y>
<y>385</y>
<width>140</width>
<height>30</height>
<height>16</height>
</rect>
</property>
<property name="text">
@ -241,7 +228,7 @@
<property name="geometry">
<rect>
<x>28</x>
<y>296</y>
<y>295</y>
<width>114</width>
<height>16</height>
</rect>
@ -257,8 +244,8 @@
<property name="geometry">
<rect>
<x>147</x>
<y>318</y>
<width>181</width>
<y>325</y>
<width>191</width>
<height>26</height>
</rect>
</property>
@ -267,8 +254,8 @@
<property name="geometry">
<rect>
<x>147</x>
<y>374</y>
<width>151</width>
<y>385</y>
<width>161</width>
<height>22</height>
</rect>
</property>
@ -282,27 +269,27 @@
<widget class="QLabel" name="label_sourceResolution">
<property name="geometry">
<rect>
<x>150</x>
<y>296</y>
<width>211</width>
<x>155</x>
<y>295</y>
<width>161</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Source Resolution:</string>
<string>10x10</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>21</x>
<y>320</y>
<y>325</y>
<width>121</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Scale to Resolution:</string>
<string>Scale to Resolution</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -311,38 +298,22 @@
<widget class="QLabel" name="label_scaleFactor">
<property name="geometry">
<rect>
<x>150</x>
<y>350</y>
<width>211</width>
<x>155</x>
<y>355</y>
<width>171</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Scale</string>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>520</x>
<y>360</y>
<width>131</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Last Command Run:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<string>1</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="plainTextEdit_lastCmd">
<property name="geometry">
<rect>
<x>360</x>
<y>380</y>
<width>301</width>
<y>385</y>
<width>291</width>
<height>79</height>
</rect>
</property>
@ -351,13 +322,16 @@
<pointsize>10</pointsize>
</font>
</property>
<property name="placeholderText">
<string>This box shows the last conversion command run.</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_saveImage">
<property name="geometry">
<rect>
<x>530</x>
<y>290</y>
<width>131</width>
<x>410</x>
<y>480</y>
<width>121</width>
<height>32</height>
</rect>
</property>
@ -368,7 +342,7 @@
<widget class="Line" name="line">
<property name="geometry">
<rect>
<x>330</x>
<x>340</x>
<y>270</y>
<width>20</width>
<height>201</height>
@ -382,8 +356,8 @@
<property name="geometry">
<rect>
<x>530</x>
<y>320</y>
<width>131</width>
<y>480</y>
<width>121</width>
<height>32</height>
</rect>
</property>
@ -395,13 +369,13 @@
<property name="geometry">
<rect>
<x>20</x>
<y>440</y>
<y>445</y>
<width>121</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Dithering:</string>
<string>Dithering</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -411,12 +385,82 @@
<property name="geometry">
<rect>
<x>147</x>
<y>440</y>
<width>181</width>
<y>445</y>
<width>191</width>
<height>26</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_addArgs">
<property name="geometry">
<rect>
<x>360</x>
<y>355</y>
<width>131</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>390</x>
<y>295</y>
<width>101</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Preview Palette:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QComboBox" name="comboBox_previewPalette">
<property name="geometry">
<rect>
<x>500</x>
<y>295</y>
<width>161</width>
<height>26</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>490</x>
<y>355</y>
<width>141</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>&lt;- additional arguments</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QPushButton" name="pushButton_preview">
<property name="geometry">
<rect>
<x>500</x>
<y>265</y>
<width>161</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string>Preview</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">