Implemented menubar corner widget.
This commit is contained in:
parent
7ec2a8d9d7
commit
62aa72d283
@ -50,6 +50,7 @@
|
|||||||
<file>icons/drive_link.png</file>
|
<file>icons/drive_link.png</file>
|
||||||
<file>icons/drive_network.png</file>
|
<file>icons/drive_network.png</file>
|
||||||
<file>icons/exclamation.png</file>
|
<file>icons/exclamation.png</file>
|
||||||
|
<file>icons/exclamation_small.png</file>
|
||||||
<file>icons/error.png</file>
|
<file>icons/error.png</file>
|
||||||
<file>icons/error_big.png</file>
|
<file>icons/error_big.png</file>
|
||||||
<file>icons/feed.png</file>
|
<file>icons/feed.png</file>
|
||||||
|
BIN
res/icons/exclamation_small.png
Normal file
BIN
res/icons/exclamation_small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 415 B |
@ -35,7 +35,7 @@
|
|||||||
#define VER_LAMEXP_MINOR_LO 0
|
#define VER_LAMEXP_MINOR_LO 0
|
||||||
#define VER_LAMEXP_TYPE Beta
|
#define VER_LAMEXP_TYPE Beta
|
||||||
#define VER_LAMEXP_PATCH 1
|
#define VER_LAMEXP_PATCH 1
|
||||||
#define VER_LAMEXP_BUILD 1542
|
#define VER_LAMEXP_BUILD 1543
|
||||||
#define VER_LAMEXP_CONFG 1528
|
#define VER_LAMEXP_CONFG 1528
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -198,6 +198,15 @@ while(0)
|
|||||||
} \
|
} \
|
||||||
while(0)
|
while(0)
|
||||||
|
|
||||||
|
#define SHOW_CORNER_WIDGET(FLAG) do \
|
||||||
|
{ \
|
||||||
|
if(QWidget *cornerWidget = ui->menubar->cornerWidget()) \
|
||||||
|
{ \
|
||||||
|
cornerWidget->setVisible((FLAG)); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
while(0)
|
||||||
|
|
||||||
#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(QString(URL).replace("-", "−"))
|
#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(QString(URL).replace("-", "−"))
|
||||||
#define FSLINK(PATH) QString("<a href=\"file:///%1\">%2</a>").arg(PATH).arg(QString(PATH).replace("-", "−"))
|
#define FSLINK(PATH) QString("<a href=\"file:///%1\">%2</a>").arg(PATH).arg(QString(PATH).replace("-", "−"))
|
||||||
#define CENTER_CURRENT_OUTPUT_FOLDER_DELAYED QTimer::singleShot(125, this, SLOT(centerOutputFolderModel()))
|
#define CENTER_CURRENT_OUTPUT_FOLDER_DELAYED QTimer::singleShot(125, this, SLOT(centerOutputFolderModel()))
|
||||||
@ -247,6 +256,17 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel_MetaInfo *me
|
|||||||
//Add system menu
|
//Add system menu
|
||||||
lamexp_append_sysmenu(this, IDM_ABOUTBOX, "About...");
|
lamexp_append_sysmenu(this, IDM_ABOUTBOX, "About...");
|
||||||
|
|
||||||
|
//Setup corner widget
|
||||||
|
QLabel *cornerWidget = new QLabel(ui->menubar);
|
||||||
|
m_evenFilterCornerWidget = new CustomEventFilter;
|
||||||
|
cornerWidget->setText(QString("<nobr><img src=\":/icons/exclamation_small.png\"> <b style=\"color:darkred\">%1</b> </nobr>").arg(tr("Check for Updates")));
|
||||||
|
cornerWidget->setFixedHeight(ui->menubar->height());
|
||||||
|
cornerWidget->setCursor(QCursor(Qt::PointingHandCursor));
|
||||||
|
cornerWidget->hide();
|
||||||
|
cornerWidget->installEventFilter(m_evenFilterCornerWidget);
|
||||||
|
connect(m_evenFilterCornerWidget, SIGNAL(eventOccurred(QWidget*, QEvent*)), this, SLOT(cornerWidgetEventOccurred(QWidget*, QEvent*)));
|
||||||
|
ui->menubar->setCornerWidget(cornerWidget);
|
||||||
|
|
||||||
//--------------------------------
|
//--------------------------------
|
||||||
// Setup "Source" tab
|
// Setup "Source" tab
|
||||||
//--------------------------------
|
//--------------------------------
|
||||||
@ -268,6 +288,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel_MetaInfo *me
|
|||||||
m_exportCsvContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/table_save.png"), "N/A");
|
m_exportCsvContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/table_save.png"), "N/A");
|
||||||
m_importCsvContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/folder_table.png"), "N/A");
|
m_importCsvContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/folder_table.png"), "N/A");
|
||||||
SET_FONT_BOLD(m_showDetailsContextAction, true);
|
SET_FONT_BOLD(m_showDetailsContextAction, true);
|
||||||
|
|
||||||
connect(ui->buttonAddFiles, SIGNAL(clicked()), this, SLOT(addFilesButtonClicked()));
|
connect(ui->buttonAddFiles, SIGNAL(clicked()), this, SLOT(addFilesButtonClicked()));
|
||||||
connect(ui->buttonRemoveFile, SIGNAL(clicked()), this, SLOT(removeFileButtonClicked()));
|
connect(ui->buttonRemoveFile, SIGNAL(clicked()), this, SLOT(removeFileButtonClicked()));
|
||||||
connect(ui->buttonClearFiles, SIGNAL(clicked()), this, SLOT(clearFilesButtonClicked()));
|
connect(ui->buttonClearFiles, SIGNAL(clicked()), this, SLOT(clearFilesButtonClicked()));
|
||||||
@ -714,6 +735,7 @@ MainWindow::~MainWindow(void)
|
|||||||
LAMEXP_DELETE(m_outputFolderFavoritesMenu);
|
LAMEXP_DELETE(m_outputFolderFavoritesMenu);
|
||||||
LAMEXP_DELETE(m_outputFolderContextMenu);
|
LAMEXP_DELETE(m_outputFolderContextMenu);
|
||||||
LAMEXP_DELETE(m_dropBox);
|
LAMEXP_DELETE(m_dropBox);
|
||||||
|
LAMEXP_DELETE(m_evenFilterCornerWidget);
|
||||||
LAMEXP_DELETE(m_evenFilterCustumParamsHelp);
|
LAMEXP_DELETE(m_evenFilterCustumParamsHelp);
|
||||||
LAMEXP_DELETE(m_evenFilterOutputFolderMouse);
|
LAMEXP_DELETE(m_evenFilterOutputFolderMouse);
|
||||||
LAMEXP_DELETE(m_evenFilterOutputFolderView);
|
LAMEXP_DELETE(m_evenFilterOutputFolderView);
|
||||||
@ -864,6 +886,7 @@ bool MainWindow::checkForUpdates(void)
|
|||||||
|
|
||||||
if(updateDialog->getSuccess())
|
if(updateDialog->getSuccess())
|
||||||
{
|
{
|
||||||
|
SHOW_CORNER_WIDGET(false);
|
||||||
m_settings->autoUpdateLastCheck(QDate::currentDate().toString(Qt::ISODate));
|
m_settings->autoUpdateLastCheck(QDate::currentDate().toString(Qt::ISODate));
|
||||||
bReadyToInstall = updateDialog->updateReadyToInstall();
|
bReadyToInstall = updateDialog->updateReadyToInstall();
|
||||||
}
|
}
|
||||||
@ -1331,6 +1354,7 @@ void MainWindow::windowShown(void)
|
|||||||
if(lamexp_current_date_safe() >= lamexp_version_date().addYears(1))
|
if(lamexp_current_date_safe() >= lamexp_version_date().addYears(1))
|
||||||
{
|
{
|
||||||
qWarning("Binary is more than a year old, time to update!");
|
qWarning("Binary is more than a year old, time to update!");
|
||||||
|
SHOW_CORNER_WIDGET(true);
|
||||||
int ret = QMessageBox::warning(this, tr("Urgent Update"), NOBR(tr("Your version of LameXP is more than a year old. Time for an update!")), tr("Check for Updates"), tr("Exit Program"), tr("Ignore"));
|
int ret = QMessageBox::warning(this, tr("Urgent Update"), NOBR(tr("Your version of LameXP is more than a year old. Time for an update!")), tr("Check for Updates"), tr("Exit Program"), tr("Ignore"));
|
||||||
switch(ret)
|
switch(ret)
|
||||||
{
|
{
|
||||||
@ -1351,10 +1375,13 @@ void MainWindow::windowShown(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(m_settings->autoUpdateEnabled())
|
else
|
||||||
{
|
{
|
||||||
QDate lastUpdateCheck = QDate::fromString(m_settings->autoUpdateLastCheck(), Qt::ISODate);
|
QDate lastUpdateCheck = QDate::fromString(m_settings->autoUpdateLastCheck(), Qt::ISODate);
|
||||||
if(!firstRun && (!lastUpdateCheck.isValid() || lamexp_current_date_safe() >= lastUpdateCheck.addDays(14)))
|
if((!firstRun) && ((!lastUpdateCheck.isValid()) || (lamexp_current_date_safe() >= lastUpdateCheck.addDays(14))))
|
||||||
|
{
|
||||||
|
SHOW_CORNER_WIDGET(true);
|
||||||
|
if(m_settings->autoUpdateEnabled())
|
||||||
{
|
{
|
||||||
if(QMessageBox::information(this, tr("Update Reminder"), NOBR(lastUpdateCheck.isValid() ? tr("Your last update check was more than 14 days ago. Check for updates now?") : tr("Your did not check for LameXP updates yet. Check for updates now?")), tr("Check for Updates"), tr("Postpone")) == 0)
|
if(QMessageBox::information(this, tr("Update Reminder"), NOBR(lastUpdateCheck.isValid() ? tr("Your last update check was more than 14 days ago. Check for updates now?") : tr("Your did not check for LameXP updates yet. Check for updates now?")), tr("Check for Updates"), tr("Postpone")) == 0)
|
||||||
{
|
{
|
||||||
@ -1366,6 +1393,7 @@ void MainWindow::windowShown(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Check for AAC support
|
//Check for AAC support
|
||||||
const int aacEncoder = EncoderRegistry::getAacEncoder();
|
const int aacEncoder = EncoderRegistry::getAacEncoder();
|
||||||
@ -1727,6 +1755,21 @@ void MainWindow::tabActionActivated(QAction *action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =========================================================
|
||||||
|
// Menubar slots
|
||||||
|
// =========================================================
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Handle corner widget Event
|
||||||
|
*/
|
||||||
|
void MainWindow::cornerWidgetEventOccurred(QWidget *sender, QEvent *event)
|
||||||
|
{
|
||||||
|
if(event->type() == QEvent::MouseButtonPress)
|
||||||
|
{
|
||||||
|
QTimer::singleShot(0, this, SLOT(checkUpdatesActionActivated()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// =========================================================
|
// =========================================================
|
||||||
// View menu slots
|
// View menu slots
|
||||||
// =========================================================
|
// =========================================================
|
||||||
|
@ -85,6 +85,7 @@ private slots:
|
|||||||
void clearMetaButtonClicked(void);
|
void clearMetaButtonClicked(void);
|
||||||
void closeButtonClicked(void);
|
void closeButtonClicked(void);
|
||||||
void compressionTabEventOccurred(QWidget*, QEvent*);
|
void compressionTabEventOccurred(QWidget*, QEvent*);
|
||||||
|
void cornerWidgetEventOccurred(QWidget *sender, QEvent *event);
|
||||||
void customParamsChanged(void);
|
void customParamsChanged(void);
|
||||||
void customParamsHelpRequested(QWidget *obj, QEvent *event);
|
void customParamsHelpRequested(QWidget *obj, QEvent *event);
|
||||||
void customTempFolderChanged(const QString &text);
|
void customTempFolderChanged(const QString &text);
|
||||||
@ -231,6 +232,7 @@ private:
|
|||||||
QButtonGroup *m_modeButtonGroup;
|
QButtonGroup *m_modeButtonGroup;
|
||||||
QButtonGroup *m_overwriteButtonGroup;
|
QButtonGroup *m_overwriteButtonGroup;
|
||||||
|
|
||||||
|
CustomEventFilter *m_evenFilterCornerWidget;
|
||||||
CustomEventFilter *m_evenFilterCustumParamsHelp;
|
CustomEventFilter *m_evenFilterCustumParamsHelp;
|
||||||
CustomEventFilter *m_evenFilterOutputFolderMouse;
|
CustomEventFilter *m_evenFilterOutputFolderMouse;
|
||||||
CustomEventFilter *m_evenFilterOutputFolderView;
|
CustomEventFilter *m_evenFilterOutputFolderView;
|
||||||
|
@ -152,6 +152,7 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, const AudioFile
|
|||||||
m_ramObserver(NULL),
|
m_ramObserver(NULL),
|
||||||
m_progressViewFilter(-1),
|
m_progressViewFilter(-1),
|
||||||
m_initThreads(0),
|
m_initThreads(0),
|
||||||
|
m_defaultColor(new QColor()),
|
||||||
m_firstShow(true)
|
m_firstShow(true)
|
||||||
{
|
{
|
||||||
//Init the dialog, from the .ui file
|
//Init the dialog, from the .ui file
|
||||||
@ -348,6 +349,7 @@ ProcessingDialog::~ProcessingDialog(void)
|
|||||||
LAMEXP_DELETE(m_contextMenu);
|
LAMEXP_DELETE(m_contextMenu);
|
||||||
LAMEXP_DELETE(m_progressModel);
|
LAMEXP_DELETE(m_progressModel);
|
||||||
LAMEXP_DELETE(m_threadPool);
|
LAMEXP_DELETE(m_threadPool);
|
||||||
|
LAMEXP_DELETE(m_defaultColor);
|
||||||
|
|
||||||
WinSevenTaskbar::setOverlayIcon(this, NULL);
|
WinSevenTaskbar::setOverlayIcon(this, NULL);
|
||||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNoState);
|
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNoState);
|
||||||
@ -407,21 +409,19 @@ void ProcessingDialog::closeEvent(QCloseEvent *event)
|
|||||||
|
|
||||||
bool ProcessingDialog::eventFilter(QObject *obj, QEvent *event)
|
bool ProcessingDialog::eventFilter(QObject *obj, QEvent *event)
|
||||||
{
|
{
|
||||||
static QColor defaultColor = QColor();
|
|
||||||
|
|
||||||
if(obj == ui->label_versionInfo)
|
if(obj == ui->label_versionInfo)
|
||||||
{
|
{
|
||||||
if(event->type() == QEvent::Enter)
|
if(event->type() == QEvent::Enter)
|
||||||
{
|
{
|
||||||
QPalette palette = ui->label_versionInfo->palette();
|
QPalette palette = ui->label_versionInfo->palette();
|
||||||
defaultColor = palette.color(QPalette::Normal, QPalette::WindowText);
|
*m_defaultColor = palette.color(QPalette::Normal, QPalette::WindowText);
|
||||||
palette.setColor(QPalette::Normal, QPalette::WindowText, Qt::red);
|
palette.setColor(QPalette::Normal, QPalette::WindowText, Qt::red);
|
||||||
ui->label_versionInfo->setPalette(palette);
|
ui->label_versionInfo->setPalette(palette);
|
||||||
}
|
}
|
||||||
else if(event->type() == QEvent::Leave)
|
else if(event->type() == QEvent::Leave)
|
||||||
{
|
{
|
||||||
QPalette palette = ui->label_versionInfo->palette();
|
QPalette palette = ui->label_versionInfo->palette();
|
||||||
palette.setColor(QPalette::Normal, QPalette::WindowText, defaultColor);
|
palette.setColor(QPalette::Normal, QPalette::WindowText, *m_defaultColor);
|
||||||
ui->label_versionInfo->setPalette(palette);
|
ui->label_versionInfo->setPalette(palette);
|
||||||
}
|
}
|
||||||
else if(event->type() == QEvent::MouseButtonPress)
|
else if(event->type() == QEvent::MouseButtonPress)
|
||||||
|
@ -136,4 +136,5 @@ private:
|
|||||||
DiskObserverThread *m_diskObserver;
|
DiskObserverThread *m_diskObserver;
|
||||||
qint64 m_timerStart;
|
qint64 m_timerStart;
|
||||||
int m_progressViewFilter;
|
int m_progressViewFilter;
|
||||||
|
QColor *m_defaultColor;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user