From 5ab256d56a484d4b67e961ed21da93091e620d9a Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Fri, 4 Jan 2019 16:13:19 +0000 Subject: feature to create initial configuration git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@8583 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/streambrowser/streamwindow.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/plugins/General/streambrowser/streamwindow.cpp') 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); + } +} -- cgit v1.2.3-13-gbd6f