Implemented update reminder to main window. Also added option to disable update reminder to preferences dialog.

This commit is contained in:
LoRd_MuldeR 2013-12-14 22:30:19 +01:00
parent e194239b96
commit 8d9fb210c6
17 changed files with 619 additions and 478 deletions

Binary file not shown.

View File

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>379</width>
<height>432</height>
<width>372</width>
<height>387</height>
</rect>
</property>
<property name="windowTitle">
@ -21,36 +21,57 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string> Preferences </string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="13" column="1" colspan="5">
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="checkRunNextJob">
<property name="text">
<string notr="true"/>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</widget>
</item>
<item>
<widget class="QLabel" name="labelRunNextJob">
<property name="text">
<string>Automatically launch next job when a running job completes</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2" colspan="2">
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="checkBoxDummy1">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelJobCount">
<property name="enabled">
<bool>false</bool>
@ -63,34 +84,7 @@
</property>
</widget>
</item>
<item row="1" column="2" colspan="4">
<widget class="QLabel" name="labelRunNextJob">
<property name="text">
<string>Automatically launch next job when a running job completes</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkRunNextJob">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="2" column="5">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="4">
<item>
<widget class="QSpinBox" name="spinBoxJobCount">
<property name="enabled">
<bool>false</bool>
@ -112,7 +106,55 @@
</property>
</widget>
</item>
<item row="6" column="1">
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QCheckBox" name="checkUse10BitEncoding">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelUse10BitEncoding">
<property name="text">
<string>Use 10-Bit version of x264 → implies 'High 10' H.264 Profile</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QCheckBox" name="checkUse64BitAvs2YUV">
<property name="toolTip">
<string>If this option is un-checked (default), then 32-Bit Avisynth will be used - even when using 64-Bit x264.
@ -123,69 +165,7 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
</property>
</widget>
</item>
<item row="3" column="1" colspan="5">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
<item row="12" column="1">
<widget class="QCheckBox" name="checkShutdownComputer">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="12" column="2" colspan="4">
<widget class="QLabel" name="labelShutdownComputer">
<property name="text">
<string>Shutdown computer as soon as the last job has completed</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="5">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>12</height>
</size>
</property>
</spacer>
</item>
<item row="19" column="1" colspan="5">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>12</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="2" colspan="4">
<item>
<widget class="QLabel" name="labelUse64BitAvs2YUV">
<property name="toolTip">
<string>If this option is un-checked (default), then 32-Bit Avisynth will be used - even when using 64-Bit x264.
@ -196,113 +176,134 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
</property>
</widget>
</item>
<item row="7" column="1" colspan="5">
<spacer name="verticalSpacer_4">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="checkUse10BitEncoding">
<property name="text">
<string notr="true"/>
</property>
</widget>
</layout>
</item>
<item row="4" column="2" colspan="4">
<widget class="QLabel" name="labelUse10BitEncoding">
<property name="text">
<string>Use 10-Bit version of x264 → implies 'High 10' H.264 Profile</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="5">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="1">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QCheckBox" name="checkSaveLogFiles">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="8" column="2" colspan="4">
<item>
<widget class="QLabel" name="labelSaveLogFiles">
<property name="text">
<string>Automatically save output to log file when a job has finished</string>
</property>
</widget>
</item>
<item row="9" column="1" colspan="5">
<spacer name="verticalSpacer_6">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="10" column="2" colspan="4">
<widget class="QLabel" name="labelSaveToSourceFolder">
<property name="text">
<string>Save output to the same folder where the source is located</string>
</property>
</widget>
</layout>
</item>
<item row="11" column="1" colspan="5">
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
<item row="10" column="1">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QCheckBox" name="checkSaveToSourceFolder">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="14" column="4">
<item>
<widget class="QLabel" name="labelSaveToSourceFolder">
<property name="text">
<string>Save output to the same folder where the source is located</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QCheckBox" name="checkShutdownComputer">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelShutdownComputer">
<property name="text">
<string>Shutdown computer as soon as the last job has completed</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QCheckBox" name="checkBoxDummy2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelProcessPriority">
<property name="text">
<string>Priority for encoder processes:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxPriority">
<property name="editable">
<bool>false</bool>
@ -332,8 +333,8 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
</item>
</widget>
</item>
<item row="14" column="5">
<spacer name="horizontalSpacer_5">
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -345,100 +346,97 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
</property>
</spacer>
</item>
<item row="14" column="2" colspan="2">
<widget class="QLabel" name="labelProcessPriority">
<property name="text">
<string>Priority for encoder processes:</string>
</property>
</widget>
</layout>
</item>
<item row="16" column="1">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QCheckBox" name="checkEnableSounds">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="16" column="2" colspan="4">
<item>
<widget class="QLabel" name="labelEnableSounds">
<property name="text">
<string>Enable sound effects when a job has completed or failed</string>
</property>
</widget>
</item>
<item row="15" column="1" colspan="5">
<spacer name="verticalSpacer_9">
<item>
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="18" column="2" colspan="4">
<widget class="QLabel" name="labelDisableWarnings">
<property name="text">
<string>Never show warning about missing Avisynth or VapourSynth</string>
</property>
</widget>
</layout>
</item>
<item row="18" column="1">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_13">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QCheckBox" name="checkDisableWarnings">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="17" column="1" colspan="5">
<spacer name="verticalSpacer_10">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item>
<widget class="QLabel" name="labelDisableWarnings">
<property name="text">
<string>Never show warning about missing Avisynth or VapourSynth</string>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</widget>
</item>
<item row="1" column="6" rowspan="18">
<spacer name="horizontalSpacer_3">
<item>
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>12</width>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" rowspan="18">
<spacer name="horizontalSpacer_2">
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QCheckBox" name="checkNoUpdateReminder">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelNoUpdateReminder">
<property name="text">
<string>Never show auto-update notifications on application startup</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_14">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>8</width>
<width>40</width>
<height>20</height>
</size>
</property>
@ -447,6 +445,8 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
@ -505,10 +505,6 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
<tabstops>
<tabstop>closeButton</tabstop>
<tabstop>resetButton</tabstop>
<tabstop>checkRunNextJob</tabstop>
<tabstop>spinBoxJobCount</tabstop>
<tabstop>checkUse64BitAvs2YUV</tabstop>
<tabstop>checkShutdownComputer</tabstop>
</tabstops>
<resources>
<include location="../res/resources.qrc"/>

