diff options
author | Chris Xiong <chirs241097@gmail.com> | 2023-11-09 20:26:54 -0500 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2023-11-09 20:26:54 -0500 |
commit | 382d85b15ce9cc4580a2522b39f5dd4ce43a24b0 (patch) | |
tree | bebf1807cb7221a24b64e04dfab6baeb535b8e14 /qmidiplayer-desktop/qmpplistwindow.cpp | |
parent | 095716fa21071a506605304db6a113f231ff0dcd (diff) | |
download | QMidiPlayer-382d85b15ce9cc4580a2522b39f5dd4ce43a24b0.tar.xz |
Don't use default playlist if started with files in args.
Diffstat (limited to 'qmidiplayer-desktop/qmpplistwindow.cpp')
-rw-r--r-- | qmidiplayer-desktop/qmpplistwindow.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
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(); } |