Implement functionality for 'compression' tab + CPU detection

This commit is contained in:
LoRd_MuldeR 2010-11-15 04:42:06 +01:00
parent a2cbcb76c5
commit 37a328b074
10 changed files with 457 additions and 54 deletions

View File

@ -713,11 +713,14 @@
<item row="1" column="2" colspan="3">
<widget class="QSlider" name="sliderBitrate">
<property name="minimum">
<number>4</number>
<number>0</number>
</property>
<property name="maximum">
<number>50</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>24</number>
</property>
@ -734,12 +737,12 @@
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>5</number>
<number>1</number>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelBitrateMin">
<property name="text">
<string>Minimum</string>
</property>
@ -749,7 +752,7 @@
</widget>
</item>
<item row="4" column="4">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelBitrateMax">
<property name="text">
<string>Maximum</string>
</property>
@ -760,9 +763,55 @@
</item>
<item row="4" column="3">
<widget class="QLabel" name="labelBitrate">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>(VALUE)</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
@ -1289,6 +1338,12 @@
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Images.qrc"/>
</resources>
<connections>
<connection>

View File

@ -8,7 +8,6 @@
<file>tools/lame.exe</file>
<file>tools/MAC.exe</file>
<file>tools/mediainfo_icl11.exe</file>
<!--<file>tools/mediainfo_msvc9.exe</file>-->
<file>tools/mpcdec.exe</file>
<file>tools/mpg123.exe</file>
<file>tools/oggdec.exe</file>

View File