View File

@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>428</width>
<height>257</height>
<height>247</height>
</rect>
</property>
<property name="palette">
@ -94,6 +94,9 @@
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="logo">
<property name="minimumSize">
@ -152,6 +155,9 @@
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
@ -218,7 +224,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
<height>12</height>
</size>
</property>
</spacer>
@ -289,7 +295,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
<height>12</height>
</size>
</property>
</spacer>
@ -360,7 +366,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>6</height>
<height>8</height>
</size>
</property>
</spacer>
@ -373,7 +379,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<height>0</height>
</size>
</property>
</spacer>
@ -403,6 +409,22 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>3</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labelLoadingCenter">
<property name="text">
@ -413,6 +435,22 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>3</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labelLoadingRight">
<property name="text">
@ -438,6 +476,35 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="labelBuildNo">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">(Build number: installed vs. latest)</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labelInfo">
<property name="text">
@ -493,7 +560,7 @@
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>http://www.example.com/update_info.html</string>
<string notr="true">http://www.example.com/update_info.html</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse</set>
@ -501,17 +568,14 @@
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<height>0</height>
</size>
</property>
</spacer>

BIN
res/buttons/shield_blue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -36,6 +36,7 @@
<file>buttons/restart.png</file>
<file>buttons/setup.png</file>
<file>buttons/shield_admin.png</file>
<file>buttons/shield_blue.png</file>
<file>buttons/shield_error.png</file>
<file>buttons/shield_exclamation.png</file>
<file>buttons/shield_green.png</file>

View File

