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