diff --git a/src/Config.h b/src/Config.h
index 228292da..abcef615 100644
--- a/src/Config.h
+++ b/src/Config.h
@@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 2
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 10
-#define VER_LAMEXP_BUILD 476
+#define VER_LAMEXP_BUILD 480
///////////////////////////////////////////////////////////////////////////////
// Tools versions
diff --git a/src/Dialog_DropBox.cpp b/src/Dialog_DropBox.cpp
index e29d7ea0..0693f50c 100644
--- a/src/Dialog_DropBox.cpp
+++ b/src/Dialog_DropBox.cpp
@@ -103,7 +103,6 @@ void DropBox::changeEvent(QEvent *e)
}
}
-
void DropBox::showEvent(QShowEvent *event)
{
QRect screenGeometry = QApplication::desktop()->availableGeometry();
@@ -122,7 +121,11 @@ void DropBox::showEvent(QShowEvent *event)
QTimer::singleShot(333, this, SLOT(showToolTip()));
}
- m_moving = false;
+ if(m_moving)
+ {
+ QApplication::restoreOverrideCursor();
+ m_moving = false;
+ }
}
void DropBox::keyPressEvent(QKeyEvent *event)
@@ -213,3 +216,20 @@ void DropBox::showToolTip(void)
{
QToolTip::showText(dropBoxLabel->mapToGlobal(dropBoxLabel->pos()), dropBoxLabel->toolTip());
}
+
+bool DropBox::event(QEvent *event)
+{
+ switch(event->type())
+ {
+ case QEvent::Leave:
+ case QEvent::WindowDeactivate:
+ if(m_moving)
+ {
+ QApplication::restoreOverrideCursor();
+ m_moving = false;
+ }
+ break;
+ }
+
+ return QDialog::event(event);
+}
diff --git a/src/Dialog_DropBox.h b/src/Dialog_DropBox.h
index 2fe16db7..f9c97123 100644
--- a/src/Dialog_DropBox.h
+++ b/src/Dialog_DropBox.h
@@ -61,6 +61,7 @@ protected:
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void changeEvent(QEvent *e);
+ bool event(QEvent *event);
public slots:
void modelChanged(void);
diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp
index 0a8c4cdc..66731c0f 100644
--- a/src/Dialog_MainWindow.cpp
+++ b/src/Dialog_MainWindow.cpp
@@ -71,7 +71,6 @@
#define ABORT_IF_BUSY if(m_banner->isVisible() || m_delayedFileTimer->isActive()) { MessageBeep(MB_ICONEXCLAMATION); return; }
#define SET_TEXT_COLOR(WIDGET,COLOR) { QPalette _palette = WIDGET->palette(); _palette.setColor(QPalette::WindowText, COLOR); WIDGET->setPalette(_palette); }
#define SET_FONT_BOLD(WIDGET,BOLD) { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); }
-#define FLASH_WINDOW(WND) { FLASHWINFO flashInfo; memset(&flashInfo, 0, sizeof(FLASHWINFO)); flashInfo.cbSize = sizeof(FLASHWINFO); flashInfo.dwFlags = FLASHW_ALL; flashInfo.uCount = 12; flashInfo.dwTimeout = 125; flashInfo.hwnd = WND->winId(); FlashWindowEx(&flashInfo); }
#define LINK(URL) QString("%2").arg(URL).arg(URL)
#define TEMP_HIDE_DROPBOX(CMD) { bool __dropBoxVisible = m_dropBox->isVisible(); if(__dropBoxVisible) m_dropBox->hide(); CMD; if(__dropBoxVisible) m_dropBox->show(); }
@@ -2474,7 +2473,7 @@ void MainWindow::showDropBoxWidgetActionTriggered(bool checked)
m_dropBox->show();
}
- FLASH_WINDOW(m_dropBox);
+ lamexp_blink_window(m_dropBox);
}
/*
diff --git a/src/Global.cpp b/src/Global.cpp
index 6b62b275..f6ee3dc9 100644
--- a/src/Global.cpp
+++ b/src/Global.cpp
@@ -41,6 +41,8 @@
#include
#include
#include
+#include
+#include
//LameXP includes
#include "Resource.h"
@@ -1380,6 +1382,9 @@ __int64 lamexp_free_diskspace(const QString &path)
}
}
+/*
+ * Shutdown the computer
+ */
bool lamexp_shutdown_computer(const QString &message, const unsigned long timeout, const bool forceShutdown)
{
HANDLE hToken = NULL;
@@ -1404,6 +1409,57 @@ bool lamexp_shutdown_computer(const QString &message, const unsigned long timeou
return false;
}
+/*
+ * Make a window blink (to draw user's attention)
+ */
+void lamexp_blink_window(QWidget *poWindow, unsigned int count, unsigned int delay)
+{
+ static QMutex blinkMutex;
+
+ const double maxOpac = 1.0;
+ const double minOpac = 0.3;
+ const double delOpac = 0.1;
+
+ if(!blinkMutex.tryLock())
+ {
+ qWarning("Blinking is already in progress, skipping!");
+ return;
+ }
+
+ try
+ {
+ const int steps = static_cast(ceil(maxOpac - minOpac) / delOpac);
+ const int sleep = static_cast(floor(static_cast(delay) / static_cast(steps)));
+ const double opacity = poWindow->windowOpacity();
+
+ for(unsigned int i = 0; i < count; i++)
+ {
+ for(double x = maxOpac; x >= minOpac; x -= delOpac)
+ {
+ poWindow->setWindowOpacity(x);
+ QApplication::processEvents();
+ Sleep(sleep);
+ }
+
+ for(double x = minOpac; x <= maxOpac; x += delOpac)
+ {
+ poWindow->setWindowOpacity(x);
+ QApplication::processEvents();
+ Sleep(sleep);
+ }
+ }
+
+ poWindow->setWindowOpacity(opacity);
+ QApplication::processEvents();
+ blinkMutex.unlock();
+ }
+ catch (...)
+ {
+ blinkMutex.unlock();
+ qWarning("Exception error while blinking!");
+ }
+}
+
/*
* Finalization function (final clean-up)
*/
diff --git a/src/Global.h b/src/Global.h
index d8dc75e7..fb510078 100644
--- a/src/Global.h
+++ b/src/Global.h
@@ -36,6 +36,7 @@
class QString;
class QStringList;
class QDate;
+class QWidget;
class LockedFile;
enum QtMsgType;
@@ -115,6 +116,7 @@ QString lamexp_known_folder(lamexp_known_folder_t folder_id);
__int64 lamexp_free_diskspace(const QString &path);
bool lamexp_remove_file(const QString &filename);
bool lamexp_themes_enabled(void);
+void lamexp_blink_window(QWidget *poWindow, unsigned int count = 10, unsigned int delay = 150);
//Debug-only functions
SIZE_T lamexp_dbg_private_bytes(void);