@ -49,6 +49,7 @@ void PreferencesModel::initPreferences(PreferencesModel *preferences)
preferences->m_processPriority = -1;
preferences->m_enableSounds = false;
preferences->m_disableWarnings = false;
preferences->m_noUpdateReminder = false;
}
void PreferencesModel::loadPreferences(PreferencesModel *preferences)
@ -69,6 +70,7 @@ void PreferencesModel::loadPreferences(PreferencesModel *preferences)
preferences->m_processPriority = settings.value("process_priority", QVariant(defaults.m_processPriority)).toInt();
preferences->m_enableSounds = settings.value("enable_sounds", QVariant(defaults.m_enableSounds)).toBool();
preferences->m_disableWarnings = settings.value("disable_warnings", QVariant(defaults.m_disableWarnings)).toBool();
preferences->m_noUpdateReminder = settings.value("disable_update_reminder", QVariant(defaults.m_disableWarnings)).toBool();
}
void PreferencesModel::savePreferences(PreferencesModel *preferences)
@ -87,5 +89,6 @@ void PreferencesModel::savePreferences(PreferencesModel *preferences)
settings.setValue("process_priority", preferences->m_processPriority);
settings.setValue("enable_sounds", preferences->m_enableSounds);
settings.setValue("disable_warnings", preferences->m_disableWarnings);
settings.setValue("disable_update_reminder", preferences->m_noUpdateReminder);
settings.sync();
}

View File

@ -37,6 +37,7 @@ public:
int processPriority(void) { return m_processPriority; }
bool enableSounds(void) { return m_enableSounds; }
bool disableWarnings(void) { return m_disableWarnings; }
bool noUpdateReminder(void) { return m_noUpdateReminder; }
//Setter
void setAutoRunNextJob(const bool autoRunNextJob) { m_autoRunNextJob = autoRunNextJob; }
@ -49,6 +50,7 @@ public:
void setProcessPriority(const int processPriority) { m_processPriority = processPriority; }
void setEnableSounds(const bool enableSounds) { m_enableSounds = enableSounds; }
void setDisableWarnings(const bool disableWarnings) { m_disableWarnings = disableWarnings; }
void setNoUpdateReminder(const bool noUpdateReminder) { m_noUpdateReminder = noUpdateReminder; }
//Static
static void initPreferences(PreferencesModel *preferences);
@ -66,4 +68,5 @@ protected:
int m_processPriority;
bool m_enableSounds;
bool m_disableWarnings;
bool m_noUpdateReminder;
};

View File

