aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.cpp5
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.hpp1
-rw-r--r--qmidiplayer-desktop/qmpplistwindow.cpp11
3 files changed, 12 insertions, 5 deletions
diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp
index a0a4539..cc498cb 100644
--- a/qmidiplayer-desktop/qmpmainwindow.cpp
+++ b/qmidiplayer-desktop/qmpmainwindow.cpp
@@ -223,6 +223,11 @@ int qmpMainWindow::parseArgs()
return 0;
}
+bool qmpMainWindow::startedWithFiles()
+{
+ return !argfiles.empty();
+}
+
void qmpMainWindow::closeEvent(QCloseEvent *event)
{
if (settings->getOptionBool("Behavior/DialogStatus"))
diff --git a/qmidiplayer-desktop/qmpmainwindow.hpp b/qmidiplayer-desktop/qmpmainwindow.hpp
index eb36ba8..99886ba 100644
--- a/qmidiplayer-desktop/qmpmainwindow.hpp
+++ b/qmidiplayer-desktop/qmpmainwindow.hpp
@@ -230,6 +230,7 @@ public:
void playerSeek(uint32_t percentage);
PlaybackStatus getPlaybackStatus();
int parseArgs();
+ bool startedWithFiles();
void registerFunctionality(qmpFuncBaseIntf *i, std::string name, std::string desc, const char *icon, int iconlen, bool checkable);
void unregisterFunctionality(std::string name);
int registerUIHook(std::string e, ICallBack *callback, void *userdat);
diff --git a/qmidiplayer-desktop/qmpplistwindow.cpp b/qmidiplayer-desktop/qmpplistwindow.cpp
index aa708ae..b67f4e6 100644
--- a/qmidiplayer-desktop/qmpplistwindow.cpp
+++ b/qmidiplayer-desktop/qmpplistwindow.cpp
@@ -29,7 +29,7 @@ qmpPlistWindow::qmpPlistWindow(QWidget *parent):
repeat = 0;
shuffle = 0;
settings = qmpMainWindow::getInstance()->getSettings();
- if (settings->getOptionBool("Behavior/RestorePlaylist"))
+ if (settings->getOptionBool("Behavior/RestorePlaylist") && !qmpMainWindow::getInstance()->startedWithFiles())
{
QSettings *plist = new QSettings(QStandardPaths::writableLocation(QStandardPaths::StandardLocation::ConfigLocation) + QString("/qmpplist"),
QSettings::IniFormat);
@@ -116,14 +116,15 @@ void qmpPlistWindow::closeEvent(QCloseEvent *event)
settings->setOptionRaw("DialogStatus/PListW", geometry());
}
setVisible(false);
- if (!qmpMainWindow::getInstance()->isFinalizing())
+ auto mw = qmpMainWindow::getInstance();
+ if (!mw->isFinalizing())
while (ui->lwFiles->count() > 1)
delete ui->lwFiles->item(0);
- if (!qmpMainWindow::getInstance()->isFinalizing() && settings->getOptionBool("Behavior/DialogStatus"))
+ if (!mw->isFinalizing() && settings->getOptionBool("Behavior/DialogStatus"))
{
settings->setOptionRaw("DialogStatus/PListWShown", 0);
}
- if (qmpMainWindow::getInstance()->isFinalizing() && settings->getOptionBool("Behavior/RestorePlaylist"))
+ if (mw->isFinalizing() && settings->getOptionBool("Behavior/RestorePlaylist") && !mw->startedWithFiles())
{
QSettings *plist = new QSettings(QStandardPaths::writableLocation(QStandardPaths::StandardLocation::ConfigLocation) + QString("/qmpplist"),
QSettings::IniFormat);
@@ -135,7 +136,7 @@ void qmpPlistWindow::closeEvent(QCloseEvent *event)
plist->sync();
delete plist;
}
- qmpMainWindow::getInstance()->setFuncState("Playlist", false);
+ mw->setFuncState("Playlist", false);
event->accept();
}