#include <ctime>
-const char *home_url = "http://muldersoft.com/";
-const char *update_url = "https://github.com/lordmulder/Simple-x264-Launcher/releases/latest";
-const char *tpl_last = "<LAST_USED>";
+static const char *home_url = "http://muldersoft.com/";
+static const char *update_url = "https://github.com/lordmulder/Simple-x264-Launcher/releases/latest";
+static 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)
#define SET_TEXT_COLOR(WIDGET,COLOR) do { QPalette _palette = WIDGET->palette(); _palette.setColor(QPalette::WindowText, (COLOR)); _palette.setColor(QPalette::Text, (COLOR)); WIDGET->setPalette(_palette); } while(0)
if((status == JobStatus_Completed) || (status == JobStatus_Failed))
{
if(m_preferences->getAutoRunNextJob()) QTimer::singleShot(0, this, SLOT(launchNextJob()));
- if(m_preferences->getShutdownComputer()) QTimer::singleShot(0, this, SLOT(shutdownComputer()));
if(m_preferences->getSaveLogFiles()) saveLogFile(m_jobList->index(i, 1, QModelIndex()));
}
}
*/
void MainWindow::launchNextJob(void)
{
- qDebug("launchNextJob(void)");
-
- const int rows = m_jobList->rowCount(QModelIndex());
+ qDebug("Launching next job...");
if(countRunningJobs() >= m_preferences->getMaxRunningJobCount())
{
return;
}
- int startIdx= ui->jobsView->currentIndex().isValid() ? qBound(0, ui->jobsView->currentIndex().row(), rows-1) : 0;
+ const int rows = m_jobList->rowCount(QModelIndex());
for(int i = 0; i < rows; i++)
{
- int currentIdx = (i + startIdx) % rows;
- JobStatus status = m_jobList->getJobStatus(m_jobList->index(currentIdx, 0, QModelIndex()));
- if(status == JobStatus_Enqueued)
+ const QModelIndex currentIndex = m_jobList->index(i, 0, QModelIndex());
+ if(m_jobList->getJobStatus(currentIndex) == JobStatus_Enqueued)
{
- if(m_jobList->startJob(m_jobList->index(currentIdx, 0, QModelIndex())))
+ if(m_jobList->startJob(currentIndex))
{
- ui->jobsView->selectRow(currentIdx);
+ ui->jobsView->selectRow(currentIndex.row());
return;
}
}
}
- qWarning("No enqueued jobs left!");
+ qWarning("No enqueued jobs left to be started!");
+
+ if(m_preferences->getShutdownComputer())
+ {
+ QTimer::singleShot(0, this, SLOT(shutdownComputer()));
+ }
}
/*
{
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("-", "−"));
- 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("-", "−"), QString::fromLatin1(update_url));
+ text += QString("<nobr><tt>%1<br><a href=\"%2\">%3</a><br><br>").arg(tr("You can download the most recent version from the official web-site now:").replace("-", "−"), QString::fromLatin1(update_url), QString::fromLatin1(update_url).replace("-", "−"));
text += QString("<nobr><tt>%1</tt></nobr><br>").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));
}
}
+/*
+ * Handle incoming IPC command
+ */
void MainWindow::handleCommand(const int &command, const QStringList &args, const quint32 &flags)
{
if((m_status != STATUS_IDLE) && (m_status != STATUS_AWAITING))
}
}
+/*
+ * Check for new updates
+ */
void MainWindow::checkUpdates(void)
{
ENSURE_APP_IS_IDLE();
return;
}
- UpdaterDialog *updater = new UpdaterDialog(this, m_sysinfo);
+ UpdaterDialog *updater = new UpdaterDialog(this, m_sysinfo, update_url);
const int ret = updater->exec();
if(updater->getSuccess())
}
}
+/*
+ * Handle mouse event for version label
+ */
void MainWindow::versionLabelMouseClicked(const int &tag)
{
if(tag == 0)
}
}
+/*
+ * Handle key event for job list
+ */
void MainWindow::jobListKeyPressed(const int &tag)
{
switch(tag)
// Constructor & Destructor
///////////////////////////////////////////////////////////////////////////////
-UpdaterDialog::UpdaterDialog(QWidget *parent, const SysinfoModel *sysinfo)
+UpdaterDialog::UpdaterDialog(QWidget *parent, const SysinfoModel *sysinfo, const char *const updateUrl)
:
QDialog(parent),
ui(new Ui::UpdaterDialog()),
m_sysinfo(sysinfo),
+ m_updateUrl(updateUrl),
m_status(UpdateCheckThread::UpdateStatus_NotStartedYet),
m_thread(NULL),
m_updaterProcess(NULL),
if(!checkBinaries(wgetBin, gpgvBin))
{
ui->buttonCancel->setEnabled(true);
- QMessageBox::critical(this, tr("File Error"), tr("At least one file required by web-update is missing or corrupted.<br>Please re-install this application and then try again!"));
+ const QString message = QString("%1<br><br><nobr><a href=\"%2\">%3</a></nobr><br>").arg(tr("At least one file required by the web-update tool is missing or corrupted.<br>Please re-install this application and then try again!"), QString::fromLatin1(m_updateUrl), QString::fromLatin1(m_updateUrl).replace("-", "−"));
+ if(QMessageBox::critical(this, tr("File Error"), message, tr("Download Latest Version"), tr("Discard")) == 0)
+ {
+ QDesktopServices::openUrl(QUrl(QString::fromLatin1(m_updateUrl)));
+ }
close(); return;
}
}
FILE_INFO[] =
{
- { "wget.exe", "7b522345239bcb95b5b0f7f50a883ba5957894a1feb769763e38ed789a8a0f63fead0155f54b9ffd0f1cdc5dfd855d207a6e7a8e4fd192589a8838ce646c504e" },
+ { "wget.exe", "17b522345239bcb95b5b0f7f50a883ba5957894a1feb769763e38ed789a8a0f63fead0155f54b9ffd0f1cdc5dfd855d207a6e7a8e4fd192589a8838ce646c504e" },
{ "gpgv.exe", "b42b7ef5650cd78d92773f03d4eefc90d9ba6ffe6af19d389851e32b5ab1c58c91c3dfceb2cbe0d0d13774ee2cf100c20f0add7f33463229999da5aaa861f064" },
{ "gpgv.gpg", "58e0f0e462bbd0b5aa4f638801c1097da7da4b3eb38c8c88ad1db23705c0f11e174b083fa55fe76bd3ba196341c967833a6f3427d6f63ad8565900745535d8fa" },
{ "wupd.exe", "e8ee5fb11e4964c0091311a41b46e2ea49cf675755ee830c38a26027c81aecc78842c25facc0ac6b797586e4c4b22ac116dd1735b0b11b67c13e4a17fb1e5f5e" },