mirror of
https://github.com/digarok/buckshot.git
synced 2024-10-31 12:04:51 +00:00
add version to avoid confusinating
This commit is contained in:
parent
ed9157664d
commit
2abb2995fd
@ -7,6 +7,8 @@
|
||||
#include <Qtcore>
|
||||
#include "qmessagebox.h"
|
||||
|
||||
const QString MainWindow::programName = QString("buckshot");
|
||||
const QString MainWindow::version = QString("0.00");
|
||||
const QString MainWindow::imageName = QString("saved");
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
@ -15,7 +17,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
this->setWindowTitle("buckshot");
|
||||
// Window Title
|
||||
this->setWindowTitle(QString("%1 v%2").arg(programName,version));
|
||||
|
||||
// SET TEMP DIR FOR CACHE/BUILDING
|
||||
tmpDir = new QTemporaryDir();
|
||||
@ -24,25 +27,17 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
} else {
|
||||
tmpDirPath = "/tmp/"; // fallback. may not work on all OSes
|
||||
}
|
||||
// AND NOW THE PATHNAMES FOR OUR CACHE FILES
|
||||
|
||||
// AND NOW THE PATHNAMES FOR OUR CACHE FILES
|
||||
inputImgPath = QString("%1/%2.bmp").arg(tmpDirPath).arg(imageName);
|
||||
previewImgPath = QString("%1/%2_Preview.bmp").arg(tmpDirPath).arg(imageName);
|
||||
qDebug() << inputImgPath << previewImgPath;
|
||||
|
||||
// depends SAVED.A2FC, SAVEDC.BIN, SAVEDCH.BIN
|
||||
//outputImgPath = QString("%1/%2").arg(tmpDirPath).arg();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// populate combobox
|
||||
// POPULATE FORMAT COMBOBOX
|
||||
QStringList outputFormats;
|
||||
outputFormats << "LR" << "DLR" << "HGR" << "DHGR" << "MONO";
|
||||
ui->comboBox_outputFormat->addItems(outputFormats);
|
||||
|
||||
//
|
||||
// POPULATE RESOLUTION COMBOBOX
|
||||
QStringList inputResolutions;
|
||||
inputResolutions << "40 x 48 - Full Scale LGR"
|
||||
<< "80 x 48 - Full Scale DLGR"
|
||||
@ -53,6 +48,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
<< "640 x 400 - Classic Size"
|
||||
<< "640 x 480 - Classic Size";
|
||||
ui->comboBox_inputResolution->addItems(inputResolutions);
|
||||
// HANDLE DISPLAY MODE SELECTION (COMPATIBILITY)
|
||||
updateDisplayModes();
|
||||
|
||||
// live preview stuff
|
||||
@ -61,7 +57,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
connect(previewTimer, SIGNAL(timeout()), this, SLOT(previewTimerTimeout()));
|
||||
}
|
||||
|
||||
//ions << 0 "40 x 48 - Full Scale LGR (LGR ONLY)"
|
||||
//---- 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)"
|
||||
@ -71,7 +68,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
// 7 "640 x 480 - Classic Size";
|
||||
void MainWindow::updateDisplayModes() {
|
||||
|
||||
QList<int> disabledList = QList<int>(); // = QList<int>() << 1 << 1;
|
||||
QList<int> disabledList = QList<int>();
|
||||
|
||||
// Enable all first
|
||||
QList<int> enabledList = QList<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7;
|
||||
@ -85,9 +82,7 @@ void MainWindow::updateDisplayModes() {
|
||||
ui->comboBox_inputResolution->model()->setData(index, vEnable, Qt::UserRole - 1);
|
||||
}
|
||||
|
||||
// DELETE?
|
||||
|
||||
// SET DISABLED ITEMS - AND DEFAULT RESOLUTION FOR MODE
|
||||
// SET DISABLED ITEMS LIST - AND DEFAULT RESOLUTION FOR MODE
|
||||
if (ui->comboBox_outputFormat->currentText() == "LR") {
|
||||
disabledList << 2 << 3;
|
||||
inputWidth = 40;
|
||||
@ -112,11 +107,8 @@ void MainWindow::updateDisplayModes() {
|
||||
inputHeight = 192;
|
||||
ui->comboBox_inputResolution->setCurrentIndex(2);
|
||||
}
|
||||
// SET SOME DEFAULTS
|
||||
|
||||
|
||||
|
||||
|
||||
// NOW ACTUALLY DISABLE INVALID RESOLUTIONS IN THE COMBOBOX
|
||||
QListIterator<int> d(disabledList);
|
||||
while (d.hasNext()) {
|
||||
// Get the index of the value to disable
|
||||
@ -126,12 +118,9 @@ void MainWindow::updateDisplayModes() {
|
||||
// the magic
|
||||
ui->comboBox_inputResolution->model()->setData(index, vDisable, Qt::UserRole - 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
@ -147,9 +136,7 @@ void MainWindow::on_pushButton_sourceFilename_clicked()
|
||||
ui->label_source->setPixmap(mypix);
|
||||
ui->label_source->setScaledContents(true);
|
||||
QSize sourceSize = ui->label_source->pixmap()->size();
|
||||
qDebug() << sourceSize;
|
||||
QString resolutionString = QString("%1 x %2").arg(sourceSize.width()).arg(sourceSize.height());
|
||||
qDebug() << resolutionString;
|
||||
ui->label_sourceResolution->setText(resolutionString);
|
||||
}
|
||||
}
|
||||
@ -199,7 +186,6 @@ void MainWindow::updateInputSize()
|
||||
double sy = (double)inputHeight / sourceSize.height();
|
||||
QString scaleString = QString("%1 x %2").arg(sx).arg(sy);
|
||||
ui->label_scaleFactor->setText(scaleString);
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::livePreview()
|
||||
@ -209,6 +195,8 @@ void MainWindow::livePreview()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This is the actual preview generation/main logic function
|
||||
void MainWindow::on_pushButton_preview_clicked()
|
||||
{
|
||||
if (ui->label_source->pixmap() == NULL) {
|
||||
@ -263,26 +251,17 @@ void MainWindow::on_pushButton_preview_clicked()
|
||||
args << colorBleedArg;
|
||||
}
|
||||
|
||||
|
||||
args << "V"; // MUST HAVE! OUR PREVIEW IMAGE
|
||||
|
||||
|
||||
|
||||
//qint64 pid = 0;
|
||||
//QString working_dir = "/tmp/";
|
||||
//process.startDetached(converterPath, args, working_dir, &pid);
|
||||
// RUN THE CONVERTER SCRIPT
|
||||
process.start(converterPath,args);
|
||||
process.waitForFinished(); // BLOCKS!!!
|
||||
|
||||
qDebug() << converterPath << " " << args ;
|
||||
|
||||
|
||||
QString commandString = QString("%1 %2").arg(converterPath, args.join(" "));
|
||||
ui->plainTextEdit_lastCmd->document()->setPlainText(commandString);
|
||||
|
||||
// ALL DONE SO TRY TO LOAD PREVIEW
|
||||
QPixmap previewPix(previewImgPath);
|
||||
qDebug() << previewPix.width() << previewPix.height();
|
||||
float realScale = 1;
|
||||
if (previewPix.width() == 80) {
|
||||
int scale = 3;
|
||||
@ -295,9 +274,7 @@ void MainWindow::on_pushButton_preview_clicked()
|
||||
previewPix = previewPix.scaled((int)(560*scale),(int)(384*scale), Qt::KeepAspectRatio,Qt::SmoothTransformation);
|
||||
}
|
||||
ui->label_preview->setPixmap(previewPix);
|
||||
|
||||
ui->groupBox_preview->setTitle(QString("Preview - Scale %1").arg(realScale));
|
||||
|
||||
}
|
||||
|
||||
// When this timer is running, it checks to see if a
|
||||
@ -320,6 +297,7 @@ void MainWindow::on_horizontalSlider_crossHatch_valueChanged(int value)
|
||||
updateNeeded = 1;
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_horizontalSlider_colorBleed_valueChanged(int value)
|
||||
{
|
||||
if (value==0){
|
||||
@ -336,11 +314,13 @@ void MainWindow::on_comboBox_outputFormat_currentIndexChanged(int index)
|
||||
updateDisplayModes();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_comboBox_inputResolution_currentIndexChanged(int index)
|
||||
{
|
||||
updateNeeded = 1;
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_checkBox_livePreview_stateChanged(int arg1)
|
||||
{
|
||||
// preview update timer
|
||||
@ -353,6 +333,7 @@ void MainWindow::on_checkBox_livePreview_stateChanged(int arg1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_pushButton_saveImage_pressed()
|
||||
{
|
||||
if (ui->label_preview->pixmap() == NULL) {
|
||||
@ -363,7 +344,6 @@ void MainWindow::on_pushButton_saveImage_pressed()
|
||||
QString suffix;
|
||||
QString filters = QString("All Images (*.A2FC *.BIN *.SLO *.DLO);;HGR (*.BIN);;DHGR (*.A2FC);;LR (*.SLO);;DLR (*.DLO);;All files (*.*)");
|
||||
QString defaultFilter;
|
||||
// SAVED.A2FC
|
||||
|
||||
if (ui->comboBox_outputFormat->currentText() == "LR") {
|
||||
a2filename = QString("%1/%2.SLO").arg(tmpDirPath,imageName.toUpper());
|
||||
@ -387,19 +367,9 @@ void MainWindow::on_pushButton_saveImage_pressed()
|
||||
defaultFilter = "HGR (*.BIN)";
|
||||
}
|
||||
|
||||
// QString filters("Music files (*.mp3);;Text files (*.txt);;All files (*.*)");
|
||||
|
||||
|
||||
/* Static method approach */
|
||||
QString saveFile = QFileDialog::getSaveFileName(0, "Save file", QDir::currentPath(),
|
||||
filters, &defaultFilter);
|
||||
// PROMPT FOR SAVE FILENAME AND COPY (HOPEFULLY) TO SAVE FILENAME
|
||||
QString saveFile = QFileDialog::getSaveFileName(0, "Save file", QDir::currentPath(), filters, &defaultFilter);
|
||||
QFile::copy(a2filename, saveFile);
|
||||
// /* Direct object construction approach */
|
||||
// QFileDialog fileDialog(0, "Save file", QDir::currentPath(), filters);
|
||||
// fileDialog.setD
|
||||
// fileDialog.selectNameFilter(defaultFilter);
|
||||
// fileDialog.exec();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,6 +55,9 @@ private:
|
||||
QTemporaryDir *tmpDir;
|
||||
QString tmpDirPath;
|
||||
static const QString imageName; //"saved"
|
||||
static const QString version; //"0.00"
|
||||
static const QString programName; //"buckshot"
|
||||
|
||||
QString inputImgPath;
|
||||
QString previewImgPath;
|
||||
QString outputImgPath;
|
||||
|
Loading…
Reference in New Issue
Block a user