Switched the method of how the Designer UI file is used in the ProcessingDialog class to "The Single Inheritance Approach" (with "Using a Pointer Member Variable"). This is the method which Qt recommends for large projects.
This commit is contained in:
parent
7077650bb6
commit
fb00b2b11e
@ -21,6 +21,9 @@
|
|||||||
|
|
||||||
#include "Dialog_Processing.h"
|
#include "Dialog_Processing.h"
|
||||||
|
|
||||||
|
//UIC includes
|
||||||
|
#include "../tmp/UIC_ProcessingDialog.h"
|
||||||
|
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "Resource.h"
|
#include "Resource.h"
|
||||||
#include "Model_FileList.h"
|
#include "Model_FileList.h"
|
||||||
@ -90,7 +93,7 @@ while(0)
|
|||||||
|
|
||||||
#define SET_PROGRESS_TEXT(TXT) do \
|
#define SET_PROGRESS_TEXT(TXT) do \
|
||||||
{ \
|
{ \
|
||||||
label_progress->setText(TXT); \
|
ui->label_progress->setText(TXT); \
|
||||||
m_systemTray->setToolTip(QString().sprintf("LameXP v%d.%02d\n%ls", lamexp_version_major(), lamexp_version_minor(), QString(TXT).utf16())); \
|
m_systemTray->setToolTip(QString().sprintf("LameXP v%d.%02d\n%ls", lamexp_version_major(), lamexp_version_minor(), QString(TXT).utf16())); \
|
||||||
} \
|
} \
|
||||||
while(0)
|
while(0)
|
||||||
@ -137,6 +140,7 @@ private:
|
|||||||
ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel *metaInfo, SettingsModel *settings, QWidget *parent)
|
ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel *metaInfo, SettingsModel *settings, QWidget *parent)
|
||||||
:
|
:
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
|
ui(new Ui::ProcessingDialog),
|
||||||
m_systemTray(new QSystemTrayIcon(QIcon(":/icons/cd_go.png"), this)),
|
m_systemTray(new QSystemTrayIcon(QIcon(":/icons/cd_go.png"), this)),
|
||||||
m_settings(settings),
|
m_settings(settings),
|
||||||
m_metaInfo(metaInfo),
|
m_metaInfo(metaInfo),
|
||||||
@ -148,15 +152,15 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel
|
|||||||
m_firstShow(true)
|
m_firstShow(true)
|
||||||
{
|
{
|
||||||
//Init the dialog, from the .ui file
|
//Init the dialog, from the .ui file
|
||||||
setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
|
setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
|
||||||
|
|
||||||
//Update header icon
|
//Update header icon
|
||||||
label_headerIcon->setPixmap(lamexp_app_icon().pixmap(label_headerIcon->size()));
|
ui->label_headerIcon->setPixmap(lamexp_app_icon().pixmap(ui->label_headerIcon->size()));
|
||||||
|
|
||||||
//Setup version info
|
//Setup version info
|
||||||
label_versionInfo->setText(QString().sprintf("v%d.%02d %s (Build %d)", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build()));
|
ui->label_versionInfo->setText(QString().sprintf("v%d.%02d %s (Build %d)", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build()));
|
||||||
label_versionInfo->installEventFilter(this);
|
ui->label_versionInfo->installEventFilter(this);
|
||||||
|
|
||||||
//Register meta type
|
//Register meta type
|
||||||
qRegisterMetaType<QUuid>("QUuid");
|
qRegisterMetaType<QUuid>("QUuid");
|
||||||
@ -168,29 +172,29 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel
|
|||||||
setMinimumSize(thisRect.width(), thisRect.height());
|
setMinimumSize(thisRect.width(), thisRect.height());
|
||||||
|
|
||||||
//Enable buttons
|
//Enable buttons
|
||||||
connect(button_AbortProcess, SIGNAL(clicked()), this, SLOT(abortEncoding()));
|
connect(ui->button_AbortProcess, SIGNAL(clicked()), this, SLOT(abortEncoding()));
|
||||||
|
|
||||||
//Init progress indicator
|
//Init progress indicator
|
||||||
m_progressIndicator = new QMovie(":/images/Working.gif");
|
m_progressIndicator = new QMovie(":/images/Working.gif");
|
||||||
m_progressIndicator->setCacheMode(QMovie::CacheAll);
|
m_progressIndicator->setCacheMode(QMovie::CacheAll);
|
||||||
m_progressIndicator->setSpeed(50);
|
m_progressIndicator->setSpeed(50);
|
||||||
label_headerWorking->setMovie(m_progressIndicator);
|
ui->label_headerWorking->setMovie(m_progressIndicator);
|
||||||
progressBar->setValue(0);
|
ui->progressBar->setValue(0);
|
||||||
|
|
||||||
//Init progress model
|
//Init progress model
|
||||||
m_progressModel = new ProgressModel();
|
m_progressModel = new ProgressModel();
|
||||||
view_log->setModel(m_progressModel);
|
ui->view_log->setModel(m_progressModel);
|
||||||
view_log->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
ui->view_log->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
view_log->verticalHeader()->hide();
|
ui->view_log->verticalHeader()->hide();
|
||||||
view_log->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
ui->view_log->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
view_log->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
|
ui->view_log->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
|
||||||
view_log->viewport()->installEventFilter(this);
|
ui->view_log->viewport()->installEventFilter(this);
|
||||||
connect(m_progressModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(progressModelChanged()));
|
connect(m_progressModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(progressModelChanged()));
|
||||||
connect(m_progressModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), this, SLOT(progressModelChanged()));
|
connect(m_progressModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), this, SLOT(progressModelChanged()));
|
||||||
connect(m_progressModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(progressModelChanged()));
|
connect(m_progressModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(progressModelChanged()));
|
||||||
connect(m_progressModel, SIGNAL(modelReset()), this, SLOT(progressModelChanged()));
|
connect(m_progressModel, SIGNAL(modelReset()), this, SLOT(progressModelChanged()));
|
||||||
connect(view_log, SIGNAL(activated(QModelIndex)), this, SLOT(logViewDoubleClicked(QModelIndex)));
|
connect(ui->view_log, SIGNAL(activated(QModelIndex)), this, SLOT(logViewDoubleClicked(QModelIndex)));
|
||||||
connect(view_log->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(logViewSectionSizeChanged(int,int,int)));
|
connect(ui->view_log->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(logViewSectionSizeChanged(int,int,int)));
|
||||||
|
|
||||||
//Create context menu
|
//Create context menu
|
||||||
m_contextMenu = new QMenu();
|
m_contextMenu = new QMenu();
|
||||||
@ -216,7 +220,7 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Create info label
|
//Create info label
|
||||||
if(m_filterInfoLabel = new QLabel(view_log))
|
if(m_filterInfoLabel = new QLabel(ui->view_log))
|
||||||
{
|
{
|
||||||
m_filterInfoLabel->setFrameShape(QFrame::NoFrame);
|
m_filterInfoLabel->setFrameShape(QFrame::NoFrame);
|
||||||
m_filterInfoLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
m_filterInfoLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
@ -227,7 +231,7 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel
|
|||||||
connect(m_filterInfoLabel, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
|
connect(m_filterInfoLabel, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
|
||||||
m_filterInfoLabel->hide();
|
m_filterInfoLabel->hide();
|
||||||
}
|
}
|
||||||
if(m_filterInfoLabelIcon = new QLabel(view_log))
|
if(m_filterInfoLabelIcon = new QLabel(ui->view_log))
|
||||||
{
|
{
|
||||||
m_filterInfoLabelIcon->setFrameShape(QFrame::NoFrame);
|
m_filterInfoLabelIcon->setFrameShape(QFrame::NoFrame);
|
||||||
m_filterInfoLabelIcon->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
|
m_filterInfoLabelIcon->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
|
||||||
@ -239,8 +243,8 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Connect context menu
|
//Connect context menu
|
||||||
view_log->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->view_log->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(view_log, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
|
connect(ui->view_log, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
|
||||||
connect(contextMenuDetailsAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuDetailsActionTriggered()));
|
connect(contextMenuDetailsAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuDetailsActionTriggered()));
|
||||||
connect(contextMenuShowFileAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuShowFileActionTriggered()));
|
connect(contextMenuShowFileAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuShowFileActionTriggered()));
|
||||||
for(size_t i = 0; i < 5; i++)
|
for(size_t i = 0; i < 5; i++)
|
||||||
@ -259,7 +263,7 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Translate
|
//Translate
|
||||||
label_headerStatus->setText(QString("<b>%1</b><br>%2").arg(tr("Encoding Files"), tr("Your files are being encoded, please be patient...")));
|
ui->label_headerStatus->setText(QString("<b>%1</b><br>%2").arg(tr("Encoding Files"), tr("Your files are being encoded, please be patient...")));
|
||||||
|
|
||||||
//Enable system tray icon
|
//Enable system tray icon
|
||||||
connect(m_systemTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(systemTrayActivated(QSystemTrayIcon::ActivationReason)));
|
connect(m_systemTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(systemTrayActivated(QSystemTrayIcon::ActivationReason)));
|
||||||
@ -282,7 +286,7 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel
|
|||||||
|
|
||||||
ProcessingDialog::~ProcessingDialog(void)
|
ProcessingDialog::~ProcessingDialog(void)
|
||||||
{
|
{
|
||||||
view_log->setModel(NULL);
|
ui->view_log->setModel(NULL);
|
||||||
|
|
||||||
if(m_progressIndicator)
|
if(m_progressIndicator)
|
||||||
{
|
{
|
||||||
@ -338,6 +342,8 @@ ProcessingDialog::~ProcessingDialog(void)
|
|||||||
|
|
||||||
WinSevenTaskbar::setOverlayIcon(this, NULL);
|
WinSevenTaskbar::setOverlayIcon(this, NULL);
|
||||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNoState);
|
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNoState);
|
||||||
|
|
||||||
|
LAMEXP_DELETE(ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -353,8 +359,8 @@ void ProcessingDialog::showEvent(QShowEvent *event)
|
|||||||
static const char *NA = " N/A";
|
static const char *NA = " N/A";
|
||||||
|
|
||||||
setCloseButtonEnabled(false);
|
setCloseButtonEnabled(false);
|
||||||
button_closeDialog->setEnabled(false);
|
ui->button_closeDialog->setEnabled(false);
|
||||||
button_AbortProcess->setEnabled(false);
|
ui->button_AbortProcess->setEnabled(false);
|
||||||
m_systemTray->setVisible(true);
|
m_systemTray->setVisible(true);
|
||||||
|
|
||||||
if(!SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS))
|
if(!SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS))
|
||||||
@ -362,9 +368,9 @@ void ProcessingDialog::showEvent(QShowEvent *event)
|
|||||||
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
|
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
|
||||||
}
|
}
|
||||||
|
|
||||||
label_cpu->setText(NA);
|
ui->label_cpu->setText(NA);
|
||||||
label_disk->setText(NA);
|
ui->label_disk->setText(NA);
|
||||||
label_ram->setText(NA);
|
ui->label_ram->setText(NA);
|
||||||
|
|
||||||
QTimer::singleShot(1000, this, SLOT(initEncoding()));
|
QTimer::singleShot(1000, this, SLOT(initEncoding()));
|
||||||
m_firstShow = false;
|
m_firstShow = false;
|
||||||
@ -376,7 +382,7 @@ void ProcessingDialog::showEvent(QShowEvent *event)
|
|||||||
|
|
||||||
void ProcessingDialog::closeEvent(QCloseEvent *event)
|
void ProcessingDialog::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
if(!button_closeDialog->isEnabled())
|
if(!ui->button_closeDialog->isEnabled())
|
||||||
{
|
{
|
||||||
event->ignore();
|
event->ignore();
|
||||||
}
|
}
|
||||||
@ -390,20 +396,20 @@ bool ProcessingDialog::eventFilter(QObject *obj, QEvent *event)
|
|||||||
{
|
{
|
||||||
static QColor defaultColor = QColor();
|
static QColor defaultColor = QColor();
|
||||||
|
|
||||||
if(obj == label_versionInfo)
|
if(obj == ui->label_versionInfo)
|
||||||
{
|
{
|
||||||
if(event->type() == QEvent::Enter)
|
if(event->type() == QEvent::Enter)
|
||||||
{
|
{
|
||||||
QPalette palette = label_versionInfo->palette();
|
QPalette palette = ui->label_versionInfo->palette();
|
||||||
defaultColor = palette.color(QPalette::Normal, QPalette::WindowText);
|
defaultColor = palette.color(QPalette::Normal, QPalette::WindowText);
|
||||||
palette.setColor(QPalette::Normal, QPalette::WindowText, Qt::red);
|
palette.setColor(QPalette::Normal, QPalette::WindowText, Qt::red);
|
||||||
label_versionInfo->setPalette(palette);
|
ui->label_versionInfo->setPalette(palette);
|
||||||
}
|
}
|
||||||
else if(event->type() == QEvent::Leave)
|
else if(event->type() == QEvent::Leave)
|
||||||
{
|
{
|
||||||
QPalette palette = label_versionInfo->palette();
|
QPalette palette = ui->label_versionInfo->palette();
|
||||||
palette.setColor(QPalette::Normal, QPalette::WindowText, defaultColor);
|
palette.setColor(QPalette::Normal, QPalette::WindowText, defaultColor);
|
||||||
label_versionInfo->setPalette(palette);
|
ui->label_versionInfo->setPalette(palette);
|
||||||
}
|
}
|
||||||
else if(event->type() == QEvent::MouseButtonPress)
|
else if(event->type() == QEvent::MouseButtonPress)
|
||||||
{
|
{
|
||||||
@ -447,7 +453,7 @@ void ProcessingDialog::resizeEvent(QResizeEvent *event)
|
|||||||
{
|
{
|
||||||
if(event) QDialog::resizeEvent(event);
|
if(event) QDialog::resizeEvent(event);
|
||||||
|
|
||||||
if(QWidget *port = view_log->viewport())
|
if(QWidget *port = ui->view_log->viewport())
|
||||||
{
|
{
|
||||||
QRect geom = port->geometry();
|
QRect geom = port->geometry();
|
||||||
m_filterInfoLabel->setGeometry(geom.left() + 16, geom.top() + 16, geom.width() - 32, 48);
|
m_filterInfoLabel->setGeometry(geom.left() + 16, geom.top() + 16, geom.width() - 32, 48);
|
||||||
@ -478,15 +484,15 @@ void ProcessingDialog::initEncoding(void)
|
|||||||
m_forcedAbort = false;
|
m_forcedAbort = false;
|
||||||
m_playList.clear();
|
m_playList.clear();
|
||||||
|
|
||||||
CHANGE_BACKGROUND_COLOR(frame_header, QColor(Qt::white));
|
CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor(Qt::white));
|
||||||
SET_PROGRESS_TEXT(tr("Encoding files, please wait..."));
|
SET_PROGRESS_TEXT(tr("Encoding files, please wait..."));
|
||||||
m_progressIndicator->start();
|
m_progressIndicator->start();
|
||||||
|
|
||||||
button_closeDialog->setEnabled(false);
|
ui->button_closeDialog->setEnabled(false);
|
||||||
button_AbortProcess->setEnabled(true);
|
ui->button_AbortProcess->setEnabled(true);
|
||||||
progressBar->setRange(0, m_pendingJobs.count());
|
ui->progressBar->setRange(0, m_pendingJobs.count());
|
||||||
checkBox_shutdownComputer->setEnabled(true);
|
ui->checkBox_shutdownComputer->setEnabled(true);
|
||||||
checkBox_shutdownComputer->setChecked(false);
|
ui->checkBox_shutdownComputer->setChecked(false);
|
||||||
|
|
||||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNormalState);
|
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNormalState);
|
||||||
WinSevenTaskbar::setTaskbarProgress(this, 0, m_pendingJobs.count());
|
WinSevenTaskbar::setTaskbarProgress(this, 0, m_pendingJobs.count());
|
||||||
@ -542,7 +548,7 @@ void ProcessingDialog::abortEncoding(bool force)
|
|||||||
{
|
{
|
||||||
m_userAborted = true;
|
m_userAborted = true;
|
||||||
if(force) m_forcedAbort = true;
|
if(force) m_forcedAbort = true;
|
||||||
button_AbortProcess->setEnabled(false);
|
ui->button_AbortProcess->setEnabled(false);
|
||||||
SET_PROGRESS_TEXT(tr("Aborted! Waiting for running jobs to terminate..."));
|
SET_PROGRESS_TEXT(tr("Aborted! Waiting for running jobs to terminate..."));
|
||||||
|
|
||||||
for(int i = 0; i < m_threadList.count(); i++)
|
for(int i = 0; i < m_threadList.count(); i++)
|
||||||
@ -554,12 +560,12 @@ void ProcessingDialog::abortEncoding(bool force)
|
|||||||
void ProcessingDialog::doneEncoding(void)
|
void ProcessingDialog::doneEncoding(void)
|
||||||
{
|
{
|
||||||
m_runningThreads--;
|
m_runningThreads--;
|
||||||
progressBar->setValue(progressBar->value() + 1);
|
ui->progressBar->setValue(ui->progressBar->value() + 1);
|
||||||
|
|
||||||
if(!m_userAborted)
|
if(!m_userAborted)
|
||||||
{
|
{
|
||||||
SET_PROGRESS_TEXT(tr("Encoding: %1 files of %2 completed so far, please wait...").arg(QString::number(progressBar->value()), QString::number(progressBar->maximum())));
|
SET_PROGRESS_TEXT(tr("Encoding: %1 files of %2 completed so far, please wait...").arg(QString::number(ui->progressBar->value()), QString::number(ui->progressBar->maximum())));
|
||||||
WinSevenTaskbar::setTaskbarProgress(this, progressBar->value(), progressBar->maximum());
|
WinSevenTaskbar::setTaskbarProgress(this, ui->progressBar->value(), ui->progressBar->maximum());
|
||||||
}
|
}
|
||||||
|
|
||||||
int index = m_threadList.indexOf(dynamic_cast<ProcessThread*>(QWidget::sender()));
|
int index = m_threadList.indexOf(dynamic_cast<ProcessThread*>(QWidget::sender()));
|
||||||
@ -593,7 +599,7 @@ void ProcessingDialog::doneEncoding(void)
|
|||||||
|
|
||||||
if(m_userAborted)
|
if(m_userAborted)
|
||||||
{
|
{
|
||||||
CHANGE_BACKGROUND_COLOR(frame_header, QColor("#FFF3BA"));
|
CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor("#FFF3BA"));
|
||||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState);
|
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState);
|
||||||
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/error.png"));
|
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/error.png"));
|
||||||
SET_PROGRESS_TEXT((m_succeededJobs.count() > 0) ? tr("Process was aborted by the user after %1 file(s)!").arg(QString::number(m_succeededJobs.count())) : tr("Process was aborted prematurely by the user!"));
|
SET_PROGRESS_TEXT((m_succeededJobs.count() > 0) ? tr("Process was aborted by the user after %1 file(s)!").arg(QString::number(m_succeededJobs.count())) : tr("Process was aborted prematurely by the user!"));
|
||||||
@ -619,7 +625,7 @@ void ProcessingDialog::doneEncoding(void)
|
|||||||
|
|
||||||
if(m_failedJobs.count() > 0)
|
if(m_failedJobs.count() > 0)
|
||||||
{
|
{
|
||||||
CHANGE_BACKGROUND_COLOR(frame_header, QColor("#FFBABA"));
|
CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor("#FFBABA"));
|
||||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState);
|
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState);
|
||||||
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/exclamation.png"));
|
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/exclamation.png"));
|
||||||
if(m_skippedJobs.count() > 0)
|
if(m_skippedJobs.count() > 0)
|
||||||
@ -637,7 +643,7 @@ void ProcessingDialog::doneEncoding(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CHANGE_BACKGROUND_COLOR(frame_header, QColor("#E0FFE2"));
|
CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor("#E0FFE2"));
|
||||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNormalState);
|
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNormalState);
|
||||||
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/accept.png"));
|
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/accept.png"));
|
||||||
if(m_skippedJobs.count() > 0)
|
if(m_skippedJobs.count() > 0)
|
||||||
@ -656,19 +662,19 @@ void ProcessingDialog::doneEncoding(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
setCloseButtonEnabled(true);
|
setCloseButtonEnabled(true);
|
||||||
button_closeDialog->setEnabled(true);
|
ui->button_closeDialog->setEnabled(true);
|
||||||
button_AbortProcess->setEnabled(false);
|
ui->button_AbortProcess->setEnabled(false);
|
||||||
checkBox_shutdownComputer->setEnabled(false);
|
ui->checkBox_shutdownComputer->setEnabled(false);
|
||||||
|
|
||||||
m_progressModel->restoreHiddenItems();
|
m_progressModel->restoreHiddenItems();
|
||||||
view_log->scrollToBottom();
|
ui->view_log->scrollToBottom();
|
||||||
m_progressIndicator->stop();
|
m_progressIndicator->stop();
|
||||||
progressBar->setValue(progressBar->maximum());
|
ui->progressBar->setValue(ui->progressBar->maximum());
|
||||||
WinSevenTaskbar::setTaskbarProgress(this, progressBar->value(), progressBar->maximum());
|
WinSevenTaskbar::setTaskbarProgress(this, ui->progressBar->value(), ui->progressBar->maximum());
|
||||||
|
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
|
|
||||||
if(!m_userAborted && checkBox_shutdownComputer->isChecked())
|
if(!m_userAborted && ui->checkBox_shutdownComputer->isChecked())
|
||||||
{
|
{
|
||||||
if(shutdownComputer())
|
if(shutdownComputer())
|
||||||
{
|
{
|
||||||
@ -710,7 +716,7 @@ void ProcessingDialog::progressModelChanged(void)
|
|||||||
QTimer::singleShot(0, this, SLOT(progressViewFilterChanged()));
|
QTimer::singleShot(0, this, SLOT(progressViewFilterChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QTimer::singleShot(0, view_log, SLOT(scrollToBottom()));
|
QTimer::singleShot(0, ui->view_log, SLOT(scrollToBottom()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessingDialog::logViewDoubleClicked(const QModelIndex &index)
|
void ProcessingDialog::logViewDoubleClicked(const QModelIndex &index)
|
||||||
@ -741,7 +747,7 @@ void ProcessingDialog::logViewSectionSizeChanged(int logicalIndex, int oldSize,
|
|||||||
{
|
{
|
||||||
if(logicalIndex == 1)
|
if(logicalIndex == 1)
|
||||||
{
|
{
|
||||||
if(QHeaderView *hdr = view_log->horizontalHeader())
|
if(QHeaderView *hdr = ui->view_log->horizontalHeader())
|
||||||
{
|
{
|
||||||
hdr->setMinimumSectionSize(qMax(hdr->minimumSectionSize(), hdr->sectionSize(1)));
|
hdr->setMinimumSectionSize(qMax(hdr->minimumSectionSize(), hdr->sectionSize(1)));
|
||||||
}
|
}
|
||||||
@ -761,14 +767,14 @@ void ProcessingDialog::contextMenuTriggered(const QPoint &pos)
|
|||||||
|
|
||||||
void ProcessingDialog::contextMenuDetailsActionTriggered(void)
|
void ProcessingDialog::contextMenuDetailsActionTriggered(void)
|
||||||
{
|
{
|
||||||
QModelIndex index = view_log->indexAt(view_log->viewport()->mapFromGlobal(m_contextMenu->pos()));
|
QModelIndex index = ui->view_log->indexAt(ui->view_log->viewport()->mapFromGlobal(m_contextMenu->pos()));
|
||||||
logViewDoubleClicked(index.isValid() ? index : view_log->currentIndex());
|
logViewDoubleClicked(index.isValid() ? index : ui->view_log->currentIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessingDialog::contextMenuShowFileActionTriggered(void)
|
void ProcessingDialog::contextMenuShowFileActionTriggered(void)
|
||||||
{
|
{
|
||||||
QModelIndex index = view_log->indexAt(view_log->viewport()->mapFromGlobal(m_contextMenu->pos()));
|
QModelIndex index = ui->view_log->indexAt(ui->view_log->viewport()->mapFromGlobal(m_contextMenu->pos()));
|
||||||
const QUuid &jobId = m_progressModel->getJobId(index.isValid() ? index : view_log->currentIndex());
|
const QUuid &jobId = m_progressModel->getJobId(index.isValid() ? index : ui->view_log->currentIndex());
|
||||||
QString filePath = m_playList.value(jobId, QString());
|
QString filePath = m_playList.value(jobId, QString());
|
||||||
|
|
||||||
if(filePath.isEmpty())
|
if(filePath.isEmpty())
|
||||||
@ -817,7 +823,7 @@ void ProcessingDialog::contextMenuFilterActionTriggered(void)
|
|||||||
m_progressViewFilter = action->data().toInt();
|
m_progressViewFilter = action->data().toInt();
|
||||||
progressViewFilterChanged();
|
progressViewFilterChanged();
|
||||||
QTimer::singleShot(0, this, SLOT(progressViewFilterChanged()));
|
QTimer::singleShot(0, this, SLOT(progressViewFilterChanged()));
|
||||||
QTimer::singleShot(0, view_log, SLOT(scrollToBottom()));
|
QTimer::singleShot(0, ui->view_log, SLOT(scrollToBottom()));
|
||||||
action->setChecked(true);
|
action->setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -830,11 +836,11 @@ void ProcessingDialog::progressViewFilterChanged(void)
|
|||||||
{
|
{
|
||||||
bool matchFound = false;
|
bool matchFound = false;
|
||||||
|
|
||||||
for(int i = 0; i < view_log->model()->rowCount(); i++)
|
for(int i = 0; i < ui->view_log->model()->rowCount(); i++)
|
||||||
{
|
{
|
||||||
QModelIndex index = (m_progressViewFilter >= 0) ? m_progressModel->index(i, 0) : QModelIndex();
|
QModelIndex index = (m_progressViewFilter >= 0) ? m_progressModel->index(i, 0) : QModelIndex();
|
||||||
const bool bHide = index.isValid() ? (m_progressModel->getJobState(index) != m_progressViewFilter) : false;
|
const bool bHide = index.isValid() ? (m_progressModel->getJobState(index) != m_progressViewFilter) : false;
|
||||||
view_log->setRowHidden(i, bHide); matchFound = matchFound || (!bHide);
|
ui->view_log->setRowHidden(i, bHide); matchFound = matchFound || (!bHide);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((m_progressViewFilter >= 0) && (!matchFound))
|
if((m_progressViewFilter >= 0) && (!matchFound))
|
||||||
@ -1187,15 +1193,15 @@ void ProcessingDialog::systemTrayActivated(QSystemTrayIcon::ActivationReason rea
|
|||||||
void ProcessingDialog::cpuUsageHasChanged(const double val)
|
void ProcessingDialog::cpuUsageHasChanged(const double val)
|
||||||
{
|
{
|
||||||
|
|
||||||
this->label_cpu->setText(QString().sprintf(" %d%%", qRound(val * 100.0)));
|
ui->label_cpu->setText(QString().sprintf(" %d%%", qRound(val * 100.0)));
|
||||||
UPDATE_MIN_WIDTH(label_cpu);
|
UPDATE_MIN_WIDTH(ui->label_cpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessingDialog::ramUsageHasChanged(const double val)
|
void ProcessingDialog::ramUsageHasChanged(const double val)
|
||||||
{
|
{
|
||||||
|
|
||||||
this->label_ram->setText(QString().sprintf(" %d%%", qRound(val * 100.0)));
|
ui->label_ram->setText(QString().sprintf(" %d%%", qRound(val * 100.0)));
|
||||||
UPDATE_MIN_WIDTH(label_ram);
|
UPDATE_MIN_WIDTH(ui->label_ram);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessingDialog::diskUsageHasChanged(const quint64 val)
|
void ProcessingDialog::diskUsageHasChanged(const quint64 val)
|
||||||
@ -1210,8 +1216,8 @@ void ProcessingDialog::diskUsageHasChanged(const quint64 val)
|
|||||||
postfix++;
|
postfix++;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->label_disk->setText(QString().sprintf(" %3.1f %s", space, postfixStr[postfix]));
|
ui->label_disk->setText(QString().sprintf(" %3.1f %s", space, postfixStr[postfix]));
|
||||||
UPDATE_MIN_WIDTH(label_disk);
|
UPDATE_MIN_WIDTH(ui->label_disk);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProcessingDialog::shutdownComputer(void)
|
bool ProcessingDialog::shutdownComputer(void)
|
||||||
|
@ -21,22 +21,25 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../tmp/UIC_ProcessingDialog.h"
|
#include <QDialog>
|
||||||
|
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
|
#include <QMap>
|
||||||
|
|
||||||
class QMovie;
|
|
||||||
class QMenu;
|
|
||||||
class ProgressModel;
|
|
||||||
class ProcessThread;
|
|
||||||
class FileListModel;
|
|
||||||
class AudioFileModel;
|
|
||||||
class SettingsModel;
|
|
||||||
class CPUObserverThread;
|
|
||||||
class RAMObserverThread;
|
|
||||||
class DiskObserverThread;
|
|
||||||
class AbstractEncoder;
|
class AbstractEncoder;
|
||||||
|
class AudioFileModel;
|
||||||
|
class CPUObserverThread;
|
||||||
|
class DiskObserverThread;
|
||||||
|
class FileListModel;
|
||||||
|
class ProcessThread;
|
||||||
|
class ProgressModel;
|
||||||
|
class QActionGroup;
|
||||||
|
class QLabel;
|
||||||
|
class QMenu;
|
||||||
|
class QModelIndex;
|
||||||
|
class QMovie;
|
||||||
|
class RAMObserverThread;
|
||||||
|
class SettingsModel;
|
||||||
|
|
||||||
enum shutdownFlag_t
|
enum shutdownFlag_t
|
||||||
{
|
{
|
||||||
@ -45,7 +48,13 @@ enum shutdownFlag_t
|
|||||||
shutdownFlag_Hibernate = 2
|
shutdownFlag_Hibernate = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
class ProcessingDialog : public QDialog, private Ui::ProcessingDialog
|
//UIC forward declartion
|
||||||
|
namespace Ui {
|
||||||
|
class ProcessingDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
//ProcessingDialog class
|
||||||
|
class ProcessingDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -82,6 +91,8 @@ protected:
|
|||||||
virtual void resizeEvent(QResizeEvent *event);
|
virtual void resizeEvent(QResizeEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Ui::ProcessingDialog *ui; //for Qt UIC
|
||||||
|
|
||||||
void setCloseButtonEnabled(bool enabled);
|
void setCloseButtonEnabled(bool enabled);
|
||||||
void startNextJob(void);
|
void startNextJob(void);
|
||||||
AbstractEncoder *makeEncoder(bool *nativeResampling);
|
AbstractEncoder *makeEncoder(bool *nativeResampling);
|
||||||
|
Loading…
Reference in New Issue
Block a user