diff options
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/General/streambrowser/streamwindow.cpp | 16 | ||||
| -rw-r--r-- | src/plugins/General/streambrowser/streamwindow.h | 3 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/plugins/General/streambrowser/streamwindow.cpp b/src/plugins/General/streambrowser/streamwindow.cpp index e5dadd958..c662b5ea0 100644 --- a/src/plugins/General/streambrowser/streamwindow.cpp +++ b/src/plugins/General/streambrowser/streamwindow.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2012-2018 by Ilya Kotov * + * Copyright (C) 2012-2019 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -116,6 +116,8 @@ StreamWindow::StreamWindow(QWidget *parent) QDir dir(Qmmp::configDir()); if(!dir.exists("streambrowser")) dir.mkdir("streambrowser"); + //create initial config + createInitialConfig(); //read cache QFile file(Qmmp::configDir() + "/streambrowser/icecast.xml"); if(file.open(QIODevice::ReadOnly)) @@ -430,3 +432,15 @@ void StreamWindow::readXml(QIODevice *input, QStandardItemModel *model) #endif } } + +void StreamWindow::createInitialConfig() +{ + QString config = Qmmp::configDir() + "/streambrowser/favorites.xml"; + QString defaultConfig = Qmmp::dataPath() + "/favorites.xml.default"; + + if(!QFile::exists(config) && QFile::exists(defaultConfig)) + { + qDebug("StreamWindow: creating initial config"); + QFile::copy(defaultConfig, config); + } +} diff --git a/src/plugins/General/streambrowser/streamwindow.h b/src/plugins/General/streambrowser/streamwindow.h index 58512c9c1..4bdd731a9 100644 --- a/src/plugins/General/streambrowser/streamwindow.h +++ b/src/plugins/General/streambrowser/streamwindow.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2012-2018 by Ilya Kotov * + * Copyright (C) 2012-2019 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -61,6 +61,7 @@ private slots: private: void closeEvent(QCloseEvent *); void readXml(QIODevice *input, QStandardItemModel *model); + void createInitialConfig(); Ui::StreamWindow *m_ui; QNetworkAccessManager *m_http; |
