diff --git a/etc/setup/license.rtf b/etc/setup/license.rtf index fba20eb..f391f9b 100644 Binary files a/etc/setup/license.rtf and b/etc/setup/license.rtf differ diff --git a/gui/win_preferences.ui b/gui/win_preferences.ui index bf8478e..65af5a7 100644 --- a/gui/win_preferences.ui +++ b/gui/win_preferences.ui @@ -9,8 +9,8 @@ 0 0 - 379 - 432 + 372 + 387 @@ -21,428 +21,428 @@ - - - - 0 - 0 - - + Preferences - + - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 8 - - - + + + + + + + + + + + + + + Automatically launch next job when a running job completes + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - false - - - If the specified number of jobs (or even more) is already running, the next one will NOT be launched yet. - - - Maximum number of running jobs: - - + + + + + + false + + + + + + + + + + false + + + If the specified number of jobs (or even more) is already running, the next one will NOT be launched yet. + + + Maximum number of running jobs: + + + + + + + false + + + + 80 + 0 + + + + If the specified number of jobs (or even more) is already running, the next one will NOT be launched yet. + + + 1 + + + 16 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - Automatically launch next job when a running job completes - - + + + + + + + + + + + + + Use 10-Bit version of x264 → implies 'High 10' H.264 Profile + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - - - - - - - - Qt::Horizontal - - - - 0 - 20 - - - - - - - - false - - - - 80 - 0 - - - - If the specified number of jobs (or even more) is already running, the next one will NOT be launched yet. - - - 1 - - - 16 - - - - - - - If this option is un-checked (default), then 32-Bit Avisynth will be used - even when using 64-Bit x264. + + + + + + If this option is un-checked (default), then 32-Bit Avisynth will be used - even when using 64-Bit x264. Please be aware that this option does NOT have any effect on 32-Bit systems. - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 8 - - - - - - - - - - - - - - - Shutdown computer as soon as the last job has completed - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 12 - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 12 - - - - - - - - If this option is un-checked (default), then 32-Bit Avisynth will be used - even when using 64-Bit x264. + + + + + + + + + + If this option is un-checked (default), then 32-Bit Avisynth will be used - even when using 64-Bit x264. Please be aware that this option does NOT have any effect on 32-Bit systems. - - - Use 64-Bit Avisynth/Avs2YUV, if running on a 64-Bit machine - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 8 - - - - - - - - - - - - - - - Use 10-Bit version of x264 → implies 'High 10' H.264 Profile - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 8 - - - - - - - - - - - - - - - Automatically save output to log file when a job has finished - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 8 - - - - - - - - Save output to the same folder where the source is located - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 8 - - - - - - - - - - - - - - - false - - - true - - - - Above Normal - + + + Use 64-Bit Avisynth/Avs2YUV, if running on a 64-Bit machine + + - - Normal - + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + - - Below Normal - + + + Automatically save output to log file when a job has finished + + - - Idle - + + + Qt::Horizontal + + + + 40 + 20 + + + - + - - - - Qt::Horizontal - - - - 40 - 20 - - - + + + + + + + + + + + + + Save output to the same folder where the source is located + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - Priority for encoder processes: - - + + + + + + + + + + + + + Shutdown computer as soon as the last job has completed + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - - - + + + + + + false + + + + + + + + + + Priority for encoder processes: + + + + + + + false + + + true + + + + Above Normal + + + + + Normal + + + + + Below Normal + + + + + Idle + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - Enable sound effects when a job has completed or failed - - + + + + + + + + + + + + + Enable sound effects when a job has completed or failed + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - Qt::Vertical + + + + 6 - - QSizePolicy::Fixed - - - - 20 - 8 - - - + + + + + + + + + + + Never show warning about missing Avisynth or VapourSynth + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - Never show warning about missing Avisynth or VapourSynth - - - - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 8 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 12 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 8 - 20 - - - + + + + + + + + + + + + + Never show auto-update notifications on application startup + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + @@ -505,10 +505,6 @@ Please be aware that this option does NOT have any effect on 32-Bit systems. closeButton resetButton - checkRunNextJob - spinBoxJobCount - checkUse64BitAvs2YUV - checkShutdownComputer diff --git a/gui/win_updater.ui b/gui/win_updater.ui index eb6fe61..accbc50 100644 --- a/gui/win_updater.ui +++ b/gui/win_updater.ui @@ -10,7 +10,7 @@ 0 0 428 - 257 + 247 @@ -94,6 +94,9 @@ + + 0 + @@ -152,6 +155,9 @@ + + 0 + @@ -218,7 +224,7 @@ 20 - 8 + 12 @@ -289,7 +295,7 @@ 20 - 8 + 12 @@ -360,7 +366,7 @@ 20 - 6 + 8 @@ -373,7 +379,7 @@ 20 - 40 + 0 @@ -403,6 +409,22 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 3 + 20 + + + + @@ -413,6 +435,22 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 3 + 20 + + + + @@ -438,6 +476,35 @@ + + + + + 75 + true + + + + (Build number: installed vs. latest) + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + @@ -493,7 +560,7 @@ PointingHandCursor - http://www.example.com/update_info.html + http://www.example.com/update_info.html Qt::LinksAccessibleByMouse @@ -501,17 +568,14 @@ - + Qt::Vertical - - QSizePolicy::Expanding - 20 - 40 + 0 diff --git a/res/buttons/shield_blue.png b/res/buttons/shield_blue.png new file mode 100644 index 0000000..2ded609 Binary files /dev/null and b/res/buttons/shield_blue.png differ diff --git a/res/images/update_wizard.png b/res/images/update_wizard.png index 0732709..4aa8ffe 100644 Binary files a/res/images/update_wizard.png and b/res/images/update_wizard.png differ diff --git a/res/resources.qrc b/res/resources.qrc index 0bf1d1a..82a715d 100644 --- a/res/resources.qrc +++ b/res/resources.qrc @@ -36,6 +36,7 @@ buttons/restart.png buttons/setup.png buttons/shield_admin.png + buttons/shield_blue.png buttons/shield_error.png buttons/shield_exclamation.png buttons/shield_green.png diff --git a/src/model_preferences.cpp b/src/model_preferences.cpp index 152eeef..b324a4d 100644 --- a/src/model_preferences.cpp +++ b/src/model_preferences.cpp @@ -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(); } diff --git a/src/model_preferences.h b/src/model_preferences.h index 9702ae5..9be246d 100644 --- a/src/model_preferences.h +++ b/src/model_preferences.h @@ -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; }; diff --git a/src/model_recently.cpp b/src/model_recently.cpp index e42468f..0bee02b 100644 --- a/src/model_recently.cpp +++ b/src/model_recently.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #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!"); + } } diff --git a/src/model_recently.h b/src/model_recently.h index 18b8be2..d367bc5 100644 --- a/src/model_recently.h +++ b/src/model_recently.h @@ -39,6 +39,7 @@ class RecentlyUsed { public: RecentlyUsed(void); + ~RecentlyUsed(void); static void initRecentlyUsed(RecentlyUsed *recentlyUsed); static void loadRecentlyUsed(RecentlyUsed *recentlyUsed); @@ -47,15 +48,18 @@ public: //Getter QString sourceDirectory(void) { return m_sourceDirectory; } QString outputDirectory(void) { return m_outputDirectory; } - int filterIndex(void) { return m_filterIndex; } + 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 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; }; diff --git a/src/version.h b/src/version.h index 7e9d442..88f9d32 100644 --- a/src/version.h +++ b/src/version.h @@ -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 diff --git a/src/win_main.cpp b/src/win_main.cpp index 60dfd8d..a4ad732 100644 --- a/src/win_main.cpp +++ b/src/win_main.cpp @@ -56,7 +56,7 @@ #include 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 = ""; #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("%1

