Store graphical interface style in settings too
This commit is contained in:
parent
c867f850e0
commit
360a5a1bef
@ -12,11 +12,10 @@ call "%PATH_QTMSVC%\bin\qtvars.bat"
|
|||||||
REM -----------------------------------------------------------------
|
REM -----------------------------------------------------------------
|
||||||
set "LAMEXP_ERROR=1"
|
set "LAMEXP_ERROR=1"
|
||||||
msbuild.exe /property:Configuration=%2 /property:Platform=Win32 /target:Clean /verbosity:detailed %1
|
msbuild.exe /property:Configuration=%2 /property:Platform=Win32 /target:Clean /verbosity:detailed %1
|
||||||
if exist "%~d1%~p1bin\%~n2\*.exe" GOTO:EOF
|
if not "%ERRORLEVEL%"=="0" GOTO:EOF
|
||||||
if exist "%~d1%~p1obj\%~n2\*.obj" GOTO:EOF
|
|
||||||
echo ----------------------------------------------------------------
|
echo ----------------------------------------------------------------
|
||||||
|
set "LAMEXP_ERROR=1"
|
||||||
msbuild.exe /property:Configuration=%2 /property:Platform=Win32 /target:Rebuild /verbosity:detailed %1
|
msbuild.exe /property:Configuration=%2 /property:Platform=Win32 /target:Rebuild /verbosity:detailed %1
|
||||||
|
if not "%ERRORLEVEL%"=="0" GOTO:EOF
|
||||||
echo ----------------------------------------------------------------
|
echo ----------------------------------------------------------------
|
||||||
if not exist "%~d1%~p1bin\%~n2\%~n1.exe" GOTO:EOF
|
|
||||||
REM -----------------------------------------------------------------
|
|
||||||
set "LAMEXP_ERROR=0"
|
set "LAMEXP_ERROR=0"
|
||||||
|
@ -19,6 +19,8 @@ set "OUT_PATH=..\..\bin\%LAMEXP_CONFIG%"
|
|||||||
set "OUT_DATE=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%"
|
set "OUT_DATE=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%"
|
||||||
set "OUT_FILE=%OUT_PATH%\..\LameXP.%OUT_DATE%.%LAMEXP_CONFIG:_=-%"
|
set "OUT_FILE=%OUT_PATH%\..\LameXP.%OUT_DATE%.%LAMEXP_CONFIG:_=-%"
|
||||||
set "TMP_PATH=%TEMP%\~LameXP.%LAMEXP_CONFIG%.%OUT_DATE%.tmp"
|
set "TMP_PATH=%TEMP%\~LameXP.%LAMEXP_CONFIG%.%OUT_DATE%.tmp"
|
||||||
|
set "OBJ_PATH=..\..\obj\%LAMEXP_CONFIG%"
|
||||||
|
set "MOC_PATH=..\..\tmp"
|
||||||
REM ------------------------------------------
|
REM ------------------------------------------
|
||||||
REM :: READ VERSION INFO ::
|
REM :: READ VERSION INFO ::
|
||||||
REM ------------------------------------------
|
REM ------------------------------------------
|
||||||
@ -30,8 +32,17 @@ if not "%LAMEXP_ERROR%"=="0" (
|
|||||||
REM ------------------------------------------
|
REM ------------------------------------------
|
||||||
REM :: CLEAN UP ::
|
REM :: CLEAN UP ::
|
||||||
REM ------------------------------------------
|
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%.exe"
|
||||||
del "%OUT_FILE%.zip"
|
del "%OUT_FILE%.zip"
|
||||||
|
REM ------------------------------------------
|
||||||
if exist "%OUT_FILE%.exe" (
|
if exist "%OUT_FILE%.exe" (
|
||||||
call _error.bat "FAILD TO DELET EXISTING FILE"
|
call _error.bat "FAILD TO DELET EXISTING FILE"
|
||||||
GOTO:EOF
|
GOTO:EOF
|
||||||
|
@ -60,6 +60,16 @@ if(m_banner->isVisible() || m_delayedFileTimer->isActive()) \
|
|||||||
}
|
}
|
||||||
#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(URL)
|
#define LINK(URL) QString("<a href=\"%1\">%2</a>").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
|
// Constructor
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -147,6 +157,11 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
m_tabActionGroup->addAction(actionCompression);
|
m_tabActionGroup->addAction(actionCompression);
|
||||||
m_tabActionGroup->addAction(actionMetaData);
|
m_tabActionGroup->addAction(actionMetaData);
|
||||||
m_tabActionGroup->addAction(actionAdvancedOptions);
|
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);
|
actionSourceFiles->setChecked(true);
|
||||||
connect(m_tabActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(tabActionActivated(QAction*)));
|
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(actionStyleWindowsVista);
|
||||||
m_styleActionGroup->addAction(actionStyleWindowsXP);
|
m_styleActionGroup->addAction(actionStyleWindowsXP);
|
||||||
m_styleActionGroup->addAction(actionStyleWindowsClassic);
|
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);
|
actionStylePlastique->setChecked(true);
|
||||||
actionStyleWindowsXP->setEnabled((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_XP);
|
actionStyleWindowsXP->setEnabled((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_XP);
|
||||||
actionStyleWindowsVista->setEnabled((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_VISTA);
|
actionStyleWindowsVista->setEnabled((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_VISTA);
|
||||||
connect(m_styleActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(styleActionActivated(QAction*)));
|
connect(m_styleActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(styleActionActivated(QAction*)));
|
||||||
|
styleActionActivated(NULL);
|
||||||
|
|
||||||
//Activate help menu actions
|
//Activate help menu actions
|
||||||
connect(actionCheckUpdates, SIGNAL(triggered()), this, SLOT(checkUpdatesActionActivated()));
|
connect(actionCheckUpdates, SIGNAL(triggered()), this, SLOT(checkUpdatesActionActivated()));
|
||||||
@ -483,23 +504,13 @@ void MainWindow::showDetailsButtonClicked(void)
|
|||||||
*/
|
*/
|
||||||
void MainWindow::tabPageChanged(int idx)
|
void MainWindow::tabPageChanged(int idx)
|
||||||
{
|
{
|
||||||
switch(idx)
|
QList<QAction*> actions = m_tabActionGroup->actions();
|
||||||
|
for(int i = 0; i < actions.count(); i++)
|
||||||
{
|
{
|
||||||
case 0:
|
if(actions.at(i)->userData(0) && dynamic_cast<Index*>(actions.at(i)->userData(0))->value() == idx)
|
||||||
actionSourceFiles->setChecked(true);
|
{
|
||||||
break;
|
actions.at(i)->setChecked(true);
|
||||||
case 1:
|
}
|
||||||
actionOutputDirectory->setChecked(true);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
actionMetaData->setChecked(true);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
actionCompression->setChecked(true);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
actionAdvancedOptions->setChecked(true);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,17 +519,10 @@ void MainWindow::tabPageChanged(int idx)
|
|||||||
*/
|
*/
|
||||||
void MainWindow::tabActionActivated(QAction *action)
|
void MainWindow::tabActionActivated(QAction *action)
|
||||||
{
|
{
|
||||||
int idx = -1;
|
if(action && action->userData(0))
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
tabWidget->setCurrentIndex(idx);
|
int index = dynamic_cast<Index*>(action->userData(0))->value();
|
||||||
|
tabWidget->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,11 +531,34 @@ void MainWindow::tabActionActivated(QAction *action)
|
|||||||
*/
|
*/
|
||||||
void MainWindow::styleActionActivated(QAction *action)
|
void MainWindow::styleActionActivated(QAction *action)
|
||||||
{
|
{
|
||||||
if(action == actionStylePlastique) QApplication::setStyle(new QPlastiqueStyle());
|
if(action && action->userData(0))
|
||||||
else if(action == actionStyleCleanlooks) QApplication::setStyle(new QCleanlooksStyle());
|
{
|
||||||
else if(action == actionStyleWindowsVista) QApplication::setStyle(new QWindowsVistaStyle());
|
m_settings->setInterfaceStyle(dynamic_cast<Index*>(action->userData(0))->value());
|
||||||
else if(action == actionStyleWindowsXP) QApplication::setStyle(new QWindowsXPStyle());
|
}
|
||||||
else if(action == actionStyleWindowsClassic) QApplication::setStyle(new QWindowsStyle());
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -272,9 +272,6 @@ bool lamexp_init_qt(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Change application look
|
|
||||||
QApplication::setStyle(new QPlastiqueStyle());
|
|
||||||
|
|
||||||
//Done
|
//Done
|
||||||
qt_initialized = true;
|
qt_initialized = true;
|
||||||
return true;
|
return true;
|
||||||
@ -290,10 +287,8 @@ int lamexp_init_ipc(void)
|
|||||||
return 0;
|
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), 0);
|
||||||
|
g_lamexp_semaphore_write_ptr = new QSystemSemaphore(QString(g_lamexp_semaphore_write_uuid), 0);
|
||||||
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);
|
|
||||||
|
|
||||||
if(g_lamexp_semaphore_read_ptr->error() != QSystemSemaphore::NoError)
|
if(g_lamexp_semaphore_read_ptr->error() != QSystemSemaphore::NoError)
|
||||||
{
|
{
|
||||||
@ -312,7 +307,7 @@ int lamexp_init_ipc(void)
|
|||||||
return -1;
|
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)))
|
if(!g_lamexp_sharedmem_ptr->create(sizeof(lamexp_ipc_t)))
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "Dialog_MainWindow.h"
|
#include "Dialog_MainWindow.h"
|
||||||
#include "Thread_Initialization.h"
|
#include "Thread_Initialization.h"
|
||||||
#include "Thread_MessageProducer.h"
|
#include "Thread_MessageProducer.h"
|
||||||
|
#include "Model_Settings.h"
|
||||||
|
|
||||||
//Qt includes
|
//Qt includes
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -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());
|
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)
|
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");
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
static const char *g_settingsVersionNumber = "VersionNumber";
|
static const char *g_settingsVersionNumber = "VersionNumber";
|
||||||
static const char *g_settingsLicenseAccepted = "LicenseAccepted";
|
static const char *g_settingsLicenseAccepted = "LicenseAccepted";
|
||||||
|
static const char *g_settingsInterfaceStyle = "InterfaceStyle";
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
@ -36,8 +37,8 @@ static const char *g_settingsLicenseAccepted = "LicenseAccepted";
|
|||||||
|
|
||||||
SettingsModel::SettingsModel(void)
|
SettingsModel::SettingsModel(void)
|
||||||
{
|
{
|
||||||
qDebug(QDesktopServices::storageLocation(QDesktopServices::DataLocation).toUtf8().constData());
|
QString appPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
||||||
m_settings = new QSettings(QDesktopServices::storageLocation(QDesktopServices::DataLocation).append("/config.ini"), QSettings::IniFormat);
|
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->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->setValue(g_settingsVersionNumber, QApplication::applicationVersion());
|
||||||
m_settings->sync();
|
m_settings->sync();
|
||||||
@ -58,3 +59,6 @@ SettingsModel::~SettingsModel(void)
|
|||||||
|
|
||||||
int SettingsModel::licenseAccepted(void) { return m_settings->value(g_settingsLicenseAccepted, 0).toInt(); }
|
int SettingsModel::licenseAccepted(void) { return m_settings->value(g_settingsLicenseAccepted, 0).toInt(); }
|
||||||
void SettingsModel::setLicenseAccepted(int value) { m_settings->setValue(g_settingsLicenseAccepted, value); }
|
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); }
|
||||||
|
@ -31,9 +31,11 @@ public:
|
|||||||
|
|
||||||
//Getters
|
//Getters
|
||||||
int licenseAccepted(void);
|
int licenseAccepted(void);
|
||||||
|
int interfaceStyle(void);
|
||||||
|
|
||||||
//Setters
|
//Setters
|
||||||
void setLicenseAccepted(int value);
|
void setLicenseAccepted(int value);
|
||||||
|
void setInterfaceStyle(int value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSettings *m_settings;
|
QSettings *m_settings;
|
||||||
|
Loading…
Reference in New Issue
Block a user