@ -26,6 +26,7 @@
#include <QDesktopServices>
#include <QDir>
#include <QSettings>
#include <QDate>
#define ARRAY_SIZE(ARRAY) (sizeof((ARRAY))/sizeof((ARRAY[0])))
#define VALID_DIR(PATH) ((!(PATH).isEmpty()) && QFileInfo(PATH).exists() && QFileInfo(PATH).isDir())
@ -33,27 +34,43 @@
static const char *KEY_FILTER_IDX = "path/filterIndex";
static const char *KEY_SOURCE_DIR = "path/directory_openFrom";
static const char *KEY_OUTPUT_DIR = "path/directory_saveTo";
static const char *KEY_UPDATE_CHK = "auto_update/last_successfull_check";
static void READ_INT(QSettings &settings, const QString &key, int default, int *value)
{
bool ok = false;
const int temp = settings.value(key, default).toInt(&ok);
*value = (ok) ? temp : default;
}
RecentlyUsed::RecentlyUsed(void)
{
initRecentlyUsed(this);
}
RecentlyUsed::~RecentlyUsed(void)
{
/*nothing to do*/
}
void RecentlyUsed::initRecentlyUsed(RecentlyUsed *recentlyUsed)
{
recentlyUsed->m_sourceDirectory = QDir::fromNativeSeparators(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation));
recentlyUsed->m_outputDirectory = QDir::fromNativeSeparators(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation));
recentlyUsed->m_filterIndex = 0;
recentlyUsed->m_lastUpdateCheck = QDate(1969, 8, 15).toJulianDay();
}
void RecentlyUsed::loadRecentlyUsed(RecentlyUsed *recentlyUsed)
{
RecentlyUsed defaults;
QSettings settings(QString("%1/last.ini").arg(x264_data_path()), QSettings::IniFormat);
int temp = 0;
recentlyUsed->m_sourceDirectory = settings.value(KEY_SOURCE_DIR, defaults.m_sourceDirectory).toString();
recentlyUsed->m_outputDirectory = settings.value(KEY_OUTPUT_DIR, defaults.m_outputDirectory).toString();
recentlyUsed->m_filterIndex = settings.value(KEY_FILTER_IDX, defaults.m_filterIndex).toInt();
READ_INT(settings, KEY_FILTER_IDX, defaults.m_filterIndex, &recentlyUsed->m_filterIndex);
READ_INT(settings, KEY_UPDATE_CHK, defaults.m_lastUpdateCheck, &recentlyUsed->m_lastUpdateCheck);
if(!VALID_DIR(recentlyUsed->m_sourceDirectory)) recentlyUsed->m_sourceDirectory = defaults.m_sourceDirectory;
if(!VALID_DIR(recentlyUsed->m_outputDirectory)) recentlyUsed->m_outputDirectory = defaults.m_outputDirectory;
@ -68,6 +85,11 @@ void RecentlyUsed::saveRecentlyUsed(RecentlyUsed *recentlyUsed)
settings.setValue(KEY_SOURCE_DIR, recentlyUsed->m_sourceDirectory);
settings.setValue(KEY_OUTPUT_DIR, recentlyUsed->m_outputDirectory);
settings.setValue(KEY_FILTER_IDX, recentlyUsed->m_filterIndex);
settings.setValue(KEY_UPDATE_CHK, recentlyUsed->m_lastUpdateCheck);
settings.sync();
}
else
{
qWarning("Settings are not writable!");
}
}

View File

@ -39,6 +39,7 @@ class RecentlyUsed
{
public:
RecentlyUsed(void);
~RecentlyUsed(void);
static void initRecentlyUsed(RecentlyUsed *recentlyUsed);
static void loadRecentlyUsed(RecentlyUsed *recentlyUsed);
@ -48,14 +49,17 @@ public:
QString sourceDirectory(void) { return m_sourceDirectory; }
QString outputDirectory(void) { return m_outputDirectory; }
int filterIndex(void) { return m_filterIndex; }
int lastUpdateCheck(void) { return m_lastUpdateCheck; }
//Setter
void setSourceDirectory(const QString &sourceDirectory) { m_sourceDirectory = sourceDirectory; }
void setOutputDirectory(const QString &outputDirectory) { m_outputDirectory = outputDirectory; }
void setFilterIndex(const int filterIndex) { m_filterIndex = filterIndex; }
void setLastUpdateCheck(const int updateCheck) { m_lastUpdateCheck = updateCheck; }
protected:
QString m_sourceDirectory;
QString m_outputDirectory;
int m_filterIndex;
int m_lastUpdateCheck;
};

View File

@ -25,8 +25,8 @@
#define VER_X264_MAJOR 2
#define VER_X264_MINOR 2
#define VER_X264_PATCH 7
#define VER_X264_BUILD 704
#define VER_X264_PATCH 8
#define VER_X264_BUILD 720
#define VER_X264_MINIMUM_REV 2363
#define VER_X264_CURRENT_API 140

View File