@ -25,7 +25,7 @@
#define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0
#define VER_LAMEXP_BUILD 13
#define VER_LAMEXP_BUILD 20
#define VER_LAMEXP_SUFFIX TechPreview
/*

View File

@ -49,6 +49,8 @@
#include <QSysInfo>
#include <QDragEnterEvent>
#include <QWindowsMime>
#include <QResource>
#include <QTextStream>
//Win32 includes
#include <Windows.h>
@ -81,6 +83,7 @@ MainWindow::MainWindow(QWidget *parent)
{
//Init the dialog, from the .ui file
setupUi(this);
setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint);
//Register meta types
qRegisterMetaType<AudioFileModel>("AudioFileModel");
@ -93,6 +96,7 @@ MainWindow::MainWindow(QWidget *parent)
//Load configuration
m_settings = new SettingsModel();
m_settings->validate();
//Enabled main buttons
connect(buttonAbout, SIGNAL(clicked()), this, SLOT(aboutButtonClicked()));
@ -145,9 +149,29 @@ MainWindow::MainWindow(QWidget *parent)
connect(buttonClearMeta, SIGNAL(clicked()), this, SLOT(clearMetaButtonClicked()));
//Setup "Compression" tab
sliderBitrate->setValue(24);
m_encoderButtonGroup = new QButtonGroup(this);
m_encoderButtonGroup->addButton(radioButtonEncoderMP3, SettingsModel::MP3Encoder);
m_encoderButtonGroup->addButton(radioButtonEncoderVorbis, SettingsModel::VorbisEncoder);
m_encoderButtonGroup->addButton(radioButtonEncoderAAC, SettingsModel::AACEncoder);
m_encoderButtonGroup->addButton(radioButtonEncoderFLAC, SettingsModel::FLACEncoder);
m_encoderButtonGroup->addButton(radioButtonEncoderPCM, SettingsModel::PCMEncoder);
m_modeButtonGroup = new QButtonGroup(this);
m_modeButtonGroup->addButton(radioButtonModeQuality, SettingsModel::VBRMode);
m_modeButtonGroup->addButton(radioButtonModeAverageBitrate, SettingsModel::ABRMode);
m_modeButtonGroup->addButton(radioButtonConstBitrate, SettingsModel::CBRMode);
radioButtonEncoderMP3->setChecked(m_settings->compressionEncoder() == SettingsModel::MP3Encoder);
radioButtonEncoderVorbis->setChecked(m_settings->compressionEncoder() == SettingsModel::VorbisEncoder);
radioButtonEncoderAAC->setChecked(m_settings->compressionEncoder() == SettingsModel::AACEncoder);
radioButtonEncoderFLAC->setChecked(m_settings->compressionEncoder() == SettingsModel::FLACEncoder);
radioButtonEncoderPCM->setChecked(m_settings->compressionEncoder() == SettingsModel::PCMEncoder);
radioButtonModeQuality->setChecked(m_settings->compressionRCMode() == SettingsModel::VBRMode);
radioButtonModeAverageBitrate->setChecked(m_settings->compressionRCMode() == SettingsModel::ABRMode);
radioButtonConstBitrate->setChecked(m_settings->compressionRCMode() == SettingsModel::CBRMode);
sliderBitrate->setValue(m_settings->compressionBitrate());
connect(m_encoderButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(updateEncoder(int)));
connect(m_modeButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(updateRCMode(int)));
connect(sliderBitrate, SIGNAL(valueChanged(int)), this, SLOT(updateBitrate(int)));
updateBitrate(sliderBitrate->value());
updateEncoder(m_encoderButtonGroup->checkedId());
//Activate file menu actions
connect(actionOpenFolder, SIGNAL(triggered()), this, SLOT(openFolderActionActivated()));
@ -245,6 +269,7 @@ MainWindow::~MainWindow(void)
LAMEXP_DELETE(m_metaData);
LAMEXP_DELETE(m_metaInfoModel);
LAMEXP_DELETE(m_settings);
LAMEXP_DELETE(m_encoderButtonGroup);
}
////////////////////////////////////////////////////////////
@ -355,17 +380,17 @@ void MainWindow::windowShown(void)
if(iAccepted <= 0)
{
m_settings->setLicenseAccepted(-1);
m_settings->licenseAccepted(-1);
QMessageBox::critical(this, "License Declined", "You have declined the license. Consequently the application will exit now!");
QApplication::quit();
return;
}
m_settings->setLicenseAccepted(1);
m_settings->licenseAccepted(1);
}
//Check for AAC support
if(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe"))
if(radioButtonEncoderAAC->isEnabled())
{
if(lamexp_tool_version("neroAacEnc.exe") < lamexp_toolver_neroaac())
{
@ -376,7 +401,6 @@ void MainWindow::windowShown(void)
messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>";
QMessageBox::information(this, "AAC Encoder Outdated", messageText);
}
radioButtonEncoderAAC->setEnabled(true);
}
else
{
@ -386,7 +410,6 @@ void MainWindow::windowShown(void)
messageText += "You can download the Nero AAC encoder for free from the official Nero website at:<br>";
messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>";
QMessageBox::information(this, "AAC Support Disabled", messageText);
radioButtonEncoderAAC->setEnabled(false);
}
//Add files from the command-line
@ -573,7 +596,7 @@ void MainWindow::styleActionActivated(QAction *action)
{
if(action && action->userData(0))
{
m_settings->setInterfaceStyle(dynamic_cast<Index*>(action->userData(0))->value());
m_settings->interfaceStyle(dynamic_cast<Index*>(action->userData(0))->value());
}
switch(m_settings->interfaceStyle())
@ -801,10 +824,178 @@ void MainWindow::handleDelayedFiles(void)
addFiles(selectedFiles);
}
/*
* Update encoder
*/
void MainWindow::updateEncoder(int id)
{
m_settings->compressionEncoder(id);
switch(m_settings->compressionEncoder())
{
case SettingsModel::VorbisEncoder:
radioButtonModeQuality->setEnabled(true);
radioButtonModeAverageBitrate->setEnabled(true);
radioButtonConstBitrate->setEnabled(false);
if(radioButtonConstBitrate->isChecked()) radioButtonModeQuality->setChecked(true);
sliderBitrate->setEnabled(true);
break;
case SettingsModel::FLACEncoder:
radioButtonModeQuality->setEnabled(false);
radioButtonModeQuality->setChecked(true);
radioButtonModeAverageBitrate->setEnabled(false);
radioButtonConstBitrate->setEnabled(false);
sliderBitrate->setEnabled(true);
break;
case SettingsModel::PCMEncoder:
radioButtonModeQuality->setEnabled(false);
radioButtonModeQuality->setChecked(true);
radioButtonModeAverageBitrate->setEnabled(false);
radioButtonConstBitrate->setEnabled(false);
sliderBitrate->setEnabled(false);
break;
default:
radioButtonModeQuality->setEnabled(true);
radioButtonModeAverageBitrate->setEnabled(true);
radioButtonConstBitrate->setEnabled(true);
sliderBitrate->setEnabled(true);
break;
}
updateRCMode(m_modeButtonGroup->checkedId());
}
/*
* Update rate-control mode
*/
void MainWindow::updateRCMode(int id)
{
m_settings->compressionRCMode(id);
switch(m_settings->compressionEncoder())
{
case SettingsModel::MP3Encoder:
switch(m_settings->compressionRCMode())
{
case SettingsModel::VBRMode:
sliderBitrate->setMinimum(0);
sliderBitrate->setMaximum(9);
break;
default:
sliderBitrate->setMinimum(2);
sliderBitrate->setMaximum(20);
break;
}
break;
case SettingsModel::VorbisEncoder:
switch(m_settings->compressionRCMode())
{
case SettingsModel::VBRMode:
sliderBitrate->setMinimum(-2);
sliderBitrate->setMaximum(10);
break;
default:
sliderBitrate->setMinimum(4);
sliderBitrate->setMaximum(63);
break;
}
break;
case SettingsModel::AACEncoder:
switch(m_settings->compressionRCMode())
{
case SettingsModel::VBRMode:
sliderBitrate->setMinimum(0);
sliderBitrate->setMaximum(20);
break;
default:
sliderBitrate->setMinimum(4);
sliderBitrate->setMaximum(63);
break;
}
break;
case SettingsModel::FLACEncoder:
sliderBitrate->setMinimum(0);
sliderBitrate->setMaximum(8);
break;
case SettingsModel::PCMEncoder:
sliderBitrate->setMinimum(0);
sliderBitrate->setMaximum(2);
sliderBitrate->setValue(1);
break;
default:
sliderBitrate->setMinimum(0);
sliderBitrate->setMaximum(0);
break;
}
updateBitrate(sliderBitrate->value());
}
/*
* Update bitrate
*/
void MainWindow::updateBitrate(int value)
{
labelBitrate->setText(QString("%1 kbps").arg(value * 8));
m_settings->compressionBitrate(value);
switch(m_settings->compressionRCMode())
{
case SettingsModel::VBRMode:
switch(m_settings->compressionEncoder())
{
case SettingsModel::MP3Encoder:
labelBitrate->setText(QString("Quality Level %1").arg(9 - value));
break;
case SettingsModel::VorbisEncoder:
labelBitrate->setText(QString("Quality Level %1").arg(value));
break;
case SettingsModel::AACEncoder:
labelBitrate->setText(QString("Quality Level %1").arg(QString().sprintf("%.2f", static_cast<double>(value * 5) / 100.0)));
break;
case SettingsModel::FLACEncoder:
labelBitrate->setText(QString("Compression %1").arg(value));
break;
case SettingsModel::PCMEncoder:
labelBitrate->setText("Uncompressed");
break;
default:
labelBitrate->setText(QString::number(value));
break;
}
break;
case SettingsModel::ABRMode:
switch(m_settings->compressionEncoder())
{
case SettingsModel::MP3Encoder:
labelBitrate->setText(QString("&asymp; %1 kbps").arg(value * 16));
break;
case SettingsModel::FLACEncoder:
labelBitrate->setText(QString("Compression %1").arg(value));
break;
case SettingsModel::PCMEncoder:
labelBitrate->setText("Uncompressed");
break;
default:
labelBitrate->setText(QString("&asymp; %1 kbps").arg(min(500, value * 8)));
break;
}
break;
default:
switch(m_settings->compressionEncoder())
{
case SettingsModel::MP3Encoder:
labelBitrate->setText(QString("%1 kbps").arg(value * 16));
break;
case SettingsModel::FLACEncoder:
labelBitrate->setText(QString("Compression %1").arg(value));
break;
case SettingsModel::PCMEncoder:
labelBitrate->setText("Uncompressed");
break;
default:
labelBitrate->setText(QString("%1 kbps").arg(min(500, value * 8)));
break;
}
break;
}
}

