Moved binaries checking code into a separate thread + show spinner while application is initializing.
This commit is contained in:
parent
37dced8e15
commit
fa29d4ba11
BIN
res/images/spinner.gif
Normal file
BIN
res/images/spinner.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
@ -57,6 +57,7 @@
|
||||
<file>images/loading.gif</file>
|
||||
<file>images/movie.png</file>
|
||||
<file>images/python.png</file>
|
||||
<file>images/spinner.gif</file>
|
||||
<file>images/update.png</file>
|
||||
<file>images/update_wizard.png</file>
|
||||
<file>images/x264.png</file>
|
||||
|
193
src/thread_binaries.cpp
Normal file
193
src/thread_binaries.cpp
Normal file
@ -0,0 +1,193 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Simple x264 Launcher
|
||||
// Copyright (C) 2004-2015 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
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "thread_binaries.h"
|
||||
|
||||
#include <QLibrary>
|
||||
#include <QEventLoop>
|
||||
#include <QTimer>
|
||||
#include <QMutexLocker>
|
||||
#include <QApplication>
|
||||
#include <QProcess>
|
||||
#include <QDir>
|
||||
|
||||
//Internal
|
||||
#include "global.h"
|
||||
#include "model_sysinfo.h"
|
||||
#include "win_updater.h"
|
||||
#include "binaries.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
#include <MUtils/OSSupport.h>
|
||||
|
||||
//Static
|
||||
QMutex BinariesCheckThread::m_binLock;
|
||||
QScopedPointer<QFile> BinariesCheckThread::m_binPath[MAX_BINARIES];
|
||||
|
||||
//Whatever
|
||||
#define NEXT(X) ((*reinterpret_cast<int*>(&(X)))++)
|
||||
|
||||
//-------------------------------------
|
||||
// External API
|
||||
//-------------------------------------
|
||||
|
||||
bool BinariesCheckThread::check(SysinfoModel *sysinfo)
|
||||
{
|
||||
QMutexLocker lock(&m_binLock);
|
||||
|
||||
QEventLoop loop;
|
||||
BinariesCheckThread thread(sysinfo);
|
||||
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
|
||||
connect(&thread, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||
connect(&thread, SIGNAL(terminated()), &loop, SLOT(quit()));
|
||||
|
||||
thread.start();
|
||||
QTimer::singleShot(30000, &loop, SLOT(quit()));
|
||||
|
||||
qDebug("Binaries checker thread has been created, please wait...");
|
||||
loop.exec(QEventLoop::ExcludeUserInputEvents);
|
||||
qDebug("Binaries checker thread finished.");
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
if(!thread.wait(1000))
|
||||
{
|
||||
qWarning("Binaries checker thread encountered timeout -> probably deadlock!");
|
||||
thread.terminate();
|
||||
thread.wait();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(thread.getException())
|
||||
{
|
||||
qWarning("Binaries checker thread encountered an exception !!!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return thread.getSuccess();
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
// Thread class
|
||||
//-------------------------------------
|
||||
|
||||
BinariesCheckThread::BinariesCheckThread(const SysinfoModel *const sysinfo)
|
||||
:
|
||||
m_sysinfo(sysinfo)
|
||||
{
|
||||
m_success = m_exception = false;
|
||||
}
|
||||
|
||||
BinariesCheckThread::~BinariesCheckThread(void)
|
||||
{
|
||||
}
|
||||
|
||||
void BinariesCheckThread::run(void)
|
||||
{
|
||||
m_success = m_exception = false;
|
||||
checkBinaries1(m_success, m_sysinfo, &m_exception);
|
||||
}
|
||||
|
||||
void BinariesCheckThread::checkBinaries1(volatile bool &success, const SysinfoModel *const sysinfo, volatile bool *exception)
|
||||
{
|
||||
__try
|
||||
{
|
||||
checkBinaries2(success, sysinfo, exception);
|
||||
}
|
||||
__except(1)
|
||||
{
|
||||
*exception = true;
|
||||
qWarning("Unhandled exception error in binaries checker thread !!!");
|
||||
}
|
||||
}
|
||||
|
||||
void BinariesCheckThread::checkBinaries2(volatile bool &success, const SysinfoModel *const sysinfo, volatile bool *exception)
|
||||
{
|
||||
try
|
||||
{
|
||||
return checkBinaries3(success, sysinfo);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
*exception = true;
|
||||
qWarning("Binaries checker initializdation raised an C++ exception!");
|
||||
}
|
||||
}
|
||||
|
||||
void BinariesCheckThread::checkBinaries3(volatile bool &success, const SysinfoModel *const sysinfo)
|
||||
{
|
||||
success = true;
|
||||
|
||||
//Create list of all required binary files
|
||||
QStringList binFiles;
|
||||
for(OptionsModel::EncArch arch = OptionsModel::EncArch_x32; arch <= OptionsModel::EncArch_x64; NEXT(arch))
|
||||
{
|
||||
for(OptionsModel::EncType encdr = OptionsModel::EncType_X264; encdr <= OptionsModel::EncType_X265; NEXT(encdr))
|
||||
{
|
||||
for(OptionsModel::EncVariant varnt = OptionsModel::EncVariant_LoBit; varnt <= OptionsModel::EncVariant_HiBit; NEXT(varnt))
|
||||
{
|
||||
binFiles << ENC_BINARY(sysinfo, encdr, arch, varnt);
|
||||
}
|
||||
}
|
||||
binFiles << AVS_BINARY(sysinfo, arch == OptionsModel::EncArch_x64);
|
||||
binFiles << CHK_BINARY(sysinfo, arch == OptionsModel::EncArch_x64);
|
||||
}
|
||||
for(size_t i = 0; UpdaterDialog::BINARIES[i].name; i++)
|
||||
{
|
||||
if(UpdaterDialog::BINARIES[i].exec)
|
||||
{
|
||||
binFiles << QString("%1/toolset/common/%2").arg(sysinfo->getAppPath(), QString::fromLatin1(UpdaterDialog::BINARIES[i].name));
|
||||
}
|
||||
}
|
||||
|
||||
//Actually validate the binaries
|
||||
size_t currentFile = 0;
|
||||
for(QStringList::ConstIterator iter = binFiles.constBegin(); iter != binFiles.constEnd(); iter++)
|
||||
{
|
||||
QScopedPointer<QFile> file(new QFile(*iter));
|
||||
qDebug("%s", MUTILS_UTF8(file->fileName()));
|
||||
|
||||
if(file->open(QIODevice::ReadOnly))
|
||||
{
|
||||
if(!MUtils::OS::is_executable_file(file->fileName()))
|
||||
{
|
||||
success = false;
|
||||
qWarning("Required tool does NOT seem to be a valid Win32/Win64 binary:\n%s\n", MUTILS_UTF8(file->fileName()));
|
||||
return;
|
||||
}
|
||||
if(currentFile < MAX_BINARIES)
|
||||
{
|
||||
m_binPath[currentFile++].reset(file.take());
|
||||
continue;
|
||||
}
|
||||
qFatal("Current binary file exceeds max. number of binaries!");
|
||||
}
|
||||
else
|
||||
{
|
||||
success = false;
|
||||
qWarning("Required tool could not be found or access denied:\n%s\n", MUTILS_UTF8(file->fileName()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
64
src/thread_binaries.h
Normal file
64
src/thread_binaries.h
Normal file
@ -0,0 +1,64 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Simple x264 Launcher
|
||||
// Copyright (C) 2004-2015 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 <QThread>
|
||||
#include <QMutex>
|
||||
|
||||
class QLibrary;
|
||||
class SysinfoModel;
|
||||
class QFile;
|
||||
|
||||
class BinariesCheckThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static bool check(SysinfoModel *sysinfo);
|
||||
|
||||
protected:
|
||||
BinariesCheckThread(const SysinfoModel *const sysinfo);
|
||||
~BinariesCheckThread(void);
|
||||
|
||||
int getSuccess(void) { return m_success; }
|
||||
bool getException(void) { return m_exception; }
|
||||
|
||||
private slots:
|
||||
void start(Priority priority = InheritPriority) { QThread::start(priority); }
|
||||
|
||||
private:
|
||||
volatile bool m_exception;
|
||||
volatile bool m_success;
|
||||
const SysinfoModel *const m_sysinfo;
|
||||
|
||||
static const size_t MAX_BINARIES = 16;
|
||||
static QMutex m_binLock;
|
||||
static QScopedPointer<QFile> m_binPath[MAX_BINARIES];
|
||||
|
||||
//Entry point
|
||||
virtual void run(void);
|
||||
|
||||
//Functions
|
||||
static void checkBinaries1(volatile bool &success, const SysinfoModel *const sysinfo, volatile bool *exception);
|
||||
static void checkBinaries2(volatile bool &success, const SysinfoModel *const sysinfo, volatile bool *exception);
|
||||
static void checkBinaries3(volatile bool &success, const SysinfoModel *const sysinfo);
|
||||
};
|
@ -26,7 +26,7 @@
|
||||
#define VER_X264_MAJOR 2
|
||||
#define VER_X264_MINOR 5
|
||||
#define VER_X264_PATCH 0
|
||||
#define VER_X264_BUILD 934
|
||||
#define VER_X264_BUILD 940
|
||||
|
||||
#define VER_X264_PORTABLE_EDITION (0)
|
||||
|
||||
|
145
src/win_main.cpp
145
src/win_main.cpp
@ -33,6 +33,7 @@
|
||||
#include "model_preferences.h"
|
||||
#include "model_recently.h"
|
||||
#include "thread_avisynth.h"
|
||||
#include "thread_binaries.h"
|
||||
#include "thread_vapoursynth.h"
|
||||
#include "thread_encode.h"
|
||||
#include "thread_ipc_recv.h"
|
||||
@ -70,6 +71,7 @@
|
||||
#include <QSettings>
|
||||
#include <QFileDialog>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QMovie>
|
||||
|
||||
#include <ctime>
|
||||
|
||||
@ -87,7 +89,6 @@ static const int vsynth_rev = 24;
|
||||
#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)
|
||||
#define LINK(URL) (QString("<a href=\"%1\">%1</a>").arg((URL)))
|
||||
#define INIT_ERROR_EXIT() do { close(); qApp->exit(-1); return; } while(0)
|
||||
#define NEXT(X) ((*reinterpret_cast<int*>(&(X)))++)
|
||||
#define SETUP_WEBLINK(OBJ, URL) do { (OBJ)->setData(QVariant(QUrl(URL))); connect((OBJ), SIGNAL(triggered()), this, SLOT(showWebLink())); } while(0)
|
||||
#define APP_IS_READY (m_initialized && (!m_fileTimer->isActive()) && (QApplication::activeModalWidget() == NULL))
|
||||
#define ENSURE_APP_IS_READY() do { if(!APP_IS_READY) { MUtils::Sound::beep(MUtils::Sound::BEEP_WRN); qWarning("Cannot perfrom this action at this time!"); return; } } while(0)
|
||||
@ -225,7 +226,7 @@ MainWindow::MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures, MUtil
|
||||
SETUP_WEBLINK(ui->actionWebAvisynthPlus, "http://www.avs-plus.net/");
|
||||
SETUP_WEBLINK(ui->actionWebVapourSynth, "http://www.vapoursynth.com/");
|
||||
SETUP_WEBLINK(ui->actionWebVapourSynthDocs, "http://www.vapoursynth.com/doc/");
|
||||
SETUP_WEBLINK(ui->actionOnlineDocX264, "http://mewiki.project357.com/wiki/X264_Settings");
|
||||
SETUP_WEBLINK(ui->actionOnlineDocX264, "http://en.wikibooks.org/wiki/MeGUI/x264_Settings"); //http://mewiki.project357.com/wiki/X264_Settings
|
||||
SETUP_WEBLINK(ui->actionOnlineDocX265, "http://x265.readthedocs.org/en/default/");
|
||||
SETUP_WEBLINK(ui->actionWebBluRay, "http://www.x264bluray.com/");
|
||||
SETUP_WEBLINK(ui->actionWebAvsWiki, "http://avisynth.nl/index.php/Main_Page#Usage");
|
||||
@ -233,14 +234,28 @@ MainWindow::MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures, MUtil
|
||||
SETUP_WEBLINK(ui->actionWebSecret, "http://www.youtube.com/watch_popup?v=AXIeHY-OYNI");
|
||||
|
||||
//Create floating label
|
||||
m_label.reset(new QLabel(ui->jobsView->viewport()));
|
||||
m_label->setText(tr("No job created yet. Please click the 'Add New Job' button!"));
|
||||
m_label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
SET_TEXT_COLOR(m_label, Qt::darkGray);
|
||||
SET_FONT_BOLD(m_label, true);
|
||||
m_label->setVisible(true);
|
||||
m_label->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
m_label->addActions(ui->jobsView->actions());
|
||||
m_label[0].reset(new QLabel(ui->jobsView->viewport()));
|
||||
m_label[1].reset(new QLabel(ui->logView->viewport()));
|
||||
if(!m_label[0].isNull())
|
||||
{
|
||||
m_label[0]->setText(tr("No job created yet. Please click the 'Add New Job' button!"));
|
||||
m_label[0]->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
SET_TEXT_COLOR(m_label[0], Qt::darkGray);
|
||||
SET_FONT_BOLD(m_label[0], true);
|
||||
m_label[0]->setVisible(true);
|
||||
m_label[0]->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
m_label[0]->addActions(ui->jobsView->actions());
|
||||
}
|
||||
if(!m_label[1].isNull())
|
||||
{
|
||||
m_animation.reset(new QMovie(":/images/spinner.gif"));
|
||||
m_label[1]->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
if(!m_animation.isNull())
|
||||
{
|
||||
m_label[1]->setMovie(m_animation.data());
|
||||
m_animation->start();
|
||||
}
|
||||
}
|
||||
connect(ui->splitter, SIGNAL(splitterMoved(int, int)), this, SLOT(updateLabelPos()));
|
||||
updateLabelPos();
|
||||
|
||||
@ -277,12 +292,6 @@ MainWindow::~MainWindow(void)
|
||||
{
|
||||
OptionsModel::saveTemplate(m_options.data(), QString::fromLatin1(tpl_last));
|
||||
|
||||
while(!m_toolsList->isEmpty())
|
||||
{
|
||||
QFile *temp = m_toolsList->takeFirst();
|
||||
MUTILS_DELETE(temp);
|
||||
}
|
||||
|
||||
if(!m_ipcThread.isNull())
|
||||
{
|
||||
m_ipcThread->stop();
|
||||
@ -374,7 +383,7 @@ void MainWindow::deleteButtonPressed(void)
|
||||
ENSURE_APP_IS_READY();
|
||||
|
||||
m_jobList->deleteJob(ui->jobsView->currentIndex());
|
||||
m_label->setVisible(m_jobList->rowCount(QModelIndex()) == 0);
|
||||
m_label[0]->setVisible(m_jobList->rowCount(QModelIndex()) == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -765,60 +774,17 @@ void MainWindow::init(void)
|
||||
|
||||
updateLabelPos();
|
||||
const MUtils::OS::ArgumentMap &arguments = MUtils::OS::arguments();
|
||||
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
|
||||
//---------------------------------------
|
||||
// Check required binaries
|
||||
//---------------------------------------
|
||||
|
||||
QStringList binFiles;
|
||||
for(OptionsModel::EncArch arch = OptionsModel::EncArch_x32; arch <= OptionsModel::EncArch_x64; NEXT(arch))
|
||||
{
|
||||
for(OptionsModel::EncType encdr = OptionsModel::EncType_X264; encdr <= OptionsModel::EncType_X265; NEXT(encdr))
|
||||
{
|
||||
for(OptionsModel::EncVariant varnt = OptionsModel::EncVariant_LoBit; varnt <= OptionsModel::EncVariant_HiBit; NEXT(varnt))
|
||||
{
|
||||
binFiles << ENC_BINARY(m_sysinfo.data(), encdr, arch, varnt);
|
||||
}
|
||||
}
|
||||
binFiles << AVS_BINARY(m_sysinfo.data(), arch == OptionsModel::EncArch_x64);
|
||||
binFiles << CHK_BINARY(m_sysinfo.data(), arch == OptionsModel::EncArch_x64);
|
||||
}
|
||||
for(size_t i = 0; UpdaterDialog::BINARIES[i].name; i++)
|
||||
{
|
||||
if(UpdaterDialog::BINARIES[i].exec)
|
||||
{
|
||||
binFiles << QString("%1/toolset/common/%2").arg(m_sysinfo->getAppPath(), QString::fromLatin1(UpdaterDialog::BINARIES[i].name));
|
||||
}
|
||||
}
|
||||
|
||||
qDebug("[Validating binaries]");
|
||||
for(QStringList::ConstIterator iter = binFiles.constBegin(); iter != binFiles.constEnd(); iter++)
|
||||
if(!BinariesCheckThread::check(m_sysinfo.data()))
|
||||
{
|
||||
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
QFile *file = new QFile(*iter);
|
||||
qDebug("%s", file->fileName().toLatin1().constData());
|
||||
if(file->open(QIODevice::ReadOnly))
|
||||
{
|
||||
if(!MUtils::OS::is_executable_file(file->fileName()))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Invalid File!"), tr("<nobr>At least on required tool is not a valid Win32 or Win64 binary:<br><tt style=\"whitespace:nowrap\">%1</tt><br><br>Please re-install the program in order to fix the problem!</nobr>").arg(QDir::toNativeSeparators(file->fileName())).replace("-", "−"));
|
||||
qFatal(QString("Binary is invalid: %1").arg(file->fileName()).toLatin1().constData());
|
||||
MUTILS_DELETE(file);
|
||||
INIT_ERROR_EXIT();
|
||||
}
|
||||
if(m_toolsList.isNull())
|
||||
{
|
||||
m_toolsList.reset(new QFileList());
|
||||
}
|
||||
m_toolsList->append(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, tr("File Not Found!"), tr("<nobr>At least on required tool could not be found:<br><tt style=\"whitespace:nowrap\">%1</tt><br><br>Please re-install the program in order to fix the problem!</nobr>").arg(QDir::toNativeSeparators(file->fileName())).replace("-", "−"));
|
||||
qFatal(QString("Binary not found: %1/toolset/%2").arg(m_sysinfo->getAppPath(), file->fileName()).toLatin1().constData());
|
||||
MUTILS_DELETE(file);
|
||||
INIT_ERROR_EXIT();
|
||||
}
|
||||
QMessageBox::critical(this, tr("Invalid File!"), tr("<nobr>At least on required tool is missing or is not a valid Win32/Win64 binary.<br>Please re-install the program in order to fix the problem!</nobr>").replace("-", "−"));
|
||||
qFatal("At least on required tool is missing or is not a valid Win32/Win64 binary!");
|
||||
}
|
||||
qDebug(" ");
|
||||
|
||||
@ -851,6 +817,8 @@ void MainWindow::init(void)
|
||||
if(rnd != val) INIT_ERROR_EXIT();
|
||||
}
|
||||
|
||||
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
|
||||
//---------------------------------------
|
||||
// Check CPU capabilities
|
||||
//---------------------------------------
|
||||
@ -883,6 +851,8 @@ void MainWindow::init(void)
|
||||
m_preferences->setAbortOnTimeout(false);
|
||||
}
|
||||
|
||||
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
|
||||
//---------------------------------------
|
||||
// Check Avisynth support
|
||||
//---------------------------------------
|
||||
@ -942,6 +912,17 @@ void MainWindow::init(void)
|
||||
qDebug(" ");
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
// Create the IPC listener thread
|
||||
//---------------------------------------
|
||||
|
||||
if(m_ipcChannel)
|
||||
{
|
||||
m_ipcThread.reset(new IPCThread_Recv(m_ipcChannel));
|
||||
connect(m_ipcThread.data(), SIGNAL(receivedCommand(int,QStringList,quint32)), this, SLOT(handleCommand(int,QStringList,quint32)), Qt::QueuedConnection);
|
||||
m_ipcThread->start();
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
// Finish initialization
|
||||
//---------------------------------------
|
||||
@ -955,6 +936,16 @@ void MainWindow::init(void)
|
||||
//Update flag
|
||||
m_initialized = true;
|
||||
|
||||
//Hide the spinner animation
|
||||
if(!m_label[1].isNull())
|
||||
{
|
||||
if(!m_animation.isNull())
|
||||
{
|
||||
m_animation->stop();
|
||||
}
|
||||
m_label[1]->setVisible(false);
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
// Check for Expiration
|
||||
//---------------------------------------
|
||||
@ -1007,21 +998,10 @@ void MainWindow::init(void)
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
// Create the IPC listener thread
|
||||
//---------------------------------------
|
||||
|
||||
if(m_ipcChannel)
|
||||
{
|
||||
m_ipcThread.reset(new IPCThread_Recv(m_ipcChannel));
|
||||
connect(m_ipcThread.data(), SIGNAL(receivedCommand(int,QStringList,quint32)), this, SLOT(handleCommand(int,QStringList,quint32)), Qt::QueuedConnection);
|
||||
m_ipcThread->start();
|
||||
}
|
||||
|
||||
//Load queued jobs
|
||||
if(m_jobList->loadQueuedJobs(m_sysinfo.data()) > 0)
|
||||
{
|
||||
m_label->setVisible(m_jobList->rowCount(QModelIndex()) == 0);
|
||||
m_label[0]->setVisible(m_jobList->rowCount(QModelIndex()) == 0);
|
||||
m_jobList->clearQueuedJobs();
|
||||
}
|
||||
}
|
||||
@ -1031,8 +1011,15 @@ void MainWindow::init(void)
|
||||
*/
|
||||
void MainWindow::updateLabelPos(void)
|
||||
{
|
||||
const QWidget *const viewPort = ui->jobsView->viewport();
|
||||
m_label->setGeometry(0, 0, viewPort->width(), viewPort->height());
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
//const QWidget *const viewPort = ui->jobsView->viewport();
|
||||
const QWidget *const viewPort = dynamic_cast<QWidget*>(m_label[i]->parent());
|
||||
if(viewPort)
|
||||
{
|
||||
m_label[i]->setGeometry(0, 0, viewPort->width(), viewPort->height());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1467,7 +1454,7 @@ bool MainWindow::appendJob(const QString &sourceFileName, const QString &outputF
|
||||
okay = true;
|
||||
}
|
||||
|
||||
m_label->setVisible(m_jobList->rowCount(QModelIndex()) == 0);
|
||||
m_label[0]->setVisible(m_jobList->rowCount(QModelIndex()) == 0);
|
||||
return okay;
|
||||
}
|
||||
|
||||
|
@ -66,8 +66,6 @@ public:
|
||||
MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures, MUtils::IPCChannel *const ipcChannel);
|
||||
~MainWindow(void);
|
||||
|
||||
typedef QList<QFile*> QFileList;
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent *e);
|
||||
virtual void showEvent(QShowEvent *e);
|
||||
@ -80,7 +78,8 @@ private:
|
||||
MUtils::IPCChannel *const m_ipcChannel;
|
||||
|
||||
bool m_initialized;
|
||||
QScopedPointer<QLabel> m_label;
|
||||
QScopedPointer<QLabel> m_label[2];
|
||||
QScopedPointer<QMovie> m_animation;
|
||||
QScopedPointer<QTimer> m_fileTimer;
|
||||
|
||||
QScopedPointer<IPCThread_Recv> m_ipcThread;
|
||||
@ -94,7 +93,6 @@ private:
|
||||
QScopedPointer<JobListModel> m_jobList;
|
||||
QScopedPointer<OptionsModel> m_options;
|
||||
QScopedPointer<QStringList> m_pendingFiles;
|
||||
QScopedPointer<QFileList> m_toolsList;
|
||||
|
||||
QScopedPointer<SysinfoModel> m_sysinfo;
|
||||
QScopedPointer<PreferencesModel> m_preferences;
|
||||
|
@ -274,6 +274,14 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="src\thread_binaries.h">
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp" "%(FullPath)"</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp" "%(FullPath)"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp"</Message>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp"</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\$(ProjectName)\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<ClInclude Include="tmp\x264_launcher\UIC_win_about.h" />
|
||||
<ClInclude Include="tmp\x264_launcher\UIC_win_addJob.h" />
|
||||
<ClInclude Include="tmp\x264_launcher\UIC_win_editor.h" />
|
||||
@ -432,6 +440,7 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
|
||||
<ClCompile Include="src\source_avisynth.cpp" />
|
||||
<ClCompile Include="src\source_vapoursynth.cpp" />
|
||||
<ClCompile Include="src\thread_avisynth.cpp" />
|
||||
<ClCompile Include="src\thread_binaries.cpp" />
|
||||
<ClCompile Include="src\thread_encode.cpp" />
|
||||
<ClCompile Include="src\global.cpp" />
|
||||
<ClCompile Include="src\main.cpp" />
|
||||
@ -451,6 +460,7 @@ copy /Y "$(QTDIR)\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
|
||||
<ClCompile Include="tmp\x264_launcher\MOC_model_jobList.cpp" />
|
||||
<ClCompile Include="tmp\x264_launcher\MOC_model_logFile.cpp" />
|
||||
<ClCompile Include="tmp\x264_launcher\MOC_thread_avisynth.cpp" />
|
||||
<ClCompile Include="tmp\x264_launcher\MOC_thread_binaries.cpp" />
|
||||
<ClCompile Include="tmp\x264_launcher\MOC_thread_encode.cpp" />
|
||||
<ClCompile Include="tmp\x264_launcher\MOC_thread_ipc_recv.cpp" />
|
||||
<ClCompile Include="tmp\x264_launcher\MOC_thread_ipc_send.cpp" />
|
||||
|
@ -111,6 +111,9 @@
|
||||
<ClInclude Include="tmp\x264_launcher\UIC_win_updater.h">
|
||||
<Filter>Generated Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\thread_binaries.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\main.cpp">
|
||||
@ -260,6 +263,12 @@
|
||||
<ClCompile Include="tmp\x264_launcher\MOC_thread_vapoursynth.cpp">
|
||||
<Filter>Generated Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\thread_binaries.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tmp\x264_launcher\MOC_thread_binaries.cpp">
|
||||
<Filter>Generated Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="src\win_main.h">
|
||||
|
Loading…
Reference in New Issue
Block a user