@ -56,7 +56,7 @@
#include <ctime>
const char *home_url = "http://muldersoft.com/";
const char *update_url = "http://code.google.com/p/mulder/downloads/list";
const char *update_url = "https://github.com/lordmulder/Simple-x264-Launcher/releases/latest";
const char *tpl_last = "<LAST_USED>";
#define SET_FONT_BOLD(WIDGET,BOLD) do { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); } while(0)
@ -868,21 +868,44 @@ void MainWindow::init(void)
qDebug(" ");
}
//Update initialized flag (must do this before update check!)
m_initialized = true;
//Enable drag&drop support for this window, required for Qt v4.8.4+
setAcceptDrops(true);
//Check for expiration
if(x264_version_date().addMonths(6) < QDate::currentDate())
if(x264_version_date().addMonths(6) < x264_current_date_safe())
{
QString text;
text += QString("<nobr><tt>%1</tt></nobr><br><br>").arg(tr("Your version of Simple x264 Launcher is more than 6 months old!").replace("-", "&minus;"));
text += QString("<nobr><tt>%1<br><a href=\"%2\">%2</a><br><br>").arg(tr("You can download the most recent version from the official web-site now:").replace("-", "&minus;"), QString::fromLatin1(update_url));
text += QString("<nobr><tt>%1</tt></nobr><br>").arg(tr("Alternatively, click 'Check for Updates' to run the auto-update utility.").replace("-", "&minus;"));
QMessageBox msgBox(this);
msgBox.setIconPixmap(QIcon(":/images/update.png").pixmap(56,56));
msgBox.setWindowTitle(tr("Update Notification"));
msgBox.setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
msgBox.setText(tr("<nobr><tt>Your version of 'Simple x264 Launcher' is more than 6 months old!<br><br>Please download the most recent version from the official web-site at:<br><a href=\"%1\">%1</a><br></tt></nobr>").replace("-", "&minus;").arg(update_url));
QPushButton *btn1 = msgBox.addButton(tr("Discard"), QMessageBox::NoRole);
QPushButton *btn2 = msgBox.addButton(tr("Discard"), QMessageBox::AcceptRole);
btn1->setEnabled(false);
btn2->setVisible(false);
QTimer::singleShot(5000, btn1, SLOT(hide()));
QTimer::singleShot(5000, btn2, SLOT(show()));
msgBox.exec();
msgBox.setText(text);
QPushButton *btn1 = msgBox.addButton(tr("Check for Updates"), QMessageBox::AcceptRole);
QPushButton *btn2 = msgBox.addButton(tr("Discard"), QMessageBox::NoRole);
QPushButton *btn3 = msgBox.addButton(btn2->text(), QMessageBox::RejectRole);
btn2->setEnabled(false);
btn3->setVisible(false);
QTimer::singleShot(7500, btn2, SLOT(hide()));
QTimer::singleShot(7500, btn3, SLOT(show()));
if(msgBox.exec() == 0)
{
QTimer::singleShot(0, this, SLOT(checkUpdates()));
return;
}
}
else if((!m_preferences->noUpdateReminder()) && (m_recentlyUsed->lastUpdateCheck() + 14 < x264_current_date_safe().toJulianDay()))
{
if(QMessageBox::warning(this, tr("Update Notification"), QString("<nobr>%1</nobr>").arg(tr("Your last update check was more than 14 days ago. Check for updates now?")), tr("Check for Updates"), tr("Discard")) == 0)
{
QTimer::singleShot(0, this, SLOT(checkUpdates()));
return;
}
}
//Add files from command-line
@ -905,15 +928,6 @@ void MainWindow::init(void)
{
createJobMultiple(files);
}
//Enable drag&drop support for this window, required for Qt v4.8.4+
setAcceptDrops(true);
//Update initialized flag
m_initialized = true;
//FIXME
QTimer::singleShot(333, this, SLOT(checkUpdates()));
}
/*
@ -980,10 +994,15 @@ void MainWindow::checkUpdates(void)
UpdaterDialog *updater = new UpdaterDialog(this, QString("%1/toolset").arg(m_appDir));
const int ret = updater->exec();
if(ret == 42)
if(updater->getSuccess())
{
X264_DELETE(updater);
qWarning("Exitting to install update...");
m_recentlyUsed->setLastUpdateCheck(x264_current_date_safe().toJulianDay());
RecentlyUsed::saveRecentlyUsed(m_recentlyUsed);
}
if(ret == UpdaterDialog::READY_TO_INSTALL_UPDATE)
{
qWarning("Exitting program to install update...");
close();
QApplication::quit();
}

View File

@ -30,7 +30,7 @@
#include <QMouseEvent>
#include <QMessageBox>
static inline void UPDATE_CHECKBOX(QCheckBox *const chkbox, const bool value, const bool block)
static inline void UPDATE_CHECKBOX(QCheckBox *const chkbox, const bool value, const bool block = false)
{
if(block) { chkbox->blockSignals(true); }
if(chkbox->isChecked() != value) chkbox->click();
@ -76,6 +76,10 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, PreferencesModel *preferen
ui->labelSaveToSourceFolder->installEventFilter(this);
ui->labelEnableSounds->installEventFilter(this);
ui->labelDisableWarnings->installEventFilter(this);
ui->labelNoUpdateReminder->installEventFilter(this);
ui->checkBoxDummy1->installEventFilter(this);
ui->checkBoxDummy2->installEventFilter(this);
connect(ui->resetButton, SIGNAL(clicked()), this, SLOT(resetButtonPressed()));
connect(ui->checkUse10BitEncoding, SIGNAL(toggled(bool)), this, SLOT(use10BitEncodingToggled(bool)));
@ -93,12 +97,13 @@ void PreferencesDialog::showEvent(QShowEvent *event)
{
if(event) QDialog::showEvent(event);
UPDATE_CHECKBOX(ui->checkRunNextJob, m_preferences->autoRunNextJob(), false);
UPDATE_CHECKBOX(ui->checkShutdownComputer, m_preferences->shutdownComputer(), false);
UPDATE_CHECKBOX(ui->checkUse64BitAvs2YUV, m_preferences->useAvisyth64Bit(), false);
UPDATE_CHECKBOX(ui->checkSaveLogFiles, m_preferences->saveLogFiles(), false);
UPDATE_CHECKBOX(ui->checkSaveToSourceFolder, m_preferences->saveToSourcePath(), false);
UPDATE_CHECKBOX(ui->checkEnableSounds, m_preferences->enableSounds(), false);
UPDATE_CHECKBOX(ui->checkRunNextJob, m_preferences->autoRunNextJob());
UPDATE_CHECKBOX(ui->checkShutdownComputer, m_preferences->shutdownComputer());
UPDATE_CHECKBOX(ui->checkUse64BitAvs2YUV, m_preferences->useAvisyth64Bit());
UPDATE_CHECKBOX(ui->checkSaveLogFiles, m_preferences->saveLogFiles());
UPDATE_CHECKBOX(ui->checkSaveToSourceFolder, m_preferences->saveToSourcePath());
UPDATE_CHECKBOX(ui->checkEnableSounds, m_preferences->enableSounds());
UPDATE_CHECKBOX(ui->checkNoUpdateReminder, m_preferences->noUpdateReminder());
UPDATE_CHECKBOX(ui->checkDisableWarnings, m_preferences->disableWarnings(), true);
UPDATE_CHECKBOX(ui->checkUse10BitEncoding, m_preferences->use10BitEncoding(), true);
@ -111,6 +116,13 @@ void PreferencesDialog::showEvent(QShowEvent *event)
}
bool PreferencesDialog::eventFilter(QObject *o, QEvent *e)
{
if(e->type() == QEvent::Paint)
{
if(o == ui->checkBoxDummy1) return true;
if(o == ui->checkBoxDummy2) return true;
}
else if((e->type() == QEvent::MouseButtonPress) || (e->type() == QEvent::MouseButtonRelease))
{
emulateMouseEvent(o, e, ui->labelRunNextJob, ui->checkRunNextJob);
emulateMouseEvent(o, e, ui->labelShutdownComputer, ui->checkShutdownComputer);
@ -120,28 +132,27 @@ bool PreferencesDialog::eventFilter(QObject *o, QEvent *e)
emulateMouseEvent(o, e, ui->labelSaveToSourceFolder, ui->checkSaveToSourceFolder);
emulateMouseEvent(o, e, ui->labelEnableSounds, ui->checkEnableSounds);
emulateMouseEvent(o, e, ui->labelDisableWarnings, ui->checkDisableWarnings);
emulateMouseEvent(o, e, ui->labelNoUpdateReminder, ui->checkNoUpdateReminder);
}
return false;
}
void PreferencesDialog::emulateMouseEvent(QObject *object, QEvent *event, QWidget *source, QWidget *target)
{
if(object == source)
{
if((event->type() == QEvent::MouseButtonPress) || (event->type() == QEvent::MouseButtonRelease))
{
if(QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(event))
{
qApp->postEvent(target, new QMouseEvent
(
event->type(),
qApp->widgetAt(mouseEvent->globalPos()) == source ? QPoint(1, 1) : QPoint(INT_MAX, INT_MAX),
(qApp->widgetAt(mouseEvent->globalPos()) == source) ? QPoint(1, 1) : QPoint(INT_MAX, INT_MAX),
Qt::LeftButton,
0, 0
));
}
}
}
}
void PreferencesDialog::done(int n)
{
@ -155,6 +166,7 @@ void PreferencesDialog::done(int n)
m_preferences->setProcessPriority(ui->comboBoxPriority->itemData(ui->comboBoxPriority->currentIndex()).toInt());
m_preferences->setEnableSounds(ui->checkEnableSounds->isChecked());
m_preferences->setDisableWarnings(ui->checkDisableWarnings->isChecked());
m_preferences->setNoUpdateReminder(ui->checkNoUpdateReminder->isChecked());
PreferencesModel::savePreferences(m_preferences);
QDialog::done(n);

View File

@ -45,7 +45,7 @@ protected:
virtual void showEvent(QShowEvent *event);
virtual bool eventFilter(QObject *o, QEvent *e);
void emulateMouseEvent(QObject *object, QEvent *event, QWidget *source, QWidget *target);
inline static void emulateMouseEvent(QObject *object, QEvent *event, QWidget *source, QWidget *target);
private:
Ui::PreferencesDialog *const ui;

View File

@ -47,6 +47,7 @@
ui->labelLoadingLeft->setVisible((FLAG)); \
ui->labelLoadingCenter->setVisible((FLAG)); \
ui->labelLoadingRight->setVisible((FLAG)); \
ui->labelBuildNo->setVisible(!(FLAG)); \
ui->labelInfo->setVisible(!(FLAG)); \
ui->labelUrl->setVisible(!(FLAG)); \
if((FLAG)) m_animator->start(); else m_animator->stop(); \
@ -66,6 +67,7 @@ UpdaterDialog::UpdaterDialog(QWidget *parent, const QString &binDir)
m_status(UpdateCheckThread::UpdateStatus_NotStartedYet),
m_thread(NULL),
m_updaterProcess(NULL),
m_success(false),
m_firstShow(true)
{
//Init the dialog, from the .ui file
@ -96,6 +98,7 @@ UpdaterDialog::UpdaterDialog(QWidget *parent, const QString &binDir)
//Hide labels
ui->labelInfo->hide();
ui->labelUrl->hide();
ui->labelBuildNo->hide();
}
UpdaterDialog::~UpdaterDialog(void)
@ -146,7 +149,7 @@ void UpdaterDialog::showEvent(QShowEvent *event)
if(m_firstShow)
{
m_firstShow = false;
QTimer::singleShot(0, this, SLOT(initUpdate()));
QTimer::singleShot(16, this, SLOT(initUpdate()));
}
}
@ -204,7 +207,7 @@ void UpdaterDialog::initUpdate(void)
}
//Begin updater run
QTimer::singleShot(125, this, SLOT(checkForUpdates()));
QTimer::singleShot(16, this, SLOT(checkForUpdates()));
}
void UpdaterDialog::checkForUpdates(void)
@ -216,6 +219,7 @@ void UpdaterDialog::checkForUpdates(void)
//Clear texts
ui->retranslateUi(this);
ui->labelBuildNo->setText(tr("Installed build is #%1 | Latest build is #%2").arg(QString::number(x264_version_build()), tr("N/A")));
//Init buttons
ui->buttonCancel->setEnabled(false);
@ -240,7 +244,7 @@ void UpdaterDialog::checkForUpdates(void)
m_logFile.clear();
//Start the updater thread
QTimer::singleShot(125, m_thread, SLOT(start()));
QTimer::singleShot(250, m_thread, SLOT(start()));
}
void UpdaterDialog::threadStatusChanged(int status)
@ -290,6 +294,12 @@ void UpdaterDialog::threadStatusChanged(int status)
}
void UpdaterDialog::threadFinished(void)
{
m_success = m_thread->getSuccess();
QTimer::singleShot((m_success ? 1000 : 0), this, SLOT(updateFinished()));
}
void UpdaterDialog::updateFinished(void)
{
//Restore cursor
QApplication::restoreOverrideCursor();
@ -309,7 +319,7 @@ void UpdaterDialog::threadFinished(void)
UPDATE_TEXT(3, tr("Your version is up-to-date."));
break;
case UpdateCheckThread::UpdateStatus_CompletedNewVersionOlder:
UPDATE_ICON(3, "shield_error");
UPDATE_ICON(3, "shield_blue");
UPDATE_TEXT(3, tr("You are using a pre-release version!"));
break;
default:
@ -324,6 +334,7 @@ void UpdaterDialog::threadFinished(void)
case UpdateCheckThread::UpdateStatus_CompletedNoUpdates:
case UpdateCheckThread::UpdateStatus_CompletedNewVersionOlder:
SHOW_ANIMATION(false);
ui->labelBuildNo->setText(tr("Installed build is #%1 | Latest build is #%2").arg(QString::number(x264_version_build()), QString::number(m_thread->getUpdateInfo()->m_buildNo)));
ui->labelUrl->setText(QString("<a href=\"%1\">%1</a>").arg(m_thread->getUpdateInfo()->m_downloadSite));
break;
case UpdateCheckThread::UpdateStatus_ErrorNoConnection:
@ -411,7 +422,7 @@ void UpdaterDialog::installUpdate(void)
if(process.exitCode() == 0)
{
done(42);
done(READY_TO_INSTALL_UPDATE);
}
}

View File

@ -39,6 +39,10 @@ public:
UpdaterDialog(QWidget *parent, const QString &binDir);
~UpdaterDialog(void);
static const int READY_TO_INSTALL_UPDATE = 42;
inline bool getSuccess(void) { return m_success; }
protected:
virtual bool event(QEvent *e);
virtual void showEvent(QShowEvent *event);
@ -51,6 +55,7 @@ private slots:
void threadStatusChanged(int status);
void threadMessageLogged(const QString &message);
void threadFinished(void);
void updateFinished(void);
void openUrl(const QString &url);
void installUpdate(void);
@ -61,6 +66,7 @@ private:
bool checkFileHash(const QString &filePath, const char *expectedHash);
bool m_firstShow;
bool m_success;
const QString m_binDir;
QMovie *m_animator;
UpdateCheckThread *m_thread;

View File

@ -97,7 +97,7 @@ copy /Y "$(SolutionDir)etc\vld\bin\Win32\*.manifest" "$(TargetDir)"
<Message>Copy Toolset</Message>
</PostBuildEvent>
<PreBuildEvent>
<Command>"$(SolutionDir)etc\auto_inc.exe" VER_X264_BUILD "$(SolutionDir)src\version.h" 5</Command>
<Command>"$(SolutionDir)etc\auto_inc.exe" VER_X264_BUILD "$(SolutionDir)src\version.h" 30</Command>
<Message>Update Build Number</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
@ -135,7 +135,7 @@ copy /Y "$(SolutionDir)etc\vld\bin\Win32\*.manifest" "$(TargetDir)"
<EntryPointSymbol>x264_entry_point</EntryPointSymbol>
</Link>
<PreBuildEvent>
<Command>"$(SolutionDir)etc\auto_inc.exe" VER_X264_BUILD "$(SolutionDir)src\version.h" 5</Command>
<Command>"$(SolutionDir)etc\auto_inc.exe" VER_X264_BUILD "$(SolutionDir)src\version.h" 30</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Update Build Number</Message>