").arg(tr("Your version of Simple x264 Launcher is more than 6 months old!").replace("-", "−")); + text += QString("%1
%2

").arg(tr("You can download the most recent version from the official web-site now:").replace("-", "−"), QString::fromLatin1(update_url)); + text += QString("
%1
").arg(tr("Alternatively, click 'Check for Updates' to run the auto-update utility.").replace("-", "−")); 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("Your version of 'Simple x264 Launcher' is more than 6 months old!

Please download the most recent version from the official web-site at:
%1
").replace("-", "−").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("%1").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(); } diff --git a/src/win_preferences.cpp b/src/win_preferences.cpp index 20d024e..a000eba 100644 --- a/src/win_preferences.cpp +++ b/src/win_preferences.cpp @@ -30,7 +30,7 @@ #include #include -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); @@ -112,14 +117,23 @@ void PreferencesDialog::showEvent(QShowEvent *event) bool PreferencesDialog::eventFilter(QObject *o, QEvent *e) { - emulateMouseEvent(o, e, ui->labelRunNextJob, ui->checkRunNextJob); - emulateMouseEvent(o, e, ui->labelShutdownComputer, ui->checkShutdownComputer); - emulateMouseEvent(o, e, ui->labelUse10BitEncoding, ui->checkUse10BitEncoding); - emulateMouseEvent(o, e, ui->labelUse64BitAvs2YUV, ui->checkUse64BitAvs2YUV); - emulateMouseEvent(o, e, ui->labelSaveLogFiles, ui->checkSaveLogFiles); - emulateMouseEvent(o, e, ui->labelSaveToSourceFolder, ui->checkSaveToSourceFolder); - emulateMouseEvent(o, e, ui->labelEnableSounds, ui->checkEnableSounds); - emulateMouseEvent(o, e, ui->labelDisableWarnings, ui->checkDisableWarnings); + 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); + emulateMouseEvent(o, e, ui->labelUse10BitEncoding, ui->checkUse10BitEncoding); + emulateMouseEvent(o, e, ui->labelUse64BitAvs2YUV, ui->checkUse64BitAvs2YUV); + emulateMouseEvent(o, e, ui->labelSaveLogFiles, ui->checkSaveLogFiles); + 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; } @@ -127,18 +141,15 @@ void PreferencesDialog::emulateMouseEvent(QObject *object, QEvent *event, QWidge { if(object == source) { - if((event->type() == QEvent::MouseButtonPress) || (event->type() == QEvent::MouseButtonRelease)) + if(QMouseEvent *mouseEvent = dynamic_cast(event)) { - if(QMouseEvent *mouseEvent = dynamic_cast(event)) - { - qApp->postEvent(target, new QMouseEvent - ( - event->type(), - qApp->widgetAt(mouseEvent->globalPos()) == source ? QPoint(1, 1) : QPoint(INT_MAX, INT_MAX), - Qt::LeftButton, - 0, 0 - )); - } + qApp->postEvent(target, new QMouseEvent + ( + event->type(), + (qApp->widgetAt(mouseEvent->globalPos()) == source) ? QPoint(1, 1) : QPoint(INT_MAX, INT_MAX), + Qt::LeftButton, + 0, 0 + )); } } } @@ -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); diff --git a/src/win_preferences.h b/src/win_preferences.h index 17dcd68..692dd7b 100644 --- a/src/win_preferences.h +++ b/src/win_preferences.h @@ -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; diff --git a/src/win_updater.cpp b/src/win_updater.cpp index e9f1c32..caca516 100644 --- a/src/win_updater.cpp +++ b/src/win_updater.cpp @@ -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("%1").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); } } diff --git a/src/win_updater.h b/src/win_updater.h index fb516a9..ef9c600 100644 --- a/src/win_updater.h +++ b/src/win_updater.h @@ -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; diff --git a/x264_launcher_MSVC2013.vcxproj b/x264_launcher_MSVC2013.vcxproj index 1bc44fe..1145087 100644 --- a/x264_launcher_MSVC2013.vcxproj +++ b/x264_launcher_MSVC2013.vcxproj @@ -97,7 +97,7 @@ copy /Y "$(SolutionDir)etc\vld\bin\Win32\*.manifest" "$(TargetDir)" Copy Toolset - "$(SolutionDir)etc\auto_inc.exe" VER_X264_BUILD "$(SolutionDir)src\version.h" 5 + "$(SolutionDir)etc\auto_inc.exe" VER_X264_BUILD "$(SolutionDir)src\version.h" 30 Update Build Number @@ -135,7 +135,7 @@ copy /Y "$(SolutionDir)etc\vld\bin\Win32\*.manifest" "$(TargetDir)" x264_entry_point - "$(SolutionDir)etc\auto_inc.exe" VER_X264_BUILD "$(SolutionDir)src\version.h" 5 + "$(SolutionDir)etc\auto_inc.exe" VER_X264_BUILD "$(SolutionDir)src\version.h" 30 Update Build Number