More improvements to Splash Screen and the working banner.

This commit is contained in:
LoRd_MuldeR 2013-11-24 17:55:35 +01:00
parent 1f98e90244
commit 3d5b9541ed
17 changed files with 270 additions and 106 deletions

View File

@ -23,6 +23,7 @@ a:visited { color: #0000EE; }
<li>Reworked the application initialization code, resulting in notably faster startup speed <li>Reworked the application initialization code, resulting in notably faster startup speed
<li>Improved file analyzer to retain the original ordering of files imported from a playlist <li>Improved file analyzer to retain the original ordering of files imported from a playlist
<li>Improved internal encoder API, so each encoder can define its own configuration options <li>Improved internal encoder API, so each encoder can define its own configuration options
<li>Improved splash screen and working banner, using "sheet of glass" effect on supported OS
<li>Improved dropbox widget, including proper multi-monitor support <li>Improved dropbox widget, including proper multi-monitor support
<li>Updated mpg123 decoder to v1.16.0 (2013-10-06), compiled with GCC 4.8.1 <li>Updated mpg123 decoder to v1.16.0 (2013-10-06), compiled with GCC 4.8.1
<li>Updated GNU Wget binary to v1.14.0 (2012-08-05), compiled with GCC 4.8.1 <li>Updated GNU Wget binary to v1.14.0 (2012-08-05), compiled with GCC 4.8.1

View File

@ -3300,22 +3300,22 @@
<context> <context>
<name>QApplication</name> <name>QApplication</name>
<message> <message>
<location filename="../../src/Global_Win32.cpp" line="1011"/> <location filename="../../src/Global_Win32.cpp" line="1023"/>
<source>Executable &apos;%1&apos; doesn&apos;t support Windows compatibility mode.</source> <source>Executable &apos;%1&apos; doesn&apos;t support Windows compatibility mode.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/Global_Win32.cpp" line="953"/> <location filename="../../src/Global_Win32.cpp" line="965"/>
<source>Executable &apos;%1&apos; requires Qt v%2, but found Qt v%3.</source> <source>Executable &apos;%1&apos; requires Qt v%2, but found Qt v%3.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/Global_Win32.cpp" line="958"/> <location filename="../../src/Global_Win32.cpp" line="970"/>
<source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source> <source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/Global_Win32.cpp" line="970"/> <location filename="../../src/Global_Win32.cpp" line="982"/>
<source>Executable &apos;%1&apos; requires Windows XP or later.</source> <source>Executable &apos;%1&apos; requires Windows XP or later.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -3336,7 +3336,7 @@
<context> <context>
<name>SplashScreen</name> <name>SplashScreen</name>
<message> <message>
<location filename="../../gui/SplashScreen.ui" line="105"/> <location filename="../../gui/SplashScreen.ui" line="108"/>
<source>LameXP is launching...</source> <source>LameXP is launching...</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -3337,22 +3337,22 @@
<context> <context>
<name>QApplication</name> <name>QApplication</name>
<message> <message>
<location filename="../../src/Global_Win32.cpp" line="1011"/> <location filename="../../src/Global_Win32.cpp" line="1023"/>
<source>Executable &apos;%1&apos; doesn&apos;t support Windows compatibility mode.</source> <source>Executable &apos;%1&apos; doesn&apos;t support Windows compatibility mode.</source>
<translation type="unfinished">Plik wykonywalny &apos;%1&apos; nie działa w trybie kompatybilności z Windows.</translation> <translation type="unfinished">Plik wykonywalny &apos;%1&apos; nie działa w trybie kompatybilności z Windows.</translation>
</message> </message>
<message> <message>
<location filename="../../src/Global_Win32.cpp" line="953"/> <location filename="../../src/Global_Win32.cpp" line="965"/>
<source>Executable &apos;%1&apos; requires Qt v%2, but found Qt v%3.</source> <source>Executable &apos;%1&apos; requires Qt v%2, but found Qt v%3.</source>
<translation type="unfinished">Plik wykonywalny &apos;%1&apos; wymaga Qt v%2, znaleziono jednak Qt v%3.</translation> <translation type="unfinished">Plik wykonywalny &apos;%1&apos; wymaga Qt v%2, znaleziono jednak Qt v%3.</translation>
</message> </message>
<message> <message>
<location filename="../../src/Global_Win32.cpp" line="958"/> <location filename="../../src/Global_Win32.cpp" line="970"/>
<source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source> <source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source>
<translation type="unfinished">Plik wykonywalny &quot;%1&quot; został skompilowany dla Qt &quot;%2&quot;, znaleziono &quot;%3&quot;.</translation> <translation type="unfinished">Plik wykonywalny &quot;%1&quot; został skompilowany dla Qt &quot;%2&quot;, znaleziono &quot;%3&quot;.</translation>
</message> </message>
<message> <message>
<location filename="../../src/Global_Win32.cpp" line="970"/> <location filename="../../src/Global_Win32.cpp" line="982"/>
<source>Executable &apos;%1&apos; requires Windows XP or later.</source> <source>Executable &apos;%1&apos; requires Windows XP or later.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -3373,7 +3373,7 @@
<context> <context>
<name>SplashScreen</name> <name>SplashScreen</name>
<message> <message>
<location filename="../../gui/SplashScreen.ui" line="105"/> <location filename="../../gui/SplashScreen.ui" line="108"/>
<source>LameXP is launching...</source> <source>LameXP is launching...</source>
<translation type="unfinished">LameXP właśnie odpala...</translation> <translation type="unfinished">LameXP właśnie odpala...</translation>
</message> </message>

View File

@ -3320,22 +3320,22 @@
<context> <context>
<name>QApplication</name> <name>QApplication</name>
<message> <message>
<location filename="../../src/Global_Win32.cpp" line="1011"/> <location filename="../../src/Global_Win32.cpp" line="1023"/>
<source>Executable &apos;%1&apos; doesn&apos;t support Windows compatibility mode.</source> <source>Executable &apos;%1&apos; doesn&apos;t support Windows compatibility mode.</source>
<translation>EXE-filen &apos;%1&apos; stöder inte Windows kompatibilitetsläge.</translation> <translation>EXE-filen &apos;%1&apos; stöder inte Windows kompatibilitetsläge.</translation>
</message> </message>
<message> <message>
<location filename="../../src/Global_Win32.cpp" line="953"/> <location filename="../../src/Global_Win32.cpp" line="965"/>
<source>Executable &apos;%1&apos; requires Qt v%2, but found Qt v%3.</source> <source>Executable &apos;%1&apos; requires Qt v%2, but found Qt v%3.</source>
<translation>EXE-filen &apos;%1&apos; kräver Qt v%2, du har Qt v%3.</translation> <translation>EXE-filen &apos;%1&apos; kräver Qt v%2, du har Qt v%3.</translation>
</message> </message>
<message> <message>
<location filename="../../src/Global_Win32.cpp" line="958"/> <location filename="../../src/Global_Win32.cpp" line="970"/>
<source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source> <source>Executable &apos;%1&apos; was built for Qt &apos;%2&apos;, but found Qt &apos;%3&apos;.</source>
<translation>EXE-filen &apos;%1&apos; är byggd för Qt &apos;%2&apos;, du har Qt &apos;%3&apos;.</translation> <translation>EXE-filen &apos;%1&apos; är byggd för Qt &apos;%2&apos;, du har Qt &apos;%3&apos;.</translation>
</message> </message>
<message> <message>
<location filename="../../src/Global_Win32.cpp" line="970"/> <location filename="../../src/Global_Win32.cpp" line="982"/>
<source>Executable &apos;%1&apos; requires Windows XP or later.</source> <source>Executable &apos;%1&apos; requires Windows XP or later.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -3356,7 +3356,7 @@
<context> <context>
<name>SplashScreen</name> <name>SplashScreen</name>
<message> <message>
<location filename="../../gui/SplashScreen.ui" line="105"/> <location filename="../../gui/SplashScreen.ui" line="108"/>
<source>LameXP is launching...</source> <source>LameXP is launching...</source>
<translation>LameXP startar...</translation> <translation>LameXP startar...</translation>
</message> </message>

View File

@ -2,24 +2,27 @@
<ui version="4.0"> <ui version="4.0">
<class>WorkingBanner</class> <class>WorkingBanner</class>
<widget class="QDialog" name="WorkingBanner"> <widget class="QDialog" name="WorkingBanner">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>480</width> <width>512</width>
<height>51</height> <height>78</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>480</width> <width>512</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>480</width> <width>512</width>
<height>53</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="palette"> <property name="palette">
@ -89,31 +92,40 @@
<property name="windowTitle"> <property name="windowTitle">
<string notr="true">Working</string> <string notr="true">Working</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <property name="modal">
<item> <bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>20</number>
</property>
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>15</number>
</property>
<property name="rightMargin">
<number>15</number>
</property>
<property name="bottomMargin">
<number>15</number>
</property>
<item> <item>
<widget class="QLabel" name="labelWorking"> <widget class="QLabel" name="labelWorking">
<property name="minimumSize">
<size>
<width>31</width>
<height>31</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>31</width>
<height>31</height>
</size>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="pixmap"> <property name="pixmap">
<pixmap resource="../res/Images.qrc">:/images/Busy.gif</pixmap> <pixmap resource="../res/Images.qrc">:/images/Clock.png</pixmap>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>4</number>
</property>
<item> <item>
<widget class="QLabel" name="labelStatus"> <widget class="QLabel" name="labelStatus">
<property name="font"> <property name="font">
@ -122,6 +134,15 @@
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text"> <property name="text">
<string notr="true">$(Status)</string> <string notr="true">$(Status)</string>
</property> </property>
@ -130,6 +151,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="maximum">
<number>0</number>
</property>
<property name="value">
<number>-1</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>

View File

@ -6,6 +6,7 @@
<file>images/Busy.gif</file> <file>images/Busy.gif</file>
<file>images/Cartoon.png</file> <file>images/Cartoon.png</file>
<file>images/CD.png</file> <file>images/CD.png</file>
<file>images/Clock.png</file>
<file>images/Disque.png</file> <file>images/Disque.png</file>
<file>images/DropBox.png</file> <file>images/DropBox.png</file>
<file>images/DropZone.png</file> <file>images/DropZone.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 31 KiB

BIN
res/images/Clock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

BIN
res/images/Starting.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

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

View File

@ -29,6 +29,7 @@
#include <QMovie> #include <QMovie>
#include <QKeyEvent> #include <QKeyEvent>
#include <QFontMetrics> #include <QFontMetrics>
#include <QPainter>
#define EPS (1.0E-5) #define EPS (1.0E-5)
@ -37,6 +38,36 @@
/* If, after 50 ms, the wait() function returns with FALSE, then the thread probably is still running and we return TRUE. Otherwise we can return FALSE. */ /* If, after 50 ms, the wait() function returns with FALSE, then the thread probably is still running and we return TRUE. Otherwise we can return FALSE. */
#define THREAD_RUNNING(THRD) (((THRD)->isRunning()) ? (!((THRD)->wait(1))) : false) #define THREAD_RUNNING(THRD) (((THRD)->isRunning()) ? (!((THRD)->wait(1))) : false)
/*Update text color*/
static inline void SET_TEXT_COLOR(QWidget *control, const QColor &color)
{
QPalette pal = control->palette();
pal.setColor(QPalette::WindowText, color);
pal.setColor(QPalette::Text, color);
control->setPalette(pal);
}
/*Make widget translucent*/
static inline void MAKE_TRANSLUCENT(QWidget *control)
{
control->setAttribute(Qt::WA_TranslucentBackground);
control->setAttribute(Qt::WA_NoSystemBackground);
}
/*Update widget margins*/
static inline void UPDATE_MARGINS(QWidget *control, int l = 0, int r = 0, int t = 0, int b = 0)
{
if(QLayout *layout = control->layout())
{
QMargins margins = layout->contentsMargins();
margins.setLeft(margins.left() + l);
margins.setRight(margins.right() + r);
margins.setTop(margins.top() + t);
margins.setBottom(margins.bottom() + b);
layout->setContentsMargins(margins);
}
}
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Constructor // Constructor
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -44,40 +75,35 @@
WorkingBanner::WorkingBanner(QWidget *parent) WorkingBanner::WorkingBanner(QWidget *parent)
: :
QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint), QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint),
m_progressMax(0), m_progressVal(0), m_progressInt(0), m_metrics(NULL) m_metrics(NULL), m_working(NULL)
{ {
//Init the dialog, from the .ui file //Init the dialog, from the .ui file
setupUi(this); setupUi(this);
setModal(true); setModal(true);
//Start animation //Enable the "sheet of glass" effect
if(lamexp_sheet_of_glass(this))
{
SET_TEXT_COLOR(labelStatus, lamexp_system_color(lamexp_syscolor_caption));
}
else
{
UPDATE_MARGINS(this, 5);
m_working = new QMovie(":/images/Busy.gif"); m_working = new QMovie(":/images/Busy.gif");
m_working->setSpeed(50); m_working->setSpeed(75);
m_working->setCacheMode(QMovie::CacheAll);
labelWorking->setMovie(m_working); labelWorking->setMovie(m_working);
m_working->start(); m_working->start();
}
//Create progress indicator
m_progress = new QLabel(labelWorking);
m_progress->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
m_progress->move(0, 0);
m_progress->resize(labelWorking->size());
//Set font size
QFont font = m_progress->font();
font.setPointSize(6);
m_progress->setFont(font);
//Set font color
QPalette color = m_progress->palette();
color.setColor(QPalette::Text, QColor::fromRgb(0x33, 0x33, 0x33));
color.setColor(QPalette::WindowText, QColor::fromRgb(0x33, 0x33, 0x33));
m_progress->setPalette(color);
//Set Opacity //Set Opacity
this->setWindowOpacity(0.9); this->setWindowOpacity(0.9);
//Set wait cursor //Set wait cursor
setCursor(Qt::WaitCursor); setCursor(Qt::WaitCursor);
//Clear label
labelStatus->clear();
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -89,11 +115,9 @@ WorkingBanner::~WorkingBanner(void)
if(m_working) if(m_working)
{ {
m_working->stop(); m_working->stop();
delete m_working; LAMEXP_DELETE(m_working);
m_working = NULL;
} }
LAMEXP_DELETE(m_progress);
LAMEXP_DELETE(m_metrics); LAMEXP_DELETE(m_metrics);
} }
@ -104,22 +128,14 @@ WorkingBanner::~WorkingBanner(void)
void WorkingBanner::show(const QString &text) void WorkingBanner::show(const QString &text)
{ {
m_canClose = false; m_canClose = false;
m_progressInt = -1;
QDialog::show(); QDialog::show();
setFixedSize(size()); setFixedSize(size());
setText(text); setText(text);
m_progress->setText(QString()); //Reset progress
progressBar->setMaximum(0);
QApplication::processEvents(); progressBar->setValue(-1);
}
bool WorkingBanner::close(void)
{
m_canClose = true;
emit userAbort();
return QDialog::close();
} }
void WorkingBanner::show(const QString &text, QThread *thread) void WorkingBanner::show(const QString &text, QThread *thread)
@ -139,12 +155,18 @@ void WorkingBanner::show(const QString &text, QThread *thread)
//Start the thread //Start the thread
thread->start(); thread->start();
//Update cursor
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
//Loop while thread is still running //Loop while thread is still running
while(THREAD_RUNNING(thread)) while(THREAD_RUNNING(thread))
{ {
loop->exec(); loop->exec();
} }
//Restore cursor
QApplication::restoreOverrideCursor();
//Set taskbar state //Set taskbar state
WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarNoState); WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarNoState);
WinSevenTaskbar::setOverlayIcon(dynamic_cast<QWidget*>(this->parent()), NULL); WinSevenTaskbar::setOverlayIcon(dynamic_cast<QWidget*>(this->parent()), NULL);
@ -165,9 +187,15 @@ void WorkingBanner::show(const QString &text, QEventLoop *loop)
WinSevenTaskbar::setOverlayIcon(dynamic_cast<QWidget*>(this->parent()), &QIcon(":/icons/hourglass.png")); WinSevenTaskbar::setOverlayIcon(dynamic_cast<QWidget*>(this->parent()), &QIcon(":/icons/hourglass.png"));
WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarIndeterminateState); WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarIndeterminateState);
//Update cursor
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
//Loop while thread is running //Loop while thread is running
loop->exec(QEventLoop::ExcludeUserInputEvents); loop->exec(QEventLoop::ExcludeUserInputEvents);
//Restore cursor
QApplication::restoreOverrideCursor();
//Set taskbar state //Set taskbar state
WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarNoState); WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarNoState);
WinSevenTaskbar::setOverlayIcon(dynamic_cast<QWidget*>(this->parent()), NULL); WinSevenTaskbar::setOverlayIcon(dynamic_cast<QWidget*>(this->parent()), NULL);
@ -176,6 +204,13 @@ void WorkingBanner::show(const QString &text, QEventLoop *loop)
this->close(); this->close();
} }
bool WorkingBanner::close(void)
{
m_canClose = true;
emit userAbort();
return QDialog::close();
}
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// EVENTS // EVENTS
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -217,14 +252,14 @@ void WorkingBanner::setText(const QString &text)
m_metrics = new QFontMetrics(labelStatus->font()); m_metrics = new QFontMetrics(labelStatus->font());
} }
if(m_metrics->width(text) <= labelStatus->width()) if(m_metrics->width(text) <= labelStatus->width() - 8)
{ {
labelStatus->setText(text); labelStatus->setText(text);
} }
else else
{ {
QString choppedText = text.simplified().append("..."); QString choppedText = text.simplified().append("...");
while((m_metrics->width(choppedText) > labelStatus->width()) && (choppedText.length() > 8)) while((m_metrics->width(choppedText) > labelStatus->width() - 8) && (choppedText.length() > 8))
{ {
choppedText.chop(4); choppedText.chop(4);
choppedText = choppedText.trimmed(); choppedText = choppedText.trimmed();
@ -232,28 +267,23 @@ void WorkingBanner::setText(const QString &text)
} }
labelStatus->setText(choppedText); labelStatus->setText(choppedText);
} }
if(this->isVisible())
{
labelStatus->repaint();
}
} }
void WorkingBanner::setProgressMax(unsigned int max) void WorkingBanner::setProgressMax(unsigned int max)
{ {
m_progressMax = max; progressBar->setMaximum(max);
updateProgress();
} }
void WorkingBanner::setProgressVal(unsigned int val) void WorkingBanner::setProgressVal(unsigned int val)
{ {
m_progressVal = val; progressBar->setValue(val);
updateProgress();
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Private // Private
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/*
void WorkingBanner::updateProgress(void) void WorkingBanner::updateProgress(void)
{ {
if(m_progressMax > 0) if(m_progressMax > 0)
@ -270,3 +300,4 @@ void WorkingBanner::updateProgress(void)
} }
} }
} }
*/

View File

@ -43,7 +43,6 @@ public:
private: private:
QMovie *m_working; QMovie *m_working;
bool m_canClose; bool m_canClose;
void updateProgress(void);
public slots: public slots:
void setText(const QString &text); void setText(const QString &text);
@ -60,9 +59,5 @@ protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
bool winEvent(MSG *message, long *result); bool winEvent(MSG *message, long *result);
QLabel *m_progress;
QFontMetrics *m_metrics; QFontMetrics *m_metrics;
unsigned int m_progressMax;
unsigned int m_progressVal;
unsigned int m_progressInt;
}; };