View File

@ -32,6 +32,7 @@ class MessageHandlerThread;
class AudioFileModel;
class MetaInfoModel;
class SettingsModel;
class QButtonGroup;
class MainWindow: public QMainWindow, private Ui::MainWindow
{
@ -67,6 +68,8 @@ private slots:
void handleDelayedFiles(void);
void editMetaButtonClicked(void);
void clearMetaButtonClicked(void);
void updateEncoder(int id);
void updateRCMode(int id);
void updateBitrate(int value);
protected:
@ -81,6 +84,8 @@ private:
QFileSystemModel *m_fileSystemModel;
QActionGroup *m_tabActionGroup;
QActionGroup *m_styleActionGroup;
QButtonGroup *m_encoderButtonGroup;
QButtonGroup *m_modeButtonGroup;
WorkingBanner *m_banner;
MessageHandlerThread *m_messageHandler;
QStringList *m_delayedFileList;

View File

@ -44,6 +44,7 @@
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <intrin.h>
//Debug only includes
#ifdef _DEBUG
@ -121,7 +122,8 @@ unsigned int lamexp_toolver_neroaac(void) { return g_lamexp_toolver_neroaac; }
bool lamexp_version_demo(void)
{
return !(strstr(g_lamexp_version_release, "Final") || strstr(g_lamexp_version_release, "Hotfix"));
return LAMEXP_DEBUG || !(strstr(g_lamexp_version_release, "Final") || strstr(g_lamexp_version_release, "Hotfix"));
}
/*
@ -205,6 +207,66 @@ void lamexp_init_console(int argc, char* argv[])
}
}
/*
* Detect CPU features
*/
lamexp_cpu_t lamexp_detect_cpu_features(void)
{
lamexp_cpu_t features;
memset(&features, 0, sizeof(lamexp_cpu_t));
int CPUInfo[4] = {-1};
__cpuid(CPUInfo, 0);
if(CPUInfo[0] >= 1)
{
__cpuid(CPUInfo, 1);
features.mmx = (CPUInfo[3] & 0x800000) || false;
features.sse = (CPUInfo[3] & 0x2000000) || false;
features.sse2 = (CPUInfo[3] & 0x4000000) || false;
features.ssse3 = (CPUInfo[2] & 0x200) || false;
features.sse3 = (CPUInfo[2] & 0x1) || false;
features.ssse3 = (CPUInfo[2] & 0x200) || false;
features.stepping = CPUInfo[0] & 0xf;
features.model = ((CPUInfo[0] >> 4) & 0xf) + (((CPUInfo[0] >> 16) & 0xf) << 4);
features.family = ((CPUInfo[0] >> 8) & 0xf) + ((CPUInfo[0] >> 20) & 0xff);
}
char CPUBrandString[0x40];
memset(CPUBrandString, 0, sizeof(CPUBrandString));
__cpuid(CPUInfo, 0x80000000);
int nExIds = CPUInfo[0];
for(int i = 0x80000000; i <= nExIds; ++i)
{
__cpuid(CPUInfo, i);
if(i == 0x80000002) memcpy(CPUBrandString, CPUInfo, sizeof(CPUInfo));
else if(i == 0x80000003) memcpy(CPUBrandString + 16, CPUInfo, sizeof(CPUInfo));
else if(i == 0x80000004) memcpy(CPUBrandString + 32, CPUInfo, sizeof(CPUInfo));
}
strcpy_s(features.brand, 0x40, CPUBrandString);
return features;
}
/*
* Check for debugger
*/
void WINAPI debugThreadProc(__in LPVOID lpParameter)
{
BOOL remoteDebuggerPresent = FALSE;
CheckRemoteDebuggerPresent(GetCurrentProcess, &remoteDebuggerPresent);
while(!IsDebuggerPresent() && !remoteDebuggerPresent)
{
Sleep(333);
CheckRemoteDebuggerPresent(GetCurrentProcess, &remoteDebuggerPresent);
}
TerminateProcess(GetCurrentProcess(), -1);
}
/*
* Initialize Qt framework
*/

View File

@ -36,6 +36,20 @@ class QString;
class LockedFile;
class QDate;
//Types definitions
typedef struct
{
int family;
int model;
int stepping;
bool mmx;
bool sse;
bool sse2;
bool sse3;
bool ssse3;
char brand[0x40];
} lamexp_cpu_t;
//LameXP version info
unsigned int lamexp_version_major(void);
unsigned int lamexp_version_minor(void);
@ -57,6 +71,7 @@ void lamexp_finalization(void);
const QString &lamexp_temp_folder(void);
void lamexp_ipc_read(unsigned int *command, char* message, size_t buffSize);
void lamexp_ipc_send(unsigned int command, const char* message);
lamexp_cpu_t lamexp_detect_cpu_features(void);
//Auxiliary functions
bool lamexp_clean_folder(const QString folderPath);
@ -72,16 +87,20 @@ SIZE_T lamexp_dbg_private_bytes(void);
#define LAMEXP_DYNCAST(OUT,CLASS,SRC) try { OUT = dynamic_cast<CLASS>(SRC); } catch(std::bad_cast) { OUT = NULL; }
//Check for debug build
#if defined(_DEBUG) || defined(QT_DEBUG)
#if defined(_DEBUG) || defined(QT_DEBUG) || !defined(NDEBUG) || !defined(QT_NODEBUG)
#define LAMEXP_DEBUG 1
#define LAMEXP_CHECK_DEBUG_BUILD \
qWarning("---------------------------------------------------------"); \
qWarning("DEBUG BUILD: DO NOT RELEASE THIS BINARY TO THE PUBLIC !!!"); \
qWarning("---------------------------------------------------------\n");
#else
#define LAMEXP_DEBUG 0
#define LAMEXP_CHECK_DEBUG_BUILD \
if(IsDebuggerPresent()) { \
FatalAppExit(0, L"Not a debug build. Please unload debugger and try again!"); \
TerminateProcess(GetCurrentProcess, -1); }
TerminateProcess(GetCurrentProcess, -1); } \
CreateThread(NULL, NULL, reinterpret_cast<LPTHREAD_START_ROUTINE>(&debugThreadProc), NULL, NULL, NULL);
void WINAPI debugThreadProc(__in LPVOID lpParameter);
#endif
//Memory check

