Remember last configuration, even if it was unsaved.
This commit is contained in:
parent
10934275f7
commit
e648300812
@ -21,6 +21,8 @@
|
||||
|
||||
#include "model_options.h"
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QSettings>
|
||||
#include <QStringList>
|
||||
@ -82,7 +84,7 @@ bool OptionsModel::saveTemplate(OptionsModel *model, const QString &name)
|
||||
const QString templateName = name.simplified();
|
||||
const QString appDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
||||
|
||||
if(templateName.contains('<') || templateName.contains('>') || templateName.contains('\\') || templateName.contains('/'))
|
||||
if(templateName.contains('\\') || templateName.contains('/'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -104,16 +106,17 @@ bool OptionsModel::saveTemplate(OptionsModel *model, const QString &name)
|
||||
return true;
|
||||
}
|
||||
|
||||
QMap<QString, OptionsModel*> OptionsModel::loadAllTemplates(void)
|
||||
bool OptionsModel::loadTemplate(OptionsModel *model, const QString &name)
|
||||
{
|
||||
QMap<QString, OptionsModel*> list;
|
||||
const QString appDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
||||
QSettings settings(QString("%1/templates.ini").arg(appDir), QSettings::IniFormat);
|
||||
QStringList allTemplates = settings.childGroups();
|
||||
|
||||
while(!allTemplates.isEmpty())
|
||||
if(name.contains('\\') || name.contains('/'))
|
||||
{
|
||||
settings.beginGroup(allTemplates.takeFirst());
|
||||
return false;
|
||||
}
|
||||
|
||||
QSettings settings(QString("%1/templates.ini").arg(appDir), QSettings::IniFormat);
|
||||
settings.beginGroup(name);
|
||||
|
||||
bool complete = true;
|
||||
if(!settings.contains("rate_control_mode")) complete = false;
|
||||
@ -126,18 +129,39 @@ QMap<QString, OptionsModel*> OptionsModel::loadAllTemplates(void)
|
||||
|
||||
if(complete)
|
||||
{
|
||||
OptionsModel *options = new OptionsModel();
|
||||
options->setRCMode(static_cast<OptionsModel::RCMode>(settings.value("rate_control_mode", options->m_rcMode).toInt()));
|
||||
options->setBitrate(settings.value("target_bitrate", options->m_bitrate).toUInt());
|
||||
options->setQuantizer(settings.value("target_quantizer", options->m_quantizer).toDouble());
|
||||
options->setPreset(settings.value("preset_name", options->m_preset).toString());
|
||||
options->setTune(settings.value("tuning_name", options->m_tune).toString());
|
||||
options->setProfile(settings.value("profile_name", options->m_profile).toString());
|
||||
options->setCustom(settings.value("custom_params", options->m_custom).toString());
|
||||
list.insert(settings.group(), options);
|
||||
model->setRCMode(static_cast<OptionsModel::RCMode>(settings.value("rate_control_mode", model->m_rcMode).toInt()));
|
||||
model->setBitrate(settings.value("target_bitrate", model->m_bitrate).toUInt());
|
||||
model->setQuantizer(settings.value("target_quantizer", model->m_quantizer).toDouble());
|
||||
model->setPreset(settings.value("preset_name", model->m_preset).toString());
|
||||
model->setTune(settings.value("tuning_name", model->m_tune).toString());
|
||||
model->setProfile(settings.value("profile_name", model->m_profile).toString());
|
||||
model->setCustom(settings.value("custom_params", model->m_custom).toString());
|
||||
}
|
||||
|
||||
settings.endGroup();
|
||||
return complete;
|
||||
}
|
||||
|
||||
QMap<QString, OptionsModel*> OptionsModel::loadAllTemplates(void)
|
||||
{
|
||||
QMap<QString, OptionsModel*> list;
|
||||
const QString appDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
||||
QSettings settings(QString("%1/templates.ini").arg(appDir), QSettings::IniFormat);
|
||||
QStringList allTemplates = settings.childGroups();
|
||||
|
||||
while(!allTemplates.isEmpty())
|
||||
{
|
||||
QString name = allTemplates.takeFirst();
|
||||
if(!(name.contains('<') || name.contains('>') || name.contains('\\') || name.contains('/')))
|
||||
{
|
||||
OptionsModel *options = new OptionsModel();
|
||||
if(loadTemplate(options, name))
|
||||
{
|
||||
list.insert(name, options);
|
||||
continue;
|
||||
}
|
||||
X264_DELETE(options);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
//Static functions
|
||||
static QString rcMode2String(RCMode mode);
|
||||
static bool saveTemplate(OptionsModel *model, const QString &name);
|
||||
static bool loadTemplate(OptionsModel *model, const QString &name);
|
||||
static QMap<QString, OptionsModel*> loadAllTemplates(void);
|
||||
static bool templateExists(const QString &name);
|
||||
static bool deleteTemplate(const QString &name);
|
||||
|
59
src/taskbar7.h
Normal file
59
src/taskbar7.h
Normal file
@ -0,0 +1,59 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
// http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "global.h"
|
||||
|
||||
class QWidget;
|
||||
class QIcon;
|
||||
struct ITaskbarList3;
|
||||
|
||||
class WinSevenTaskbar
|
||||
{
|
||||
public:
|
||||
WinSevenTaskbar(void);
|
||||
~WinSevenTaskbar(void);
|
||||
|
||||
//Taskbar states
|
||||
enum WinSevenTaskbarState
|
||||
{
|
||||
WinSevenTaskbarNoState = 0,
|
||||
WinSevenTaskbarNormalState = 1,
|
||||
WinSevenTaskbarIndeterminateState = 2,
|
||||
WinSevenTaskbarPausedState = 3,
|
||||
WinSevenTaskbarErrorState = 4
|
||||
};
|
||||
|
||||
//Public interface
|
||||
static bool handleWinEvent(MSG *message, long *result);
|
||||
static bool setTaskbarState(QWidget *window, WinSevenTaskbarState state);
|
||||
static void setTaskbarProgress(QWidget *window, unsigned __int64 currentValue, unsigned __int64 maximumValue);
|
||||
static void setOverlayIcon(QWidget *window, const QIcon *icon);
|
||||
|
||||
static void init(void);
|
||||
static void uninit(void);
|
||||
|
||||
private:
|
||||
static ITaskbarList3 *m_ptbl;
|
||||
static UINT m_winMsg;
|
||||
static void createInterface(void);
|
||||
};
|
@ -21,7 +21,7 @@
|
||||
|
||||
#define VER_X264_MAJOR 2
|
||||
#define VER_X264_MINOR 0
|
||||
#define VER_X264_PATCH 55
|
||||
#define VER_X264_PATCH 61
|
||||
|
||||
#define VER_X264_MINIMUM_REV 2146
|
||||
#define VER_X264_CURRENT_API 120
|
||||
|
@ -43,6 +43,7 @@
|
||||
|
||||
const char *home_url = "http://mulder.brhack.net/";
|
||||
const char *update_url = "http://code.google.com/p/mulder/downloads/list";
|
||||
const char *tpl_last = "<LAST_USED>";
|
||||
|
||||
#define SET_FONT_BOLD(WIDGET,BOLD) { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); }
|
||||
#define SET_TEXT_COLOR(WIDGET,COLOR) { QPalette _palette = WIDGET->palette(); _palette.setColor(QPalette::WindowText, (COLOR)); _palette.setColor(QPalette::Text, (COLOR)); WIDGET->setPalette(_palette); }
|
||||
@ -69,6 +70,10 @@ MainWindow::MainWindow(const x264_cpu_t *const cpuFeatures)
|
||||
PreferencesDialog::initPreferences(&m_preferences);
|
||||
PreferencesDialog::loadPreferences(&m_preferences);
|
||||
|
||||
//Create options object
|
||||
m_options = new OptionsModel();
|
||||
OptionsModel::loadTemplate(m_options, QString::fromLatin1(tpl_last));
|
||||
|
||||
//Freeze minimum size
|
||||
setMinimumSize(size());
|
||||
splitter->setSizes(QList<int>() << 16 << 196);
|
||||
@ -142,13 +147,12 @@ MainWindow::MainWindow(const x264_cpu_t *const cpuFeatures)
|
||||
m_label->addActions(jobsView->actions());
|
||||
connect(splitter, SIGNAL(splitterMoved(int, int)), this, SLOT(updateLabelPos()));
|
||||
updateLabelPos();
|
||||
|
||||
//Create options object
|
||||
m_options = new OptionsModel();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow(void)
|
||||
{
|
||||
OptionsModel::saveTemplate(m_options, QString::fromLatin1(tpl_last));
|
||||
|
||||
X264_DELETE(m_jobList);
|
||||
X264_DELETE(m_options);
|
||||
X264_DELETE(m_label);
|
||||
|
@ -26,6 +26,7 @@
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>Windows7.1SDK</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
Loading…
Reference in New Issue
Block a user