More improvements to the working banner. Now using QWindowsVistaSytle when "sheet of glass" effect is enabled, for more consistent look. Also fixes some drawing glitches.

This commit is contained in:
LoRd_MuldeR 2013-11-26 23:01:37 +01:00
parent ff30f71c13
commit dd39addb39
13 changed files with 866 additions and 814 deletions

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
<context>
<name>MainWindow</name>
<message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="719"/>
<location filename="../../src/Dialog_MainWindow.cpp" line="742"/>
<source>%n file(s) have been rejected, because read access was not granted!</source>
<translation>
<numerusform>%n file have been rejected, because read access was not granted!</numerusform>
@ -39,7 +39,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="723"/>
<location filename="../../src/Dialog_MainWindow.cpp" line="746"/>
<source>%n file(s) have been rejected, because they are dummy CDDA files!</source>
<translation>
<numerusform>%n file have been rejected, because they are dummy CDDA files!</numerusform>
@ -47,7 +47,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="727"/>
<location filename="../../src/Dialog_MainWindow.cpp" line="750"/>
<source>%n file(s) have been rejected, because they appear to be Cue Sheet images!</source>
<translation>
<numerusform>%n file have been rejected, because they appear to be Cue Sheet images!</numerusform>
@ -55,7 +55,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="731"/>
<location filename="../../src/Dialog_MainWindow.cpp" line="754"/>
<source>%n file(s) have been rejected, because the file format could not be recognized!</source>
<translation>
<numerusform>%n file have been rejected, because the file format could not be recognized!</numerusform>
@ -63,7 +63,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="3764"/>
<location filename="../../src/Dialog_MainWindow.cpp" line="3788"/>
<source>%n Instance(s)</source>
<translation>
<numerusform>%n Instance</numerusform>
@ -74,7 +74,7 @@
<context>
<name>ProcessingDialog</name>
<message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="659"/>
<location filename="../../src/Dialog_Processing.cpp" line="668"/>
<source>Encoding: %n file(s) of %1 completed so far, please wait...</source>
<translation>
<numerusform>Encoding: %n file of %1 completed so far, please wait...</numerusform>
@ -82,7 +82,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="691"/>
<location filename="../../src/Dialog_Processing.cpp" line="700"/>
<source>Process was aborted by the user after %n file(s)!</source>
<translation>
<numerusform>Process was aborted by the user after %n file!</numerusform>
@ -90,7 +90,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="720"/>
<location filename="../../src/Dialog_Processing.cpp" line="729"/>
<source>Error: %1 of %n file(s) failed (%2). Double-click failed items for detailed information!</source>
<translation>
<numerusform>Error: %1 of %n file failed (%2). Double-click failed items for detailed information!</numerusform>
@ -98,7 +98,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="720"/>
<location filename="../../src/Dialog_Processing.cpp" line="729"/>
<source>%n file(s) skipped</source>
<translation>
<numerusform>%n file skipped</numerusform>
@ -106,7 +106,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="724"/>
<location filename="../../src/Dialog_Processing.cpp" line="733"/>
<source>Error: %1 of %n file(s) failed. Double-click failed items for detailed information!</source>
<translation>
<numerusform>Error: %1 of %n file failed. Double-click failed items for detailed information!</numerusform>
@ -114,7 +114,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="738"/>
<location filename="../../src/Dialog_Processing.cpp" line="747"/>
<source>All files completed successfully. Skipped %n file(s).</source>
<translation>
<numerusform>All files completed successfully. Skipped %n file.</numerusform>
@ -122,7 +122,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="1162"/>
<location filename="../../src/Dialog_Processing.cpp" line="1171"/>
<source>%n hour(s)</source>
<translation>
<numerusform>%n hour</numerusform>
@ -130,8 +130,8 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="1163"/>
<location filename="../../src/Dialog_Processing.cpp" line="1167"/>
<location filename="../../src/Dialog_Processing.cpp" line="1172"/>
<location filename="../../src/Dialog_Processing.cpp" line="1176"/>
<source>%n minute(s)</source>
<translation>
<numerusform>%n minute</numerusform>
@ -139,8 +139,8 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="1168"/>
<location filename="../../src/Dialog_Processing.cpp" line="1172"/>
<location filename="../../src/Dialog_Processing.cpp" line="1177"/>
<location filename="../../src/Dialog_Processing.cpp" line="1181"/>
<source>%n second(s)</source>
<translation>
<numerusform>%n second</numerusform>
@ -148,7 +148,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="1173"/>
<location filename="../../src/Dialog_Processing.cpp" line="1182"/>
<source>%n millisecond(s)</source>
<translation>
<numerusform>%n millisecond</numerusform>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -261,7 +261,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>9</width>
<width>12</width>
<height>20</height>
</size>
</property>

