aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/General/library/library.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2021-01-16 19:03:33 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2021-01-16 19:03:33 +0000
commit7d9b7792aeb3db45e235f923061254de96d37e04 (patch)
tree745157293cdfb97f2de6892be4f2bdd95ac7e025 /src/plugins/General/library/library.cpp
parent4762863d93e56b9d4766e65a0247c8811b4c6756 (diff)
downloadqmmp-7d9b7792aeb3db45e235f923061254de96d37e04.tar.gz
qmmp-7d9b7792aeb3db45e235f923061254de96d37e04.tar.bz2
qmmp-7d9b7792aeb3db45e235f923061254de96d37e04.zip
library: added window mode (#147)
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9646 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/General/library/library.cpp')
-rw-r--r--src/plugins/General/library/library.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/plugins/General/library/library.cpp b/src/plugins/General/library/library.cpp
index adcf2eb7a..fe3da9bd4 100644
--- a/src/plugins/General/library/library.cpp
+++ b/src/plugins/General/library/library.cpp
@@ -63,9 +63,15 @@ Library::Library(QPointer<LibraryWidget> *libraryWidget, QObject *parent) :
QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
m_dirs = settings.value("Library/dirs").toStringList();
- QAction *action = new QAction(QIcon::fromTheme("view-refresh"), tr("Update library"), this);
- UiHelper::instance()->addAction(action, UiHelper::TOOLS_MENU);
- connect(action, SIGNAL(triggered()), SLOT(startDirectoryScanning()));
+ m_showAction = new QAction(QIcon::fromTheme("text-x-generic"), tr("Library"), this);
+ UiHelper::instance()->addAction(m_showAction, UiHelper::TOOLS_MENU);
+ connect(m_showAction, SIGNAL(triggered()), SLOT(showLibraryWindow()));
+ if(!m_libraryWidget->isNull() && !m_libraryWidget->data()->isWindow())
+ m_showAction->setVisible(false);
+
+ QAction *refreshAction = new QAction(QIcon::fromTheme("view-refresh"), tr("Update library"), this);
+ UiHelper::instance()->addAction(refreshAction, UiHelper::TOOLS_MENU);
+ connect(refreshAction, SIGNAL(triggered()), SLOT(startDirectoryScanning()));
connect(&m_watcher, &QFutureWatcher<bool>::finished, [=] {
if(!m_libraryWidget->isNull())
@@ -96,12 +102,18 @@ bool Library::isRunning() const
return m_future.isRunning();
}
+QAction *Library::showAction() const
+{
+ return m_showAction;
+}
+
void Library::showLibraryWindow()
{
- /*if(!m_historyWindow)
- m_historyWindow = new HistoryWindow(QSqlDatabase::database(CONNECTION_NAME), qApp->activeWindow());
- m_historyWindow->show();
- m_historyWindow->activateWindow();*/
+ if(m_libraryWidget->isNull())
+ *m_libraryWidget = new LibraryWidget(true, qApp->activeWindow());
+
+ if(m_libraryWidget->data()->isWindow())
+ m_libraryWidget->data()->show();
}
void Library::startDirectoryScanning()