If no item matches the current filter, hide all items and show an overlay message rather than disabling the filter.

This commit is contained in:
LoRd_MuldeR 2012-11-15 18:06:04 +01:00
parent 7d9cd7ab1a
commit c90a5f4542
4 changed files with 72 additions and 6 deletions

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 7
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 2
#define VER_LAMEXP_BUILD 1183
#define VER_LAMEXP_BUILD 1185
///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!)

View File

@ -63,6 +63,7 @@
#include <QSystemTrayIcon>
#include <QProcess>
#include <QProgressDialog>
#include <QResizeEvent>
#include <QTime>
#include <MMSystem.h>
@ -101,6 +102,15 @@ while(0)
} \
while(0)
#define SET_TEXT_COLOR(WIDGET, COLOR) do \
{ \
QPalette _palette = WIDGET->palette(); \
_palette.setColor(QPalette::WindowText, (COLOR)); \
_palette.setColor(QPalette::Text, (COLOR)); \
WIDGET->setPalette(_palette); \
} \
while(0)
#define UPDATE_MIN_WIDTH(WIDGET) do \
{ \
if(WIDGET->width() > WIDGET->minimumWidth()) WIDGET->setMinimumWidth(WIDGET->width()); \
@ -192,6 +202,19 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel
if(QAction *act = contextMenuFilterAction[4]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(-1); act->setChecked(true); }
}
//Create info label
if(m_filterInfoLabel = new QLabel(view_log))
{
m_filterInfoLabel->setFrameShape(QFrame::NoFrame);
m_filterInfoLabel->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
m_filterInfoLabel->setUserData(0, reinterpret_cast<QObjectUserData*>(-1));
SET_FONT_BOLD(m_filterInfoLabel, true);
SET_TEXT_COLOR(m_filterInfoLabel, Qt::darkGray);
m_filterInfoLabel->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_filterInfoLabel, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
m_filterInfoLabel->hide();
}
//Connect context menu
view_log->setContextMenuPolicy(Qt::CustomContextMenu);
connect(view_log, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
@ -322,6 +345,9 @@ void ProcessingDialog::showEvent(QShowEvent *event)
QTimer::singleShot(1000, this, SLOT(initEncoding()));
m_firstShow = false;
}
//Force update geometry
resizeEvent(NULL);
}
void ProcessingDialog::closeEvent(QCloseEvent *event)
@ -390,6 +416,20 @@ bool ProcessingDialog::event(QEvent *e)
}
}
/*
* Window was resized
*/
void ProcessingDialog::resizeEvent(QResizeEvent *event)
{
if(event) QDialog::resizeEvent(event);
if(QWidget *port = view_log->viewport())
{
QRect geom = port->geometry();
m_filterInfoLabel->setGeometry(geom.left() + 16, geom.top() + 16, geom.width() - 32, geom.height() - 32);
}
}
bool ProcessingDialog::winEvent(MSG *message, long *result)
{
return WinSevenTaskbar::handleWinEvent(message, result);
@ -758,6 +798,9 @@ void ProcessingDialog::contextMenuFilterActionTriggered(void)
}
}
/*
* Filter progress items
*/
void ProcessingDialog::progressViewFilterChanged(void)
{
unsigned int counter = 0;
@ -772,12 +815,27 @@ void ProcessingDialog::progressViewFilterChanged(void)
if((m_progressViewFilter >= 0) && (counter == 0))
{
qWarning("Filter does NOT match on any item, reverting to show all!");
for(int i = 0; i < view_log->model()->rowCount(); i++)
if(m_filterInfoLabel->isHidden() || (m_filterInfoLabel->userData(0) != reinterpret_cast<QObjectUserData*>(m_progressViewFilter)))
{
view_log->setRowHidden(i, false);
QString iconPath;
switch(m_progressViewFilter)
{
case ProgressModel::JobRunning: iconPath = ":/icons/media_play.png"; break;
case ProgressModel::JobComplete: iconPath = ":/icons/tick.png"; break;
case ProgressModel::JobFailed: iconPath = ":/icons/exclamation.png"; break;
case ProgressModel::JobSkipped: iconPath = ":/icons/step_over.png"; break;
default: iconPath = ":/icons/report.png"; break;
}
m_filterInfoLabel->show();
m_filterInfoLabel->setText(QString("&raquo; %1 &laquo;<br><br><img src=\"%2\">").arg(tr("None of the items matches the current filtering rules"), iconPath));
m_filterInfoLabel->setUserData(0, reinterpret_cast<QObjectUserData*>(m_progressViewFilter));
resizeEvent(NULL);
}
}
else if(!m_filterInfoLabel->isHidden())
{
m_filterInfoLabel->hide();
}
}
////////////////////////////////////////////////////////////

View File

@ -79,6 +79,7 @@ protected:
bool eventFilter(QObject *obj, QEvent *event);
virtual bool event(QEvent *e);
virtual bool winEvent(MSG *message, long *result);
virtual void resizeEvent(QResizeEvent *event);
private:
void setCloseButtonEnabled(bool enabled);
@ -98,6 +99,7 @@ private:
QMap<QUuid,QString> m_playList;
QMenu *m_contextMenu;
QActionGroup *m_progressViewFilterGroup;
QLabel *m_filterInfoLabel;
unsigned int m_runningThreads;
unsigned int m_currentFile;
QList<QUuid> m_allJobs;

View File

@ -88,6 +88,10 @@ Q_IMPORT_PLUGIN(QICOPlugin)
#define LAMEXP_ZERO_MEMORY(X) SecureZeroMemory(&X, sizeof(X))
//Helper macros
#define _LAMEXP_MAKE_STR(STR) #STR
#define LAMEXP_MAKE_STR(STR) _LAMEXP_MAKE_STR(STR)
///////////////////////////////////////////////////////////////////////////////
// TYPES
///////////////////////////////////////////////////////////////////////////////
@ -143,8 +147,10 @@ static bool g_lamexp_console_attached = false;
//Compiler detection
//The following code was borrowed from MPC-HC project: http://mpc-hc.sf.net/
#if defined(__INTEL_COMPILER)
#if (__INTEL_COMPILER >= 1200)
static const char *g_lamexp_version_compiler = "ICL 12.x";
#if (__INTEL_COMPILER >= 1300)
static const char *g_lamexp_version_compiler = "ICL 13." LAMEXP_MAKE_STR(__INTEL_COMPILER_BUILD_DATE);
#elif (__INTEL_COMPILER >= 1200)
static const char *g_lamexp_version_compiler = "ICL 12." LAMEXP_MAKE_STR(__INTEL_COMPILER_BUILD_DATE);
#elif (__INTEL_COMPILER >= 1100)
static const char *g_lamexp_version_compiler = "ICL 11.x";
#elif (__INTEL_COMPILER >= 1000)