View File

@ -56,6 +56,12 @@ int lamexp_main(int argc, char* argv[])
//Print warning, if this is a "debug" build
LAMEXP_CHECK_DEBUG_BUILD;
//Detect CPU capabilities
lamexp_cpu_t cpuFeatures = lamexp_detect_cpu_features();
qDebug("CPU brand string: %s", cpuFeatures.brand);
qDebug("CPU signature: Family: %d, Model: %d, Stepping: %d", cpuFeatures.family, cpuFeatures.model, cpuFeatures.stepping);
qDebug("CPU capabilities: MMX: %s, SSE: %s, SSE2: %s, SSE3: %s, SSSE3: %s\n", (cpuFeatures.mmx ? "Yes" : "No"), (cpuFeatures.sse ? "Yes" : "No"), (cpuFeatures.sse2 ? "Yes" : "No"), (cpuFeatures.sse3 ? "Yes" : "No"), (cpuFeatures.ssse3 ? "Yes" : "No"));
//Initialize Qt
lamexp_init_qt(argc, argv);

View File

@ -27,9 +27,15 @@
#include <QDesktopServices>
#include <QApplication>
static const char *g_settingsVersionNumber = "VersionNumber";
static const char *g_settingsLicenseAccepted = "LicenseAccepted";
static const char *g_settingsInterfaceStyle = "InterfaceStyle";
static const char *g_settingsId_versionNumber = "VersionNumber";
static const char *g_settingsId_licenseAccepted = "LicenseAccepted";
static const char *g_settingsId_interfaceStyle = "InterfaceStyle";
static const char *g_settingsId_compressionEncoder = "Compression/Encoder";
static const char *g_settingsId_compressionRCMode = "Compression/RCMode";
static const char *g_settingsId_compressionBitrate = "Compression/Bitrate";
#define MAKE_GETTER(OPT,DEF) int SettingsModel::OPT(void) { return m_settings->value(g_settingsId_##OPT, DEF).toInt(); }
#define MAKE_SETTER(OPT) void SettingsModel::OPT(int value) { m_settings->setValue(g_settingsId_##OPT, value); }
////////////////////////////////////////////////////////////
// Constructor
@ -40,7 +46,7 @@ SettingsModel::SettingsModel(void)
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->setValue(g_settingsId_versionNumber, QApplication::applicationVersion());
m_settings->sync();
}
@ -57,8 +63,37 @@ SettingsModel::~SettingsModel(void)
// Public Functions
////////////////////////////////////////////////////////////
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::validate(void)
{
if(this->compressionEncoder() < SettingsModel::MP3Encoder || this->compressionEncoder() > SettingsModel::PCMEncoder)
{
this->compressionEncoder(SettingsModel::MP3Encoder);
}
if(this->compressionRCMode() < SettingsModel::VBRMode || this->compressionRCMode() > SettingsModel::CBRMode)
{
this->compressionEncoder(SettingsModel::VBRMode);
}
if(!(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe")))
{
if(this->compressionEncoder() == SettingsModel::AACEncoder) this->compressionEncoder(SettingsModel::MP3Encoder);
}
}
int SettingsModel::interfaceStyle(void) { return m_settings->value(g_settingsInterfaceStyle, 0).toInt(); }
void SettingsModel::setInterfaceStyle(int value) { m_settings->setValue(g_settingsInterfaceStyle, value); }
////////////////////////////////////////////////////////////
// Getter and Setter
////////////////////////////////////////////////////////////
MAKE_GETTER(licenseAccepted, 0)
MAKE_SETTER(licenseAccepted)
MAKE_GETTER(interfaceStyle, 0)
MAKE_SETTER(interfaceStyle)
MAKE_GETTER(compressionEncoder, 0)
MAKE_SETTER(compressionEncoder)
MAKE_GETTER(compressionRCMode, 0)
MAKE_SETTER(compressionRCMode)
MAKE_GETTER(compressionBitrate, 0)
MAKE_SETTER(compressionBitrate)

View File

@ -23,20 +23,51 @@
class QSettings;
#define MAKE_GETTER_DEC(OPT) int OPT(void)
#define MAKE_SETTER_DEC(OPT) void OPT(int value)
class SettingsModel
{
public:
SettingsModel(void);
~SettingsModel(void);
//Enums
enum Encoder
{
MP3Encoder = 0,
VorbisEncoder = 1,
AACEncoder = 2,
FLACEncoder = 3,
PCMEncoder = 4
};
enum RCMode
{
VBRMode = 0,
ABRMode = 1,
CBRMode = 2
};
//Getters
int licenseAccepted(void);
int interfaceStyle(void);
MAKE_GETTER_DEC(licenseAccepted);
MAKE_GETTER_DEC(interfaceStyle);
MAKE_GETTER_DEC(compressionEncoder);
MAKE_GETTER_DEC(compressionRCMode);
MAKE_GETTER_DEC(compressionBitrate);
//Setters
void setLicenseAccepted(int value);
void setInterfaceStyle(int value);
MAKE_SETTER_DEC(licenseAccepted);
MAKE_SETTER_DEC(interfaceStyle);
MAKE_SETTER_DEC(compressionBitrate);
MAKE_SETTER_DEC(compressionRCMode);
MAKE_SETTER_DEC(compressionEncoder);
void validate(void);
private:
QSettings *m_settings;
};
#undef MAKE_GETTER_DEC
#undef MAKE_SETTER_DEC