View File

@ -33,6 +33,7 @@ class QTime;
class QIcon; class QIcon;
class QWidget; class QWidget;
class QProcess; class QProcess;
class QColor;
class LockedFile; class LockedFile;
enum QtMsgType; enum QtMsgType;
@ -125,6 +126,15 @@ typedef enum
} }
lamexp_network_t; lamexp_network_t;
//System color types
typedef enum
{
lamexp_syscolor_text = 0,
lamexp_syscolor_background = 1,
lamexp_syscolor_caption = 2
}
lamexp_syscolor_t;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// GLOBAL FUNCTIONS // GLOBAL FUNCTIONS
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -195,8 +205,10 @@ void lamexp_register_tool(const QString &toolName, LockedFile *file, unsigned in
bool lamexp_remove_file(const QString &filename); bool lamexp_remove_file(const QString &filename);
void lamexp_seed_rand(void); void lamexp_seed_rand(void);
bool lamexp_sheet_of_glass(QWidget *window); bool lamexp_sheet_of_glass(QWidget *window);
bool lamexp_sheet_of_glass_update(QWidget *window);
bool lamexp_shutdown_computer(const QString &message, const unsigned long timeout = 30, const bool forceShutdown = true, const bool hibernate = false); bool lamexp_shutdown_computer(const QString &message, const unsigned long timeout = 30, const bool forceShutdown = true, const bool hibernate = false);
void lamexp_sleep(const unsigned int delay); void lamexp_sleep(const unsigned int delay);
QColor lamexp_system_color(const int color_id);
const char *lamexp_support_url(void); const char *lamexp_support_url(void);
const QString &lamexp_temp_folder2(void); const QString &lamexp_temp_folder2(void);
void lamexp_temp_folder_clear(void); void lamexp_temp_folder_clear(void);

View File

@ -174,6 +174,7 @@ static struct
{ {
bool bInitialized; bool bInitialized;
QLibrary *dwmapi_dll; QLibrary *dwmapi_dll;
HRESULT (__stdcall *dwmIsCompositionEnabled)(BOOL *bEnabled);
HRESULT (__stdcall *dwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS* pMarInset); HRESULT (__stdcall *dwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS* pMarInset);
HRESULT (__stdcall *dwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND* pBlurBehind); HRESULT (__stdcall *dwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND* pBlurBehind);
QReadWriteLock lock; QReadWriteLock lock;
@ -1857,16 +1858,21 @@ bool lamexp_open_media_file(const QString &mediaFilePath)
return false; return false;
} }
static void lamexp_init_dwmapi(void) static bool lamexp_init_dwmapi(void)
{ {
QReadLocker writeLock(&g_lamexp_dwmapi.lock); QReadLocker writeLock(&g_lamexp_dwmapi.lock);
//Not initialized yet? //Not initialized yet?
if(g_lamexp_dwmapi.bInitialized) if(g_lamexp_dwmapi.bInitialized)
{ {
return; return (g_lamexp_dwmapi.dwmIsCompositionEnabled != NULL);
} }
//Reset function pointers
g_lamexp_dwmapi.dwmIsCompositionEnabled = NULL;
g_lamexp_dwmapi.dwmExtendFrameIntoClientArea = NULL;
g_lamexp_dwmapi.dwmEnableBlurBehindWindow = NULL;
//Does OS support DWM? //Does OS support DWM?
if(lamexp_get_os_version() >= lamexp_winver_vista) if(lamexp_get_os_version() >= lamexp_winver_vista)
{ {
@ -1874,7 +1880,8 @@ static void lamexp_init_dwmapi(void)
g_lamexp_dwmapi.dwmapi_dll = new QLibrary("dwmapi.dll"); g_lamexp_dwmapi.dwmapi_dll = new QLibrary("dwmapi.dll");
if(g_lamexp_dwmapi.dwmapi_dll->load()) if(g_lamexp_dwmapi.dwmapi_dll->load())
{ {
//Lookup required functions //Initialize function pointers
g_lamexp_dwmapi.dwmIsCompositionEnabled = (HRESULT (__stdcall*)(BOOL*)) g_lamexp_dwmapi.dwmapi_dll->resolve("DwmIsCompositionEnabled");
g_lamexp_dwmapi.dwmExtendFrameIntoClientArea = (HRESULT (__stdcall*)(HWND, const MARGINS*)) g_lamexp_dwmapi.dwmapi_dll->resolve("DwmExtendFrameIntoClientArea"); g_lamexp_dwmapi.dwmExtendFrameIntoClientArea = (HRESULT (__stdcall*)(HWND, const MARGINS*)) g_lamexp_dwmapi.dwmapi_dll->resolve("DwmExtendFrameIntoClientArea");
g_lamexp_dwmapi.dwmEnableBlurBehindWindow = (HRESULT (__stdcall*)(HWND, const DWM_BLURBEHIND*)) g_lamexp_dwmapi.dwmapi_dll->resolve("DwmEnableBlurBehindWindow"); g_lamexp_dwmapi.dwmEnableBlurBehindWindow = (HRESULT (__stdcall*)(HWND, const DWM_BLURBEHIND*)) g_lamexp_dwmapi.dwmapi_dll->resolve("DwmEnableBlurBehindWindow");
} }
@ -1886,6 +1893,7 @@ static void lamexp_init_dwmapi(void)
} }
g_lamexp_dwmapi.bInitialized = true; g_lamexp_dwmapi.bInitialized = true;
return (g_lamexp_dwmapi.dwmIsCompositionEnabled != NULL);
} }
/* /*
@ -1899,12 +1907,20 @@ bool lamexp_sheet_of_glass(QWidget *window)
while(!g_lamexp_dwmapi.bInitialized) while(!g_lamexp_dwmapi.bInitialized)
{ {
readLock.unlock(); readLock.unlock();
lamexp_init_dwmapi(); if(!lamexp_init_dwmapi()) return false;
readLock.relock(); readLock.relock();
} }
//Required functions available? //Check if composition is enabled
if((g_lamexp_dwmapi.dwmExtendFrameIntoClientArea == NULL) || (g_lamexp_dwmapi.dwmEnableBlurBehindWindow == NULL)) BOOL bEnabled = FALSE;
if(HRESULT hr = g_lamexp_dwmapi.dwmIsCompositionEnabled(&bEnabled))
{
qWarning("DwmIsCompositionEnabled function has failed! (error %d)", hr);
return false;
}
//Composition enabled and required functions available?
if((!bEnabled) || (g_lamexp_dwmapi.dwmExtendFrameIntoClientArea == NULL) || (g_lamexp_dwmapi.dwmEnableBlurBehindWindow == NULL))
{ {
return false; return false;
} }
@ -1929,12 +1945,84 @@ bool lamexp_sheet_of_glass(QWidget *window)
} }
//Required for Qt //Required for Qt
window->setAutoFillBackground(false);
window->setAttribute(Qt::WA_TranslucentBackground); window->setAttribute(Qt::WA_TranslucentBackground);
window->setAttribute(Qt::WA_NoSystemBackground); window->setAttribute(Qt::WA_NoSystemBackground);
return true; return true;
} }
/*
* Update "sheet of glass" effect on the given Window
*/
bool lamexp_sheet_of_glass_update(QWidget *window)
{
QReadLocker readLock(&g_lamexp_dwmapi.lock);
//Initialize the DWM API
while(!g_lamexp_dwmapi.bInitialized)
{
readLock.unlock();
if(!lamexp_init_dwmapi()) return false;
readLock.relock();
}
//Check if composition is enabled
BOOL bEnabled = FALSE;
if(HRESULT hr = g_lamexp_dwmapi.dwmIsCompositionEnabled(&bEnabled))
{
qWarning("DwmIsCompositionEnabled function has failed! (error %d)", hr);
return false;
}
//Composition enabled and required functions available?
if((!bEnabled) || (g_lamexp_dwmapi.dwmEnableBlurBehindWindow == NULL))
{
return false;
}
//Create and populate the Blur Behind structure
DWM_BLURBEHIND bb;
memset(&bb, 0, sizeof(DWM_BLURBEHIND));
bb.fEnable = TRUE;
bb.dwFlags = DWM_BB_ENABLE;
if(HRESULT hr = g_lamexp_dwmapi.dwmEnableBlurBehindWindow(window->winId(), &bb))
{
qWarning("DwmEnableBlurBehindWindow function has failed! (error %d)", hr);
return false;
}
return true;
}
/*
* Get system color info
*/
QColor lamexp_system_color(const int color_id)
{
int nIndex = -1;
switch(color_id)
{
case lamexp_syscolor_text:
nIndex = COLOR_WINDOWTEXT; /*Text in windows*/
break;
case lamexp_syscolor_background:
nIndex = COLOR_WINDOW; /*Window background*/
break;
case lamexp_syscolor_caption:
nIndex = COLOR_CAPTIONTEXT; /*Text in caption, size box, and scroll bar arrow box*/
break;
default:
qWarning("Unknown system color id (%d) specified!", color_id);
nIndex = COLOR_WINDOWTEXT;
}
const DWORD rgb = GetSysColor(nIndex);
QColor color(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb));
return color;
}
/* /*
* Fatal application exit * Fatal application exit
*/ */
@ -2009,8 +2097,9 @@ void lamexp_finalization(void)
LAMEXP_DELETE(application); LAMEXP_DELETE(application);
//Release DWM API //Release DWM API
g_lamexp_dwmapi.dwmEnableBlurBehindWindow = NULL; g_lamexp_dwmapi.dwmIsCompositionEnabled = NULL;
g_lamexp_dwmapi.dwmExtendFrameIntoClientArea = NULL; g_lamexp_dwmapi.dwmExtendFrameIntoClientArea = NULL;
g_lamexp_dwmapi.dwmEnableBlurBehindWindow = NULL;
LAMEXP_DELETE(g_lamexp_dwmapi.dwmapi_dll); LAMEXP_DELETE(g_lamexp_dwmapi.dwmapi_dll);
//Detach from shared memory //Detach from shared memory

View File

@ -152,8 +152,8 @@ void FileAnalyzer::run()
m_timer->invalidate(); m_timer->invalidate();
//Update progress //Update progress
emit progressMaxChanged(m_inputFiles.count()); //emit progressMaxChanged(m_inputFiles.count());
emit progressValChanged(0); //emit progressValChanged(0);
//Create MediaInfo template file //Create MediaInfo template file
if(!m_templateFile) if(!m_templateFile)
@ -180,6 +180,7 @@ void FileAnalyzer::run()
//Update progress //Update progress
emit progressMaxChanged(nFiles); emit progressMaxChanged(nFiles);
emit progressValChanged(0);
//Create thread pool //Create thread pool
if(!m_pool) m_pool = new QThreadPool(); if(!m_pool) m_pool = new QThreadPool();