Commit 549b9189 authored by Urs Fleisch's avatar Urs Fleisch
Browse files

Move configuration from Kid3MainWindow to ConfigStore.

parent 4b53933f
......@@ -25,7 +25,7 @@ set(kid3_SRCS filelist.cpp fileproxymodel.cpp frame.cpp framelist.cpp
editframefieldsdialog.cpp playlistdialog.cpp playlistconfig.cpp
playlistcreator.cpp amazonimporter.cpp amazonconfig.cpp
recentfilesmenu.cpp playtoolbar.cpp textimporter.cpp textimportdialog.cpp
trackdatamatcher.cpp tagimportdialog.cpp)
trackdatamatcher.cpp tagimportdialog.cpp configstore.cpp)
if (HAVE_QTDBUS)
set(kid3_SRCS ${kid3_SRCS} scriptinterface.cpp)
......
......@@ -28,7 +28,7 @@
#include <QRegExp>
#include <QDomDocument>
#include "trackdatamodel.h"
#include "kid3mainwindow.h"
#include "configstore.h"
/**
......@@ -77,7 +77,7 @@ const char* AmazonImporter::defaultServer() const { return "www.amazon.com:80";
const char* AmazonImporter::helpAnchor() const { return "import-amazon"; }
/** configuration, 0 if not used */
ServerImporterConfig* AmazonImporter::config() const { return &Kid3MainWindow::s_amazonCfg; }
ServerImporterConfig* AmazonImporter::config() const { return &ConfigStore::s_amazonCfg; }
/** additional tags option, false if not used */
bool AmazonImporter::additionalTags() const { return true; }
......
......@@ -25,10 +25,6 @@
*/
#include "browsecoverartdialog.h"
#include "kid3mainwindow.h"
#include "externalprocess.h"
#include "configtable.h"
#include "configtablemodel.h"
#include <QLayout>
#include <QPushButton>
#include <QTextEdit>
......@@ -39,10 +35,15 @@
#include <QMessageBox>
#include <QRegExp>
#include <QUrl>
#include "qtcompatmac.h"
#include <QGroupBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "configstore.h"
#include "kid3mainwindow.h"
#include "externalprocess.h"
#include "configtable.h"
#include "configtablemodel.h"
#include "qtcompatmac.h"
/**
* Get help text for supported format codes.
......@@ -204,7 +205,7 @@ void BrowseCoverArtDialog::showPreview()
QString txt("<p><b>");
txt += i18n("Click Browse to start");
txt += "</b></p><p><tt>";
txt += Kid3MainWindow::s_miscCfg.m_browser;
txt += ConfigStore::s_miscCfg.m_browser;
txt += " ";
txt += m_url;
txt += "</tt></p><p><b>";
......@@ -234,11 +235,11 @@ void BrowseCoverArtDialog::setFrames(const FrameCollection& frames)
*/
void BrowseCoverArtDialog::setSourceFromConfig()
{
m_urls = Kid3MainWindow::s_genCfg.m_pictureSourceUrls;
m_urls = ConfigStore::s_genCfg.m_pictureSourceUrls;
m_sourceComboBox->clear();
m_sourceComboBox->addItems(Kid3MainWindow::s_genCfg.m_pictureSourceNames);
m_sourceComboBox->setCurrentIndex(Kid3MainWindow::s_genCfg.m_pictureSourceIdx);
setSourceLineEdit(Kid3MainWindow::s_genCfg.m_pictureSourceIdx);
m_sourceComboBox->addItems(ConfigStore::s_genCfg.m_pictureSourceNames);
m_sourceComboBox->setCurrentIndex(ConfigStore::s_genCfg.m_pictureSourceIdx);
setSourceLineEdit(ConfigStore::s_genCfg.m_pictureSourceIdx);
}
/**
......@@ -247,12 +248,12 @@ void BrowseCoverArtDialog::setSourceFromConfig()
void BrowseCoverArtDialog::readConfig()
{
setSourceFromConfig();
m_matchUrlTableModel->setMap(Kid3MainWindow::s_genCfg.m_matchPictureUrlMap);
m_matchUrlTableModel->setMap(ConfigStore::s_genCfg.m_matchPictureUrlMap);
if (Kid3MainWindow::s_genCfg.m_browseCoverArtWindowWidth > 0 &&
Kid3MainWindow::s_genCfg.m_browseCoverArtWindowHeight > 0) {
resize(Kid3MainWindow::s_genCfg.m_browseCoverArtWindowWidth,
Kid3MainWindow::s_genCfg.m_browseCoverArtWindowHeight);
if (ConfigStore::s_genCfg.m_browseCoverArtWindowWidth > 0 &&
ConfigStore::s_genCfg.m_browseCoverArtWindowHeight > 0) {
resize(ConfigStore::s_genCfg.m_browseCoverArtWindowWidth,
ConfigStore::s_genCfg.m_browseCoverArtWindowHeight);
}
}
......@@ -261,22 +262,22 @@ void BrowseCoverArtDialog::readConfig()
*/
void BrowseCoverArtDialog::saveConfig()
{
Kid3MainWindow::s_genCfg.m_pictureSourceIdx = m_sourceComboBox->currentIndex();
if (Kid3MainWindow::s_genCfg.m_pictureSourceIdx <
static_cast<int>(Kid3MainWindow::s_genCfg.m_pictureSourceNames.size())) {
Kid3MainWindow::s_genCfg.m_pictureSourceNames[Kid3MainWindow::s_genCfg.m_pictureSourceIdx] =
ConfigStore::s_genCfg.m_pictureSourceIdx = m_sourceComboBox->currentIndex();
if (ConfigStore::s_genCfg.m_pictureSourceIdx <
static_cast<int>(ConfigStore::s_genCfg.m_pictureSourceNames.size())) {
ConfigStore::s_genCfg.m_pictureSourceNames[ConfigStore::s_genCfg.m_pictureSourceIdx] =
m_sourceComboBox->currentText();
Kid3MainWindow::s_genCfg.m_pictureSourceUrls[Kid3MainWindow::s_genCfg.m_pictureSourceIdx] =
ConfigStore::s_genCfg.m_pictureSourceUrls[ConfigStore::s_genCfg.m_pictureSourceIdx] =
m_urlLineEdit->text();
} else {
Kid3MainWindow::s_genCfg.m_pictureSourceIdx =
Kid3MainWindow::s_genCfg.m_pictureSourceNames.size();
Kid3MainWindow::s_genCfg.m_pictureSourceNames.append(m_sourceComboBox->currentText());
Kid3MainWindow::s_genCfg.m_pictureSourceUrls.append(m_urlLineEdit->text());
ConfigStore::s_genCfg.m_pictureSourceIdx =
ConfigStore::s_genCfg.m_pictureSourceNames.size();
ConfigStore::s_genCfg.m_pictureSourceNames.append(m_sourceComboBox->currentText());
ConfigStore::s_genCfg.m_pictureSourceUrls.append(m_urlLineEdit->text());
}
Kid3MainWindow::s_genCfg.m_matchPictureUrlMap = m_matchUrlTableModel->getMap();
Kid3MainWindow::s_genCfg.m_browseCoverArtWindowWidth = size().width();
Kid3MainWindow::s_genCfg.m_browseCoverArtWindowHeight = size().height();
ConfigStore::s_genCfg.m_matchPictureUrlMap = m_matchUrlTableModel->getMap();
ConfigStore::s_genCfg.m_browseCoverArtWindowWidth = size().width();
ConfigStore::s_genCfg.m_browseCoverArtWindowHeight = size().height();
setSourceFromConfig();
}
......@@ -300,7 +301,7 @@ void BrowseCoverArtDialog::accept()
if (m_process) {
m_process->launchCommand(
i18n("Browse Cover Art"),
QStringList() << Kid3MainWindow::s_miscCfg.m_browser << m_url);
QStringList() << ConfigStore::s_miscCfg.m_browser << m_url);
}
QDialog::accept();
}
......@@ -325,8 +326,8 @@ QString BrowseCoverArtDialog::getImageUrl(const QString& url)
}
else {
for (QMap<QString, QString>::ConstIterator it =
Kid3MainWindow::s_genCfg.m_matchPictureUrlMap.begin();
it != Kid3MainWindow::s_genCfg.m_matchPictureUrlMap.end();
ConfigStore::s_genCfg.m_matchPictureUrlMap.begin();
it != ConfigStore::s_genCfg.m_matchPictureUrlMap.end();
++it) {
QRegExp re(it.key());
if (re.exactMatch(url)) {
......
/**
* \file configstore.cpp
* Configuration storage.
*
* \b Project: Kid3
* \author Urs Fleisch
* \date 09 Jul 2011
*
* Copyright (C) 2011 Urs Fleisch
*
* This file is part of Kid3.
*
* Kid3 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Kid3 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "configstore.h"
#include "config.h"
MiscConfig ConfigStore::s_miscCfg("General Options");
ImportConfig ConfigStore::s_genCfg("General Options");
FormatConfig ConfigStore::s_fnFormatCfg("FilenameFormat");
FormatConfig ConfigStore::s_id3FormatCfg("Id3Format");
FreedbConfig ConfigStore::s_freedbCfg("Freedb");
FreedbConfig ConfigStore::s_trackTypeCfg("TrackType");
DiscogsConfig ConfigStore::s_discogsCfg("Discogs");
AmazonConfig ConfigStore::s_amazonCfg("Amazon");
MusicBrainzConfig ConfigStore::s_musicBrainzCfg("MusicBrainz");
FilterConfig ConfigStore::s_filterCfg("Filter");
PlaylistConfig ConfigStore::s_playlistCfg("Playlist");
/**
* Constructor.
*/
ConfigStore::ConfigStore()
{
#ifdef CONFIG_USE_KDE
m_config = new KConfig;
#else
m_config = new Kid3Settings(QSettings::UserScope, "kid3.sourceforge.net", "Kid3");
m_config->beginGroup("/kid3");
#endif
}
/**
* Destructor.
*/
ConfigStore::~ConfigStore()
{
// m_config is not deleted because this could lead to a crash on Mac OS.
}
/**
* Persist unsaved settings.
*/
void ConfigStore::sync()
{
m_config->sync();
}
/**
* Persist configuration.
*/
void ConfigStore::writeToConfig()
{
s_miscCfg.writeToConfig(m_config);
s_fnFormatCfg.writeToConfig(m_config);
s_id3FormatCfg.writeToConfig(m_config);
s_genCfg.writeToConfig(m_config);
s_freedbCfg.writeToConfig(m_config);
s_trackTypeCfg.writeToConfig(m_config);
s_discogsCfg.writeToConfig(m_config);
s_amazonCfg.writeToConfig(m_config);
s_filterCfg.writeToConfig(m_config);
s_playlistCfg.writeToConfig(m_config);
#ifdef HAVE_TUNEPIMP
s_musicBrainzCfg.writeToConfig(m_config);
#endif
}
/**
* Read persisted configuration.
*/
void ConfigStore::readFromConfig()
{
s_miscCfg.readFromConfig(m_config);
s_fnFormatCfg.readFromConfig(m_config);
s_id3FormatCfg.readFromConfig(m_config);
s_genCfg.readFromConfig(m_config);
s_freedbCfg.readFromConfig(m_config);
s_trackTypeCfg.readFromConfig(m_config);
s_discogsCfg.readFromConfig(m_config);
s_amazonCfg.readFromConfig(m_config);
s_filterCfg.readFromConfig(m_config);
s_playlistCfg.readFromConfig(m_config);
#ifdef HAVE_TUNEPIMP
s_musicBrainzCfg.readFromConfig(m_config);
#endif
}
/**
* \file configstore.h
* Configuration storage.
*
* \b Project: Kid3
* \author Urs Fleisch
* \date 09 Jul 2011
*
* Copyright (C) 2011 Urs Fleisch
*
* This file is part of Kid3.
*
* Kid3 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Kid3 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CONFIGSTORE_H
#define CONFIGSTORE_H
#include "generalconfig.h" // Kid3Settings
#include "formatconfig.h"
#include "importconfig.h"
#include "miscconfig.h"
#include "freedbconfig.h"
#include "discogsconfig.h"
#include "amazonconfig.h"
#include "musicbrainzconfig.h"
#include "filterconfig.h"
#include "playlistconfig.h"
/**
* Configuration storage.
*/
class ConfigStore {
public:
/**
* Constructor.
*/
ConfigStore();
/**
* Destructor.
*/
~ConfigStore();
/**
* Persist unsaved settings.
*/
void sync();
/**
* Persist configuration.
*/
void writeToConfig();
/**
* Read persisted configuration.
*/
void readFromConfig();
/**
* Get settings.
* @return settings.
*/
Kid3Settings* getSettings() const { return m_config; }
/** Filename format configuration */
static FormatConfig s_fnFormatCfg;
/** ID3 format configuration */
static FormatConfig s_id3FormatCfg;
/** Import configuration */
static ImportConfig s_genCfg;
/** Miscellaneous configuration */
static MiscConfig s_miscCfg;
/** Freedb configuration */
static FreedbConfig s_freedbCfg;
/** TrackType configuration */
static FreedbConfig s_trackTypeCfg;
/** Discogs configuration */
static DiscogsConfig s_discogsCfg;
/** Amazon configuration */
static AmazonConfig s_amazonCfg;
/** MusicBrainz configuration */
static MusicBrainzConfig s_musicBrainzCfg;
/** Filter configuration */
static FilterConfig s_filterCfg;
/** Playlist configuration */
static PlaylistConfig s_playlistCfg;
private:
Kid3Settings* m_config;
};
#endif // CONFIGSTORE_H
......@@ -27,7 +27,7 @@
#include "discogsimporter.h"
#include "serverimporterconfig.h"
#include "trackdatamodel.h"
#include "kid3mainwindow.h"
#include "configstore.h"
#include "genres.h"
static const char discogsServer[] = "www.discogs.com:80";
......@@ -62,7 +62,7 @@ QString DiscogsImporter::name() const { return "Discogs"; }
const char* DiscogsImporter::helpAnchor() const { return "import-discogs"; }
/** configuration, 0 if not used */
ServerImporterConfig* DiscogsImporter::config() const { return &Kid3MainWindow::s_discogsCfg; }
ServerImporterConfig* DiscogsImporter::config() const { return &ConfigStore::s_discogsCfg; }
/** additional tags option, false if not used */
bool DiscogsImporter::additionalTags() const { return true; }
......
......@@ -35,6 +35,7 @@
#include "taggedfile.h"
#include "genres.h"
#include "configstore.h"
#include "kid3mainwindow.h"
#include <QLayout>
#include <QPushButton>
......@@ -186,7 +187,7 @@ bool ExportDialog::exportToFile(const QString& fn)
if (!fn.isEmpty()) {
QFile file(fn);
if (file.open(QIODevice::WriteOnly)) {
Kid3MainWindow::s_genCfg.m_importDir = QFileInfo(file).dir().path();
ConfigStore::s_genCfg.m_importDir = QFileInfo(file).dir().path();
QTextStream stream(&file);
stream << m_edit->toPlainText();
file.close();
......@@ -203,10 +204,10 @@ void ExportDialog::slotToFile()
{
QString fileName =
#ifdef CONFIG_USE_KDE
KFileDialog::getSaveFileName(Kid3MainWindow::s_genCfg.m_importDir,
KFileDialog::getSaveFileName(ConfigStore::s_genCfg.m_importDir,
QString::null, this);
#else
QFileDialog::getSaveFileName(this, QString(), Kid3MainWindow::s_genCfg.m_importDir
QFileDialog::getSaveFileName(this, QString(), ConfigStore::s_genCfg.m_importDir
#if !defined Q_OS_WIN32 && !defined Q_OS_MAC
, QString(), 0, QFileDialog::DontUseNativeDialog
#endif
......@@ -296,13 +297,13 @@ void ExportDialog::setExportData(const ImportTrackDataVector& trackDataVector)
*/
void ExportDialog::setFormatFromConfig()
{
m_formatHeaders = Kid3MainWindow::s_genCfg.m_exportFormatHeaders;
m_formatTracks = Kid3MainWindow::s_genCfg.m_exportFormatTracks;
m_formatTrailers = Kid3MainWindow::s_genCfg.m_exportFormatTrailers;
m_formatHeaders = ConfigStore::s_genCfg.m_exportFormatHeaders;
m_formatTracks = ConfigStore::s_genCfg.m_exportFormatTracks;
m_formatTrailers = ConfigStore::s_genCfg.m_exportFormatTrailers;
m_formatComboBox->clear();
m_formatComboBox->addItems(Kid3MainWindow::s_genCfg.m_exportFormatNames);
m_formatComboBox->setCurrentIndex(Kid3MainWindow::s_genCfg.m_exportFormatIdx);
setFormatLineEdit(Kid3MainWindow::s_genCfg.m_exportFormatIdx);
m_formatComboBox->addItems(ConfigStore::s_genCfg.m_exportFormatNames);
m_formatComboBox->setCurrentIndex(ConfigStore::s_genCfg.m_exportFormatIdx);
setFormatLineEdit(ConfigStore::s_genCfg.m_exportFormatIdx);
}
/**
......@@ -310,14 +311,14 @@ void ExportDialog::setFormatFromConfig()
*/
void ExportDialog::readConfig()
{
m_srcComboBox->setCurrentIndex(Kid3MainWindow::s_genCfg.m_exportSrcV1 ? SrcV1 : SrcV2);
m_srcComboBox->setCurrentIndex(ConfigStore::s_genCfg.m_exportSrcV1 ? SrcV1 : SrcV2);
setFormatFromConfig();
if (Kid3MainWindow::s_genCfg.m_exportWindowWidth > 0 &&
Kid3MainWindow::s_genCfg.m_exportWindowHeight > 0) {
resize(Kid3MainWindow::s_genCfg.m_exportWindowWidth,
Kid3MainWindow::s_genCfg.m_exportWindowHeight);
if (ConfigStore::s_genCfg.m_exportWindowWidth > 0 &&
ConfigStore::s_genCfg.m_exportWindowHeight > 0) {
resize(ConfigStore::s_genCfg.m_exportWindowWidth,
ConfigStore::s_genCfg.m_exportWindowHeight);
}
}
......@@ -326,22 +327,22 @@ void ExportDialog::readConfig()
*/
void ExportDialog::saveConfig()
{
Kid3MainWindow::s_genCfg.m_exportSrcV1 = (m_srcComboBox->currentIndex() == SrcV1);
Kid3MainWindow::s_genCfg.m_exportFormatIdx = m_formatComboBox->currentIndex();
if (Kid3MainWindow::s_genCfg.m_exportFormatIdx < static_cast<int>(Kid3MainWindow::s_genCfg.m_exportFormatNames.size())) {
Kid3MainWindow::s_genCfg.m_exportFormatNames[Kid3MainWindow::s_genCfg.m_exportFormatIdx] = m_formatComboBox->currentText();
Kid3MainWindow::s_genCfg.m_exportFormatHeaders[Kid3MainWindow::s_genCfg.m_exportFormatIdx] = m_headerLineEdit->text();
Kid3MainWindow::s_genCfg.m_exportFormatTracks[Kid3MainWindow::s_genCfg.m_exportFormatIdx] = m_trackLineEdit->text();
Kid3MainWindow::s_genCfg.m_exportFormatTrailers[Kid3MainWindow::s_genCfg.m_exportFormatIdx] = m_trailerLineEdit->text();
ConfigStore::s_genCfg.m_exportSrcV1 = (m_srcComboBox->currentIndex() == SrcV1);
ConfigStore::s_genCfg.m_exportFormatIdx = m_formatComboBox->currentIndex();
if (ConfigStore::s_genCfg.m_exportFormatIdx < static_cast<int>(ConfigStore::s_genCfg.m_exportFormatNames.size())) {
ConfigStore::s_genCfg.m_exportFormatNames[ConfigStore::s_genCfg.m_exportFormatIdx] = m_formatComboBox->currentText();
ConfigStore::s_genCfg.m_exportFormatHeaders[ConfigStore::s_genCfg.m_exportFormatIdx] = m_headerLineEdit->text();
ConfigStore::s_genCfg.m_exportFormatTracks[ConfigStore::s_genCfg.m_exportFormatIdx] = m_trackLineEdit->text();
ConfigStore::s_genCfg.m_exportFormatTrailers[ConfigStore::s_genCfg.m_exportFormatIdx] = m_trailerLineEdit->text();
} else {
Kid3MainWindow::s_genCfg.m_exportFormatIdx = Kid3MainWindow::s_genCfg.m_exportFormatNames.size();
Kid3MainWindow::s_genCfg.m_exportFormatNames.append(m_formatComboBox->currentText());
Kid3MainWindow::s_genCfg.m_exportFormatHeaders.append(m_headerLineEdit->text());
Kid3MainWindow::s_genCfg.m_exportFormatTracks.append(m_trackLineEdit->text());
Kid3MainWindow::s_genCfg.m_exportFormatTrailers.append(m_trailerLineEdit->text());
ConfigStore::s_genCfg.m_exportFormatIdx = ConfigStore::s_genCfg.m_exportFormatNames.size();
ConfigStore::s_genCfg.m_exportFormatNames.append(m_formatComboBox->currentText());
ConfigStore::s_genCfg.m_exportFormatHeaders.append(m_headerLineEdit->text());
ConfigStore::s_genCfg.m_exportFormatTracks.append(m_trackLineEdit->text());
ConfigStore::s_genCfg.m_exportFormatTrailers.append(m_trailerLineEdit->text());
}
Kid3MainWindow::s_genCfg.m_exportWindowWidth = size().width();
Kid3MainWindow::s_genCfg.m_exportWindowHeight = size().height();
ConfigStore::s_genCfg.m_exportWindowWidth = size().width();
ConfigStore::s_genCfg.m_exportWindowHeight = size().height();
setFormatFromConfig();
}
......
......@@ -35,6 +35,7 @@
#include "modeliterator.h"
#include "taggedfile.h"
#include "kid3mainwindow.h"
#include "configstore.h"
#include "externalprocess.h"
#include "qtcompatmac.h"
......@@ -166,7 +167,7 @@ QString CommandFormatReplacer::getReplacement(const QString& code) const
}
}
} else if (name == "browser") {
result = Kid3MainWindow::s_miscCfg.m_browser;
result = ConfigStore::s_miscCfg.m_browser;
} else if (name == "url") {
if (!m_files.empty()) {
QUrl url;
......@@ -235,8 +236,8 @@ QString CommandFormatReplacer::getToolTip(bool onlyRows)
* @param parent parent widget
* @param app application widget
*/
FileList::FileList(QWidget* parent, Kid3MainWindow* app) :
QTreeView(parent), m_process(0), m_mainWin(app)
FileList::FileList(QWidget* parent, Kid3MainWindow* mainWin) :
QTreeView(parent), m_process(0), m_mainWin(mainWin)
{
setSelectionMode(ExtendedSelection);
setSortingEnabled(false);
......@@ -404,7 +405,7 @@ void FileList::updateCurrentSelection()
*/
void FileList::contextMenu(const QModelIndex& index, const QPoint& pos)
{
if (index.isValid() && !Kid3MainWindow::s_miscCfg.m_contextMenuCommands.empty()) {
if (index.isValid() && !ConfigStore::s_miscCfg.m_contextMenuCommands.empty()) {
QMenu menu(this);
menu.addAction(i18n("&Expand all"), this, SLOT(expandAll()));
menu.addAction(i18n("&Collapse all"), this, SLOT(collapseAll()));
......@@ -415,8 +416,8 @@ void FileList::contextMenu(const QModelIndex& index, const QPoint& pos)
#endif
int id = 0;
for (QList<MiscConfig::MenuCommand>::const_iterator
it = Kid3MainWindow::s_miscCfg.m_contextMenuCommands.begin();
it != Kid3MainWindow::s_miscCfg.m_contextMenuCommands.end();
it = ConfigStore::s_miscCfg.m_contextMenuCommands.begin();
it != ConfigStore::s_miscCfg.m_contextMenuCommands.end();
++it) {
menu.addAction((*it).getName());
++id;
......@@ -532,9 +533,9 @@ QString FileList::getFormatToolTip(bool onlyRows)
*/
void FileList::executeContextCommand(int id)
{
if (id < static_cast<int>(Kid3MainWindow::s_miscCfg.m_contextMenuCommands.size())) {
if (id < static_cast<int>(ConfigStore::s_miscCfg.m_contextMenuCommands.size())) {
QStringList args;
const MiscConfig::MenuCommand& menuCmd = Kid3MainWindow::s_miscCfg.m_contextMenuCommands[id];
const MiscConfig::MenuCommand& menuCmd = ConfigStore::s_miscCfg.m_contextMenuCommands[id];
QString cmd = menuCmd.getCommand();
int len = cmd.length();
......@@ -590,8 +591,8 @@ void FileList::executeAction(QAction* action)
QString name = action->text().remove('&');
int id = 0;
for (QList<MiscConfig::MenuCommand>::const_iterator
it = Kid3MainWindow::s_miscCfg.m_contextMenuCommands.begin();
it != Kid3MainWindow::s_miscCfg.m_contextMenuCommands.end();
it = ConfigStore::s_miscCfg.m_contextMenuCommands.begin();
it != ConfigStore::s_miscCfg.m_contextMenuCommands.end();
++it) {
if (name == (*it).getName()) {
executeContextCommand(id);
......
......@@ -82,13 +82,7 @@ FilterConfig::~FilterConfig() {}
*
* @param config KDE configuration
*/
void FilterConfig::writeToConfig(
#ifdef CONFIG_USE_KDE
KConfig* config
#else
Kid3Settings* config
#endif
) const
void FilterConfig::writeToConfig(Kid3Settings* config) const
{
#ifdef CONFIG_USE_KDE
KConfigGroup cfg = config->group(m_group);
......@@ -114,13 +108,7 @@ void FilterConfig::writeToConfig(
*
* @param config KDE configuration
*/
void FilterConfig::readFromConfig(
#ifdef CONFIG_USE_KDE
KConfig* config
#else
Kid3Settings* config
#endif
)
void FilterConfig::readFromConfig(Kid3Settings* config)
{
QStringList names, expressions;
#ifdef CONFIG_USE_KDE
......
......@@ -54,26 +54,14 @@ public:
*
* @param config KDE configuration
*/
virtual void writeToConfig(
#ifdef CONFIG_USE_KDE
KConfig* config
#else
Kid3Settings* config
#endif
) const;
virtual void writeToConfig(Kid3Settings* config) const;
/**
* Read persisted configuration.
*
* @param config KDE configuration