diff --git a/etc/Deployment/_build.bat b/etc/Deployment/_build.bat index 4a70ca93..4062c915 100644 --- a/etc/Deployment/_build.bat +++ b/etc/Deployment/_build.bat @@ -12,11 +12,10 @@ call "%PATH_QTMSVC%\bin\qtvars.bat" REM ----------------------------------------------------------------- set "LAMEXP_ERROR=1" msbuild.exe /property:Configuration=%2 /property:Platform=Win32 /target:Clean /verbosity:detailed %1 -if exist "%~d1%~p1bin\%~n2\*.exe" GOTO:EOF -if exist "%~d1%~p1obj\%~n2\*.obj" GOTO:EOF +if not "%ERRORLEVEL%"=="0" GOTO:EOF echo ---------------------------------------------------------------- +set "LAMEXP_ERROR=1" msbuild.exe /property:Configuration=%2 /property:Platform=Win32 /target:Rebuild /verbosity:detailed %1 +if not "%ERRORLEVEL%"=="0" GOTO:EOF echo ---------------------------------------------------------------- -if not exist "%~d1%~p1bin\%~n2\%~n1.exe" GOTO:EOF -REM ----------------------------------------------------------------- set "LAMEXP_ERROR=0" diff --git a/etc/Deployment/_deploy.bat b/etc/Deployment/_deploy.bat index 6d257a1c..961bb776 100644 --- a/etc/Deployment/_deploy.bat +++ b/etc/Deployment/_deploy.bat @@ -19,6 +19,8 @@ set "OUT_PATH=..\..\bin\%LAMEXP_CONFIG%" set "OUT_DATE=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%" set "OUT_FILE=%OUT_PATH%\..\LameXP.%OUT_DATE%.%LAMEXP_CONFIG:_=-%" set "TMP_PATH=%TEMP%\~LameXP.%LAMEXP_CONFIG%.%OUT_DATE%.tmp" +set "OBJ_PATH=..\..\obj\%LAMEXP_CONFIG%" +set "MOC_PATH=..\..\tmp" REM ------------------------------------------ REM :: READ VERSION INFO :: REM ------------------------------------------ @@ -30,8 +32,17 @@ if not "%LAMEXP_ERROR%"=="0" ( REM ------------------------------------------ REM :: CLEAN UP :: REM ------------------------------------------ +del /Q "%OUT_PATH%\*.exe" +del /Q "%OUT_PATH%\*.dll" +del /Q "%OBJ_PATH%\*.obj" +del /Q "%OBJ_PATH%\*.res" +del /Q "%OBJ_PATH%\*.bat" +del /Q "%OBJ_PATH%\*.idb" +del /Q "%MOC_PATH%\*.cpp" +del /Q "%MOC_PATH%\*.h" del "%OUT_FILE%.exe" del "%OUT_FILE%.zip" +REM ------------------------------------------ if exist "%OUT_FILE%.exe" ( call _error.bat "FAILD TO DELET EXISTING FILE" GOTO:EOF diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index 500f82c7..d76f71f8 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -60,6 +60,16 @@ if(m_banner->isVisible() || m_delayedFileTimer->isActive()) \ } #define LINK(URL) QString("%2").arg(URL).arg(URL) +//Helper class +class Index: public QObjectUserData +{ +public: + Index(int index) { m_index = index; } + int value(void) { return m_index; } +private: + int m_index; +}; + //////////////////////////////////////////////////////////// // Constructor //////////////////////////////////////////////////////////// @@ -147,6 +157,11 @@ MainWindow::MainWindow(QWidget *parent) m_tabActionGroup->addAction(actionCompression); m_tabActionGroup->addAction(actionMetaData); m_tabActionGroup->addAction(actionAdvancedOptions); + actionSourceFiles->setUserData(0, new Index(0)); + actionOutputDirectory->setUserData(0, new Index(1)); + actionMetaData->setUserData(0, new Index(2)); + actionCompression->setUserData(0, new Index(3)); + actionAdvancedOptions->setUserData(0, new Index(4)); actionSourceFiles->setChecked(true); connect(m_tabActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(tabActionActivated(QAction*))); @@ -157,10 +172,16 @@ MainWindow::MainWindow(QWidget *parent) m_styleActionGroup->addAction(actionStyleWindowsVista); m_styleActionGroup->addAction(actionStyleWindowsXP); m_styleActionGroup->addAction(actionStyleWindowsClassic); + actionStylePlastique->setUserData(0, new Index(0)); + actionStyleCleanlooks->setUserData(0, new Index(1)); + actionStyleWindowsVista->setUserData(0, new Index(2)); + actionStyleWindowsXP->setUserData(0, new Index(3)); + actionStyleWindowsClassic->setUserData(0, new Index(4)); actionStylePlastique->setChecked(true); actionStyleWindowsXP->setEnabled((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_XP); actionStyleWindowsVista->setEnabled((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_VISTA); connect(m_styleActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(styleActionActivated(QAction*))); + styleActionActivated(NULL); //Activate help menu actions connect(actionCheckUpdates, SIGNAL(triggered()), this, SLOT(checkUpdatesActionActivated())); @@ -483,23 +504,13 @@ void MainWindow::showDetailsButtonClicked(void) */ void MainWindow::tabPageChanged(int idx) { - switch(idx) + QList actions = m_tabActionGroup->actions(); + for(int i = 0; i < actions.count(); i++) { - case 0: - actionSourceFiles->setChecked(true); - break; - case 1: - actionOutputDirectory->setChecked(true); - break; - case 2: - actionMetaData->setChecked(true); - break; - case 3: - actionCompression->setChecked(true); - break; - case 4: - actionAdvancedOptions->setChecked(true); - break; + if(actions.at(i)->userData(0) && dynamic_cast(actions.at(i)->userData(0))->value() == idx) + { + actions.at(i)->setChecked(true); + } } } @@ -508,17 +519,10 @@ void MainWindow::tabPageChanged(int idx) */ void MainWindow::tabActionActivated(QAction *action) { - int idx = -1; - - if(actionSourceFiles == action) idx = 0; - else if(actionOutputDirectory == action) idx = 1; - else if(actionMetaData == action) idx = 2; - else if(actionCompression == action) idx = 3; - else if(actionAdvancedOptions == action) idx = 4; - - if(idx >= 0) + if(action && action->userData(0)) { - tabWidget->setCurrentIndex(idx); + int index = dynamic_cast(action->userData(0))->value(); + tabWidget->setCurrentIndex(index); } } @@ -527,11 +531,34 @@ void MainWindow::tabActionActivated(QAction *action) */ void MainWindow::styleActionActivated(QAction *action) { - if(action == actionStylePlastique) QApplication::setStyle(new QPlastiqueStyle()); - else if(action == actionStyleCleanlooks) QApplication::setStyle(new QCleanlooksStyle()); - else if(action == actionStyleWindowsVista) QApplication::setStyle(new QWindowsVistaStyle()); - else if(action == actionStyleWindowsXP) QApplication::setStyle(new QWindowsXPStyle()); - else if(action == actionStyleWindowsClassic) QApplication::setStyle(new QWindowsStyle()); + if(action && action->userData(0)) + { + m_settings->setInterfaceStyle(dynamic_cast(action->userData(0))->value()); + } + + switch(m_settings->interfaceStyle()) + { + case 1: + actionStyleCleanlooks->setChecked(true); + QApplication::setStyle(new QCleanlooksStyle()); + break; + case 2: + actionStyleWindowsVista->setChecked(true); + QApplication::setStyle(new QWindowsVistaStyle()); + break; + case 3: + actionStyleWindowsXP->setChecked(true); + QApplication::setStyle(new QWindowsXPStyle()); + break; + case 4: + actionStyleWindowsClassic->setChecked(true); + QApplication::setStyle(new QWindowsStyle()); + break; + default: + actionStylePlastique->setChecked(true); + QApplication::setStyle(new QPlastiqueStyle()); + break; + } } /* diff --git a/src/Global.cpp b/src/Global.cpp index 24bded05..2fe8a921 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -272,9 +272,6 @@ bool lamexp_init_qt(int argc, char* argv[]) } } - //Change application look - QApplication::setStyle(new QPlastiqueStyle()); - //Done qt_initialized = true; return true; @@ -289,11 +286,9 @@ int lamexp_init_ipc(void) { return 0; } - - const QString versionTag = QString().sprintf("@%d.%02d.%04d", lamexp_version_major(), lamexp_version_minor(), lamexp_version_build()); - g_lamexp_semaphore_read_ptr = new QSystemSemaphore(QString(g_lamexp_semaphore_read_uuid).append(versionTag), 0); - g_lamexp_semaphore_write_ptr = new QSystemSemaphore(QString(g_lamexp_semaphore_write_uuid).append(versionTag), 0); + g_lamexp_semaphore_read_ptr = new QSystemSemaphore(QString(g_lamexp_semaphore_read_uuid), 0); + g_lamexp_semaphore_write_ptr = new QSystemSemaphore(QString(g_lamexp_semaphore_write_uuid), 0); if(g_lamexp_semaphore_read_ptr->error() != QSystemSemaphore::NoError) { @@ -312,7 +307,7 @@ int lamexp_init_ipc(void) return -1; } - g_lamexp_sharedmem_ptr = new QSharedMemory(QString(g_lamexp_sharedmem_uuid).append(versionTag), NULL); + g_lamexp_sharedmem_ptr = new QSharedMemory(QString(g_lamexp_sharedmem_uuid), NULL); if(!g_lamexp_sharedmem_ptr->create(sizeof(lamexp_ipc_t))) { diff --git a/src/Main.cpp b/src/Main.cpp index 1aa7ac4d..6e040ef5 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -25,6 +25,7 @@ #include "Dialog_MainWindow.h" #include "Thread_Initialization.h" #include "Thread_MessageProducer.h" +#include "Model_Settings.h" //Qt includes #include @@ -65,7 +66,7 @@ int lamexp_main(int argc, char* argv[]) qWarning(QString("Note: This demo (pre-release) version of LameXP will expire at %1.\n").arg(expireDate.toString(Qt::ISODate)).toLatin1().constData()); if(QDate::currentDate() >= expireDate) { - qWarning("Expired !!!"); + qWarning("Binary has expired !!!"); QMessageBox::warning(NULL, "LameXP - Expired", QString("This demo (pre-release) version of LameXP has expired at %1.\nLameXP is free software and release versions won't expire.").arg(expireDate.toString()), "Exit Program"); return 0; } @@ -115,7 +116,7 @@ int lamexp_main(int argc, char* argv[]) //Final clean-up qDebug("Shutting down, please wait...\n"); - + //Terminate return iResult; } diff --git a/src/Model_Settings.cpp b/src/Model_Settings.cpp index c3c01946..960acf5e 100644 --- a/src/Model_Settings.cpp +++ b/src/Model_Settings.cpp @@ -29,6 +29,7 @@ static const char *g_settingsVersionNumber = "VersionNumber"; static const char *g_settingsLicenseAccepted = "LicenseAccepted"; +static const char *g_settingsInterfaceStyle = "InterfaceStyle"; //////////////////////////////////////////////////////////// // Constructor @@ -36,8 +37,8 @@ static const char *g_settingsLicenseAccepted = "LicenseAccepted"; SettingsModel::SettingsModel(void) { - qDebug(QDesktopServices::storageLocation(QDesktopServices::DataLocation).toUtf8().constData()); - m_settings = new QSettings(QDesktopServices::storageLocation(QDesktopServices::DataLocation).append("/config.ini"), QSettings::IniFormat); + QString appPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation); + m_settings = new QSettings(appPath.append("/config.ini"), QSettings::IniFormat); m_settings->beginGroup(QString().sprintf("LameXP_%u%02u%05u", lamexp_version_major(), lamexp_version_minor(), lamexp_version_build())); m_settings->setValue(g_settingsVersionNumber, QApplication::applicationVersion()); m_settings->sync(); @@ -58,3 +59,6 @@ SettingsModel::~SettingsModel(void) int SettingsModel::licenseAccepted(void) { return m_settings->value(g_settingsLicenseAccepted, 0).toInt(); } void SettingsModel::setLicenseAccepted(int value) { m_settings->setValue(g_settingsLicenseAccepted, value); } + +int SettingsModel::interfaceStyle(void) { return m_settings->value(g_settingsInterfaceStyle, 0).toInt(); } +void SettingsModel::setInterfaceStyle(int value) { m_settings->setValue(g_settingsInterfaceStyle, value); } diff --git a/src/Model_Settings.h b/src/Model_Settings.h index c4c20430..d2bf06ad 100644 --- a/src/Model_Settings.h +++ b/src/Model_Settings.h @@ -31,9 +31,11 @@ public: //Getters int licenseAccepted(void); + int interfaceStyle(void); //Setters void setLicenseAccepted(int value); + void setInterfaceStyle(int value); private: QSettings *m_settings;