More improvements to Splash Screen and the working banner.
This commit is contained in:
parent
1f98e90244
commit
3d5b9541ed
@ -23,6 +23,7 @@ a:visited { color: #0000EE; }
|
||||
<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 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>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
|
||||
|
@ -3300,22 +3300,22 @@
|
||||
<context>
|
||||
<name>QApplication</name>
|
||||
<message>
|
||||
<location filename="../../src/Global_Win32.cpp" line="1011"/>
|
||||
<location filename="../../src/Global_Win32.cpp" line="1023"/>
|
||||
<source>Executable '%1' doesn't support Windows compatibility mode.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global_Win32.cpp" line="953"/>
|
||||
<location filename="../../src/Global_Win32.cpp" line="965"/>
|
||||
<source>Executable '%1' requires Qt v%2, but found Qt v%3.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global_Win32.cpp" line="958"/>
|
||||
<location filename="../../src/Global_Win32.cpp" line="970"/>
|
||||
<source>Executable '%1' was built for Qt '%2', but found Qt '%3'.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global_Win32.cpp" line="970"/>
|
||||
<location filename="../../src/Global_Win32.cpp" line="982"/>
|
||||
<source>Executable '%1' requires Windows XP or later.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -3336,7 +3336,7 @@
|
||||
<context>
|
||||
<name>SplashScreen</name>
|
||||
<message>
|
||||
<location filename="../../gui/SplashScreen.ui" line="105"/>
|
||||
<location filename="../../gui/SplashScreen.ui" line="108"/>
|
||||
<source>LameXP is launching...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -3337,22 +3337,22 @@
|
||||
<context>
|
||||
<name>QApplication</name>
|
||||
<message>
|
||||
<location filename="../../src/Global_Win32.cpp" line="1011"/>
|
||||
<location filename="../../src/Global_Win32.cpp" line="1023"/>
|
||||
<source>Executable '%1' doesn't support Windows compatibility mode.</source>
|
||||
<translation type="unfinished">Plik wykonywalny '%1' nie działa w trybie kompatybilności z Windows.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global_Win32.cpp" line="953"/>
|
||||
<location filename="../../src/Global_Win32.cpp" line="965"/>
|
||||
<source>Executable '%1' requires Qt v%2, but found Qt v%3.</source>
|
||||
<translation type="unfinished">Plik wykonywalny '%1' wymaga Qt v%2, znaleziono jednak Qt v%3.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global_Win32.cpp" line="958"/>
|
||||
<location filename="../../src/Global_Win32.cpp" line="970"/>
|
||||
<source>Executable '%1' was built for Qt '%2', but found Qt '%3'.</source>
|
||||
<translation type="unfinished">Plik wykonywalny "%1" został skompilowany dla Qt "%2", znaleziono "%3".</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global_Win32.cpp" line="970"/>
|
||||
<location filename="../../src/Global_Win32.cpp" line="982"/>
|
||||
<source>Executable '%1' requires Windows XP or later.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -3373,7 +3373,7 @@
|
||||
<context>
|
||||
<name>SplashScreen</name>
|
||||
<message>
|
||||
<location filename="../../gui/SplashScreen.ui" line="105"/>
|
||||
<location filename="../../gui/SplashScreen.ui" line="108"/>
|
||||
<source>LameXP is launching...</source>
|
||||
<translation type="unfinished">LameXP właśnie odpala...</translation>
|
||||
</message>
|
||||
|
@ -3320,22 +3320,22 @@
|
||||
<context>
|
||||
<name>QApplication</name>
|
||||
<message>
|
||||
<location filename="../../src/Global_Win32.cpp" line="1011"/>
|
||||
<location filename="../../src/Global_Win32.cpp" line="1023"/>
|
||||
<source>Executable '%1' doesn't support Windows compatibility mode.</source>
|
||||
<translation>EXE-filen '%1' stöder inte Windows kompatibilitetsläge.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global_Win32.cpp" line="953"/>
|
||||
<location filename="../../src/Global_Win32.cpp" line="965"/>
|
||||
<source>Executable '%1' requires Qt v%2, but found Qt v%3.</source>
|
||||
<translation>EXE-filen '%1' kräver Qt v%2, du har Qt v%3.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global_Win32.cpp" line="958"/>
|
||||
<location filename="../../src/Global_Win32.cpp" line="970"/>
|
||||
<source>Executable '%1' was built for Qt '%2', but found Qt '%3'.</source>
|
||||
<translation>EXE-filen '%1' är byggd för Qt '%2', du har Qt '%3'.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global_Win32.cpp" line="970"/>
|
||||
<location filename="../../src/Global_Win32.cpp" line="982"/>
|
||||
<source>Executable '%1' requires Windows XP or later.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -3356,7 +3356,7 @@
|
||||
<context>
|
||||
<name>SplashScreen</name>
|
||||
<message>
|
||||
<location filename="../../gui/SplashScreen.ui" line="105"/>
|
||||
<location filename="../../gui/SplashScreen.ui" line="108"/>
|
||||
<source>LameXP is launching...</source>
|
||||
<translation>LameXP startar...</translation>
|
||||
</message>
|
||||
|
@ -2,24 +2,27 @@
|
||||
<ui version="4.0">
|
||||
<class>WorkingBanner</class>
|
||||
<widget class="QDialog" name="WorkingBanner">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>480</width>
|
||||
<height>51</height>
|
||||
<width>512</width>
|
||||
<height>78</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>480</width>
|
||||
<width>512</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>480</width>
|
||||
<height>53</height>
|
||||
<width>512</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="palette">
|
||||
@ -89,31 +92,40 @@
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Working</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<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>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<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">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../res/Images.qrc">:/images/Busy.gif</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<widget class="QLabel" name="labelWorking">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../res/Images.qrc">:/images/Clock.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelStatus">
|
||||
<property name="font">
|
||||
@ -122,6 +134,15 @@
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</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">
|
||||
<string notr="true">$(Status)</string>
|
||||
</property>
|
||||
@ -130,6 +151,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -6,6 +6,7 @@
|
||||
<file>images/Busy.gif</file>
|
||||
<file>images/Cartoon.png</file>
|
||||
<file>images/CD.png</file>
|
||||
<file>images/Clock.png</file>
|
||||
<file>images/Disque.png</file>
|
||||
<file>images/DropBox.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
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
BIN
res/images/Starting.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -35,7 +35,7 @@
|
||||
#define VER_LAMEXP_MINOR_LO 9
|
||||
#define VER_LAMEXP_TYPE Alpha
|
||||
#define VER_LAMEXP_PATCH 8
|
||||
#define VER_LAMEXP_BUILD 1464
|
||||
#define VER_LAMEXP_BUILD 1470
|
||||
#define VER_LAMEXP_CONFG 1348
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <QMovie>
|
||||
#include <QKeyEvent>
|
||||
#include <QFontMetrics>
|
||||
#include <QPainter>
|
||||
|
||||
#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. */
|
||||
#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
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -44,40 +75,35 @@
|
||||
WorkingBanner::WorkingBanner(QWidget *parent)
|
||||
:
|
||||
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
|
||||
setupUi(this);
|
||||
setModal(true);
|
||||
|
||||
//Start animation
|
||||
m_working = new QMovie(":/images/Busy.gif");
|
||||
m_working->setSpeed(50);
|
||||
labelWorking->setMovie(m_working);
|
||||
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);
|
||||
//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->setSpeed(75);
|
||||
m_working->setCacheMode(QMovie::CacheAll);
|
||||
labelWorking->setMovie(m_working);
|
||||
m_working->start();
|
||||
}
|
||||
|
||||
//Set Opacity
|
||||
this->setWindowOpacity(0.9);
|
||||
|
||||
//Set wait cursor
|
||||
setCursor(Qt::WaitCursor);
|
||||
|
||||
//Clear label
|
||||
labelStatus->clear();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -89,11 +115,9 @@ WorkingBanner::~WorkingBanner(void)
|
||||
if(m_working)
|
||||
{
|
||||
m_working->stop();
|
||||
delete m_working;
|
||||
m_working = NULL;
|
||||
LAMEXP_DELETE(m_working);
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(m_progress);
|
||||
LAMEXP_DELETE(m_metrics);
|
||||
}
|
||||
|
||||
@ -104,22 +128,14 @@ WorkingBanner::~WorkingBanner(void)
|
||||
void WorkingBanner::show(const QString &text)
|
||||
{
|
||||
m_canClose = false;
|
||||
m_progressInt = -1;
|
||||
|
||||
QDialog::show();
|
||||
setFixedSize(size());
|
||||
setText(text);
|
||||
|
||||
m_progress->setText(QString());
|
||||
|
||||
QApplication::processEvents();
|
||||
}
|
||||
|
||||
bool WorkingBanner::close(void)
|
||||
{
|
||||
m_canClose = true;
|
||||
emit userAbort();
|
||||
return QDialog::close();
|
||||
//Reset progress
|
||||
progressBar->setMaximum(0);
|
||||
progressBar->setValue(-1);
|
||||
}
|
||||
|
||||
void WorkingBanner::show(const QString &text, QThread *thread)
|
||||
@ -139,12 +155,18 @@ void WorkingBanner::show(const QString &text, QThread *thread)
|
||||
//Start the thread
|
||||
thread->start();
|
||||
|
||||
//Update cursor
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
|
||||
//Loop while thread is still running
|
||||
while(THREAD_RUNNING(thread))
|
||||
{
|
||||
loop->exec();
|
||||
}
|
||||
|
||||
//Restore cursor
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
//Set taskbar state
|
||||
WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarNoState);
|
||||
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::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarIndeterminateState);
|
||||
|
||||
//Update cursor
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
|
||||
//Loop while thread is running
|
||||
loop->exec(QEventLoop::ExcludeUserInputEvents);
|
||||
|
||||
//Restore cursor
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
//Set taskbar state
|
||||
WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarNoState);
|
||||
WinSevenTaskbar::setOverlayIcon(dynamic_cast<QWidget*>(this->parent()), NULL);
|
||||
@ -176,6 +204,13 @@ void WorkingBanner::show(const QString &text, QEventLoop *loop)
|
||||
this->close();
|
||||
}
|
||||
|
||||
bool WorkingBanner::close(void)
|
||||
{
|
||||
m_canClose = true;
|
||||
emit userAbort();
|
||||
return QDialog::close();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// EVENTS
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -217,14 +252,14 @@ void WorkingBanner::setText(const QString &text)
|
||||
m_metrics = new QFontMetrics(labelStatus->font());
|
||||
}
|
||||
|
||||
if(m_metrics->width(text) <= labelStatus->width())
|
||||
if(m_metrics->width(text) <= labelStatus->width() - 8)
|
||||
{
|
||||
labelStatus->setText(text);
|
||||
}
|
||||
else
|
||||
{
|
||||
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 = choppedText.trimmed();
|
||||
@ -232,28 +267,23 @@ void WorkingBanner::setText(const QString &text)
|
||||
}
|
||||
labelStatus->setText(choppedText);
|
||||
}
|
||||
if(this->isVisible())
|
||||
{
|
||||
labelStatus->repaint();
|
||||
}
|
||||
}
|
||||
|
||||
void WorkingBanner::setProgressMax(unsigned int max)
|
||||
{
|
||||
m_progressMax = max;
|
||||
updateProgress();
|
||||
progressBar->setMaximum(max);
|
||||
}
|
||||
|
||||
void WorkingBanner::setProgressVal(unsigned int val)
|
||||
{
|
||||
m_progressVal = val;
|
||||
updateProgress();
|
||||
progressBar->setValue(val);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Private
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
void WorkingBanner::updateProgress(void)
|
||||
{
|
||||
if(m_progressMax > 0)
|
||||
@ -270,3 +300,4 @@ void WorkingBanner::updateProgress(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -43,7 +43,6 @@ public:
|
||||
private:
|
||||
QMovie *m_working;
|
||||
bool m_canClose;
|
||||
void updateProgress(void);
|
||||
|
||||
public slots:
|
||||
void setText(const QString &text);
|
||||
@ -60,9 +59,5 @@ protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
bool winEvent(MSG *message, long *result);
|
||||
|
||||
QLabel *m_progress;
|
||||
QFontMetrics *m_metrics;
|
||||
unsigned int m_progressMax;
|
||||
unsigned int m_progressVal;
|
||||
unsigned int m_progressInt;
|
||||
};
|
||||
|
12
src/Global.h
12
src/Global.h
@ -33,6 +33,7 @@ class QTime;
|
||||
class QIcon;
|
||||
class QWidget;
|
||||
class QProcess;
|
||||
class QColor;
|
||||
class LockedFile;
|
||||
enum QtMsgType;
|
||||
|
||||
@ -125,6 +126,15 @@ typedef enum
|
||||
}
|
||||
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
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -195,8 +205,10 @@ void lamexp_register_tool(const QString &toolName, LockedFile *file, unsigned in
|
||||
bool lamexp_remove_file(const QString &filename);
|
||||
void lamexp_seed_rand(void);
|
||||
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);
|
||||
void lamexp_sleep(const unsigned int delay);
|
||||
QColor lamexp_system_color(const int color_id);
|
||||
const char *lamexp_support_url(void);
|
||||
const QString &lamexp_temp_folder2(void);
|
||||
void lamexp_temp_folder_clear(void);
|
||||
|
@ -174,6 +174,7 @@ static struct
|
||||
{
|
||||
bool bInitialized;
|
||||
QLibrary *dwmapi_dll;
|
||||
HRESULT (__stdcall *dwmIsCompositionEnabled)(BOOL *bEnabled);
|
||||
HRESULT (__stdcall *dwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS* pMarInset);
|
||||
HRESULT (__stdcall *dwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND* pBlurBehind);
|
||||
QReadWriteLock lock;
|
||||
@ -1857,16 +1858,21 @@ bool lamexp_open_media_file(const QString &mediaFilePath)
|
||||
return false;
|
||||
}
|
||||
|
||||
static void lamexp_init_dwmapi(void)
|
||||
static bool lamexp_init_dwmapi(void)
|
||||
{
|
||||
QReadLocker writeLock(&g_lamexp_dwmapi.lock);
|
||||
|
||||
//Not initialized yet?
|
||||
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?
|
||||
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");
|
||||
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.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;
|
||||
return (g_lamexp_dwmapi.dwmIsCompositionEnabled != NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1899,12 +1907,20 @@ bool lamexp_sheet_of_glass(QWidget *window)
|
||||
while(!g_lamexp_dwmapi.bInitialized)
|
||||
{
|
||||
readLock.unlock();
|
||||
lamexp_init_dwmapi();
|
||||
if(!lamexp_init_dwmapi()) return false;
|
||||
readLock.relock();
|
||||
}
|
||||
|
||||
//Required functions available?
|
||||
if((g_lamexp_dwmapi.dwmExtendFrameIntoClientArea == NULL) || (g_lamexp_dwmapi.dwmEnableBlurBehindWindow == NULL))
|
||||
//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.dwmExtendFrameIntoClientArea == NULL) || (g_lamexp_dwmapi.dwmEnableBlurBehindWindow == NULL))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -1929,12 +1945,84 @@ bool lamexp_sheet_of_glass(QWidget *window)
|
||||
}
|
||||
|
||||
//Required for Qt
|
||||
window->setAutoFillBackground(false);
|
||||
window->setAttribute(Qt::WA_TranslucentBackground);
|
||||
window->setAttribute(Qt::WA_NoSystemBackground);
|
||||
|
||||
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
|
||||
*/
|
||||
@ -2009,8 +2097,9 @@ void lamexp_finalization(void)
|
||||
LAMEXP_DELETE(application);
|
||||
|
||||
//Release DWM API
|
||||
g_lamexp_dwmapi.dwmEnableBlurBehindWindow = NULL;
|
||||
g_lamexp_dwmapi.dwmIsCompositionEnabled = NULL;
|
||||
g_lamexp_dwmapi.dwmExtendFrameIntoClientArea = NULL;
|
||||
g_lamexp_dwmapi.dwmEnableBlurBehindWindow = NULL;
|
||||
LAMEXP_DELETE(g_lamexp_dwmapi.dwmapi_dll);
|
||||
|
||||
//Detach from shared memory
|
||||
|
@ -152,8 +152,8 @@ void FileAnalyzer::run()
|
||||
m_timer->invalidate();
|
||||
|
||||
//Update progress
|
||||
emit progressMaxChanged(m_inputFiles.count());
|
||||
emit progressValChanged(0);
|
||||
//emit progressMaxChanged(m_inputFiles.count());
|
||||
//emit progressValChanged(0);
|
||||
|
||||
//Create MediaInfo template file
|
||||
if(!m_templateFile)
|
||||
@ -180,6 +180,7 @@ void FileAnalyzer::run()
|
||||
|
||||
//Update progress
|
||||
emit progressMaxChanged(nFiles);
|
||||
emit progressValChanged(0);
|
||||
|
||||
//Create thread pool
|
||||
if(!m_pool) m_pool = new QThreadPool();
|
||||
|
Loading…
Reference in New Issue
Block a user