View File

@ -138,10 +138,7 @@
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string notr="true">$(Status)</string>

View File

@ -35,7 +35,7 @@
#define VER_LAMEXP_MINOR_LO 9
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 8
#define VER_LAMEXP_BUILD 1477
#define VER_LAMEXP_BUILD 1481
#define VER_LAMEXP_CONFG 1348
///////////////////////////////////////////////////////////////////////////////

View File

@ -77,9 +77,20 @@
// Helper macros
////////////////////////////////////////////////////////////
#define BANNER_VISIBLE ((m_banner != NULL) && m_banner->isVisible())
#define INIT_BANNER() do \
{ \
if(m_banner == NULL) \
{ \
m_banner = new WorkingBanner(this); \
} \
} \
while(0)
#define ABORT_IF_BUSY do \
{ \
if(m_banner->isVisible() || m_delayedFileTimer->isActive()) \
if(BANNER_VISIBLE || m_delayedFileTimer->isActive()) \
{ \
lamexp_beep(lamexp_beep_warning); \
return; \
@ -158,9 +169,10 @@ while(0)
#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(QString(URL).replace("-", "&minus;"))
#define FSLINK(PATH) QString("<a href=\"file:///%1\">%2</a>").arg(PATH).arg(QString(PATH).replace("-", "&minus;"))
//#define USE_NATIVE_FILE_DIALOG (lamexp_themes_enabled() || ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) < QSysInfo::WV_XP))
#define CENTER_CURRENT_OUTPUT_FOLDER_DELAYED QTimer::singleShot(125, this, SLOT(centerOutputFolderModel()))
//#define USE_NATIVE_FILE_DIALOG (lamexp_themes_enabled() || ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) < QSysInfo::WV_XP))
static const unsigned int IDM_ABOUTBOX = 0xEFF0;
////////////////////////////////////////////////////////////
@ -174,7 +186,9 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel_MetaInfo *me
m_fileListModel(fileListModel),
m_metaData(metaInfo),
m_settings(settingsModel),
m_windowIcon(NULL),
m_fileSystemModel(NULL),
m_banner(NULL),
m_accepted(false),
m_firstTimeShown(true),
m_outputFolderViewCentering(false),
@ -183,7 +197,10 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel_MetaInfo *me
//Init the dialog, from the .ui file
ui->setupUi(this);
setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint);
//Create window icon
m_windowIcon = lamexp_set_window_icon(this, lamexp_app_icon(), true);
//Register meta types
qRegisterMetaType<AudioFileModel>("AudioFileModel");
@ -591,9 +608,6 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel_MetaInfo *me
move((desktopRect.width() - thisRect.width()) / 2, (desktopRect.height() - thisRect.height()) / 2);
setMinimumSize(thisRect.width(), thisRect.height());
//Create banner
m_banner = new WorkingBanner(this);
//Create DropBox widget
m_dropBox = new DropBox(this, m_fileListModel, m_settings);
connect(m_fileListModel, SIGNAL(modelReset()), m_dropBox, SLOT(modelChanged()));
@ -669,6 +683,13 @@ MainWindow::~MainWindow(void)
LAMEXP_DELETE(m_evenFilterOutputFolderView);
LAMEXP_DELETE(m_evenFilterCompressionTab);
//Free window icon
if(m_windowIcon)
{
lamexp_free_window_icon(m_windowIcon);
m_windowIcon = NULL;
}
//Un-initialize the dialog
LAMEXP_DELETE(ui);
}
@ -689,7 +710,9 @@ void MainWindow::addFiles(const QStringList &files)
ui->tabWidget->setCurrentIndex(0);
INIT_BANNER();
FileAnalyzer *analyzer = new FileAnalyzer(files);
connect(analyzer, SIGNAL(fileSelected(QString)), m_banner, SLOT(setText(QString)), Qt::QueuedConnection);
connect(analyzer, SIGNAL(progressValChanged(unsigned int)), m_banner, SLOT(setProgressVal(unsigned int)), Qt::QueuedConnection);
connect(analyzer, SIGNAL(progressMaxChanged(unsigned int)), m_banner, SLOT(setProgressMax(unsigned int)), Qt::QueuedConnection);
@ -740,6 +763,8 @@ void MainWindow::addFiles(const QStringList &files)
*/
void MainWindow::addFolder(const QString &path, bool recursive, bool delayed)
{
INIT_BANNER();
QFileInfoList folderInfoList;
folderInfoList << QFileInfo(path);
QStringList fileList;
@ -928,7 +953,6 @@ void MainWindow::showEvent(QShowEvent *event)
if(m_firstTimeShown)
{
m_firstTimeShown = false;
lamexp_set_window_icon(this, lamexp_app_icon(), true);
QTimer::singleShot(0, this, SLOT(windowShown()));
}
else
@ -1092,7 +1116,7 @@ void MainWindow::dropEvent(QDropEvent *event)
*/
void MainWindow::closeEvent(QCloseEvent *event)
{
if(m_banner->isVisible() || m_delayedFileTimer->isActive())
if(BANNER_VISIBLE || m_delayedFileTimer->isActive())
{
lamexp_beep(lamexp_beep_warning);
event->ignore();
@ -1178,7 +1202,7 @@ bool MainWindow::event(QEvent *e)
{
case lamexp_event_queryendsession:
qWarning("System is shutting down, main window prepares to close...");
if(m_banner->isVisible()) m_banner->close();
if(BANNER_VISIBLE) m_banner->close();
if(m_delayedFileTimer->isActive()) m_delayedFileTimer->stop();
return true;
case lamexp_event_endsession:
@ -1327,7 +1351,7 @@ void MainWindow::windowShown(void)
return;
default:
QEventLoop loop; QTimer::singleShot(7000, &loop, SLOT(quit()));
lamexp_play_sound(IDR_WAVE_WAITING, true);
INIT_BANNER(); lamexp_play_sound(IDR_WAVE_WAITING, true);
m_banner->show(tr("Skipping update check this time, please be patient..."), &loop);
break;
}
@ -2432,7 +2456,7 @@ void MainWindow::handleDelayedFiles(void)
return;
}
if(m_banner->isVisible())
if(BANNER_VISIBLE)
{
m_delayedFileTimer->start(5000);
return;
@ -3999,7 +4023,7 @@ void MainWindow::resetAdvancedOptionsButtonClicked(void)
*/
void MainWindow::notifyOtherInstance(void)
{
if(!m_banner->isVisible())
if(!(BANNER_VISIBLE))
{
QMessageBox msgBox(QMessageBox::Warning, tr("Already Running"), tr("LameXP is already running, please use the running instance!"), QMessageBox::NoButton, this, Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowStaysOnTopHint);
msgBox.exec();
@ -4049,7 +4073,7 @@ void MainWindow::addFilesDelayed(const QStringList &filePaths, bool tryASAP)
*/
void MainWindow::addFolderDelayed(const QString &folderPath, bool recursive)
{
if(!m_banner->isVisible())
if(!(BANNER_VISIBLE))
{
addFolder(folderPath, recursive, true);
}

View File

@ -41,6 +41,7 @@ class QMenu;
class QModelIndex;
class SettingsModel;
class WorkingBanner;
class lamexp_icon_t;
//UIC forward declartion
namespace Ui {
@ -193,6 +194,7 @@ private:
bool m_firstTimeShown;
uint m_outputFolderViewInitCounter;
bool m_outputFolderViewCentering;
lamexp_icon_t *m_windowIcon;
WorkingBanner *m_banner;
QStringList *m_delayedFileList;

View File

@ -136,6 +136,7 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, const AudioFile
:
QDialog(parent),
ui(new Ui::ProcessingDialog),
m_windowIcon(NULL),
m_systemTray(new QSystemTrayIcon(QIcon(":/icons/cd_go.png"), this)),
m_settings(settings),
m_metaInfo(metaInfo),
@ -152,6 +153,9 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, const AudioFile
ui->setupUi(this);
setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
//Update the window icon
m_windowIcon = lamexp_set_window_icon(this, lamexp_app_icon(), true);
//Update header icon
ui->label_headerIcon->setPixmap(lamexp_app_icon().pixmap(ui->label_headerIcon->size()));
@ -298,6 +302,7 @@ ProcessingDialog::~ProcessingDialog(void)
m_diskObserver->wait();
}
}
if(m_cpuObserver)
{
m_cpuObserver->stop();
@ -307,6 +312,7 @@ ProcessingDialog::~ProcessingDialog(void)
m_cpuObserver->wait();
}
}
if(m_ramObserver)
{
m_ramObserver->stop();
@ -341,6 +347,12 @@ ProcessingDialog::~ProcessingDialog(void)
WinSevenTaskbar::setOverlayIcon(this, NULL);
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNoState);
if(m_windowIcon)
{
lamexp_free_window_icon(m_windowIcon);
m_windowIcon = NULL;
}
LAMEXP_DELETE(ui);
}
@ -355,9 +367,6 @@ void ProcessingDialog::showEvent(QShowEvent *event)
if(m_firstShow)
{
static const char *NA = " N/A";
//Update the window icon
lamexp_set_window_icon(this, lamexp_app_icon(), true);
lamexp_enable_close_button(this, false);
ui->button_closeDialog->setEnabled(false);

View File

@ -43,6 +43,7 @@ class QMovie;
class RAMObserverThread;
class SettingsModel;
class QThreadPool;
class lamexp_icon_t;
enum shutdownFlag_t
{
@ -106,6 +107,7 @@ private:
bool shutdownComputer(void);
QString time2text(const double timeVal) const;
lamexp_icon_t *m_windowIcon;
QThreadPool *m_threadPool;
QList<AudioFileModel> m_pendingJobs;
SettingsModel *m_settings;

View File

@ -31,6 +31,8 @@
#include <QKeyEvent>
#include <QFontMetrics>
#include <QPainter>
#include <QWindowsVistaStyle>
#include <QTimer>
#define EPS (1.0E-5)
@ -76,7 +78,7 @@ static inline void UPDATE_MARGINS(QWidget *control, int l = 0, int r = 0, int t
WorkingBanner::WorkingBanner(QWidget *parent)
:
QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint),
ui(new Ui::WorkingBanner()), m_metrics(NULL), m_working(NULL)
ui(new Ui::WorkingBanner()), m_metrics(NULL), m_working(NULL), m_style(NULL)
{
//Init the dialog, from the .ui file
ui->setupUi(this);
@ -85,18 +87,20 @@ WorkingBanner::WorkingBanner(QWidget *parent)
//Enable the "sheet of glass" effect
if(lamexp_sheet_of_glass(this))
{
SET_TEXT_COLOR(ui->labelStatus, lamexp_system_color(lamexp_syscolor_caption));
m_style = new QWindowsVistaStyle();
ui->labelStatus->setStyle(m_style);
ui->progressBar->setStyle(m_style);
ui->labelStatus->setStyleSheet("background-color: rgb(255, 255, 255);");
}
else
{
UPDATE_MARGINS(this, 5);
m_working = new QMovie(":/images/Busy.gif");
m_working->setSpeed(75);
m_working->setCacheMode(QMovie::CacheAll);
ui->labelWorking->setMovie(m_working);
m_working->start();
}
//Set Opacity
this->setWindowOpacity(0.9);
@ -119,6 +123,7 @@ WorkingBanner::~WorkingBanner(void)
LAMEXP_DELETE(m_working);
}
LAMEXP_DELETE(m_style);
LAMEXP_DELETE(m_metrics);
delete ui;
}
@ -244,10 +249,20 @@ bool WorkingBanner::winEvent(MSG *message, long *result)
return WinSevenTaskbar::handleWinEvent(message, result);
}
void WorkingBanner::showEvent(QShowEvent *event)
{
QTimer::singleShot(125, this, SLOT(windowShown()));
}
////////////////////////////////////////////////////////////
// SLOTS
////////////////////////////////////////////////////////////
void WorkingBanner::windowShown(void)
{
lamexp_bring_to_front(this);
}
void WorkingBanner::setText(const QString &text)
{
if(!m_metrics)
@ -255,14 +270,14 @@ void WorkingBanner::setText(const QString &text)
m_metrics = new QFontMetrics(ui->labelStatus->font());
}
if(m_metrics->width(text) <= ui->labelStatus->width() - 8)
if(m_metrics->width(text) <= ui->labelStatus->width() - 16)
{
ui->labelStatus->setText(text);
}
else
{
QString choppedText = text.simplified().append("...");
while((m_metrics->width(choppedText) > ui->labelStatus->width() - 8) && (choppedText.length() > 8))
while((m_metrics->width(choppedText) > ui->labelStatus->width() - 16) && (choppedText.length() > 8))
{
choppedText.chop(4);
choppedText = choppedText.trimmed();

View File

@ -54,6 +54,7 @@ private:
bool m_canClose;
public slots:
void windowShown(void);
void setText(const QString &text);
void setProgressMax(unsigned int max);
void setProgressVal(unsigned int val);
@ -63,10 +64,12 @@ signals:
void userAbort(void);
protected:
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);
void closeEvent(QCloseEvent *event);
bool winEvent(MSG *message, long *result);
virtual void keyPressEvent(QKeyEvent *event);
virtual void keyReleaseEvent(QKeyEvent *event);
virtual void closeEvent(QCloseEvent *event);
virtual bool winEvent(MSG *message, long *result);
virtual void showEvent(QShowEvent *event);
QFontMetrics *m_metrics;
QStyle *m_style;
};