internet: Move page creation to internet category class

This consolidates most of the knowledge of internet settings pages in
the internet subdirectory. The exception is the master page enumeration
in the settings dialog.
This commit is contained in:
Jim Broadus 2021-04-01 15:06:19 -07:00 committed by John Maguire
parent 1de6a46e86
commit 3b8519fda3
3 changed files with 87 additions and 78 deletions

View File

@ -17,8 +17,89 @@
#include "internetsettingscategory.h"
#include "internet/digitally/digitallyimportedsettingspage.h"
#include "internet/magnatune/magnatunesettingspage.h"
#include "internet/podcasts/podcastsettingspage.h"
#include "internet/radiobrowser/radiobrowsersettingspage.h"
#include "internet/subsonic/subsonicsettingspage.h"
#include "internetshowsettingspage.h"
#ifdef HAVE_LIBLASTFM
#include "internet/lastfm/lastfmsettingspage.h"
#endif
#ifdef HAVE_GOOGLE_DRIVE
#include "internet/googledrive/googledrivesettingspage.h"
#endif
#ifdef HAVE_DROPBOX
#include "internet/dropbox/dropboxsettingspage.h"
#endif
#ifdef HAVE_BOX
#include "internet/box/boxsettingspage.h"
#endif
#ifdef HAVE_SKYDRIVE
#include "internet/skydrive/skydrivesettingspage.h"
#endif
#ifdef HAVE_SEAFILE
#include "internet/seafile/seafilesettingspage.h"
#endif
#ifdef HAVE_SPOTIFY
#include "internet/spotify/spotifysettingspage.h"
#endif
InternetSettingsCategory::InternetSettingsCategory(SettingsDialog* dialog)
: SettingsCategory(SettingsDialog::Page_InternetShow,
new InternetShowSettingsPage(dialog), dialog) {}
new InternetShowSettingsPage(dialog), dialog) {
AddChildren();
}
void InternetSettingsCategory::AddChildren() {
#ifdef HAVE_LIBLASTFM
AddPage(SettingsDialog::Page_Lastfm, new LastFMSettingsPage(dialog_));
#endif
#ifdef HAVE_GOOGLE_DRIVE
AddPage(SettingsDialog::Page_GoogleDrive,
new GoogleDriveSettingsPage(dialog_));
#endif
#ifdef HAVE_DROPBOX
AddPage(SettingsDialog::Page_Dropbox, new DropboxSettingsPage(dialog_));
#endif
#ifdef HAVE_BOX
AddPage(SettingsDialog::Page_Box, new BoxSettingsPage(dialog_));
#endif
#ifdef HAVE_SKYDRIVE
AddPage(SettingsDialog::Page_Skydrive, new SkydriveSettingsPage(dialog_));
#endif
#ifdef HAVE_SPOTIFY
AddPage(SettingsDialog::Page_Spotify, new SpotifySettingsPage(dialog_));
#endif
#ifdef HAVE_SEAFILE
AddPage(SettingsDialog::Page_Seafile, new SeafileSettingsPage(dialog_));
#endif
#ifdef HAVE_AMAZON_CLOUD_DRIVE
AddPage(SettingsDialog::Page_AmazonCloudDrive,
new AmazonSettingsPage(dialog_));
#endif
AddPage(SettingsDialog::Page_Magnatune, new MagnatuneSettingsPage(dialog_));
AddPage(SettingsDialog::Page_DigitallyImported,
new DigitallyImportedSettingsPage(dialog_));
AddPage(SettingsDialog::Page_Subsonic, new SubsonicSettingsPage(dialog_));
AddPage(SettingsDialog::Page_Podcasts, new PodcastSettingsPage(dialog_));
AddPage(SettingsDialog::Page_RadioBrowser,
new RadioBrowserSettingsPage(dialog_));
sortChildren(0, Qt::AscendingOrder);
}

View File

@ -23,6 +23,9 @@
class InternetSettingsCategory : public SettingsCategory {
public:
InternetSettingsCategory(SettingsDialog* dialog);
private:
void AddChildren();
};
#endif // INTERNETSETTINGSCATEGORY_H

View File

@ -32,11 +32,6 @@
#include "globalshortcutssettingspage.h"
#include "iconloader.h"
#include "internet/core/internetsettingscategory.h"
#include "internet/digitally/digitallyimportedsettingspage.h"
#include "internet/magnatune/magnatunesettingspage.h"
#include "internet/podcasts/podcastsettingspage.h"
#include "internet/radiobrowser/radiobrowsersettingspage.h"
#include "internet/subsonic/subsonicsettingspage.h"
#include "library/librarysettingspage.h"
#include "mainwindow.h"
#include "networkproxysettingspage.h"
@ -51,38 +46,10 @@
#include "widgets/groupediconview.h"
#include "widgets/osdpretty.h"
#ifdef HAVE_LIBLASTFM
#include "internet/lastfm/lastfmsettingspage.h"
#endif
#ifdef HAVE_WIIMOTEDEV
#include "wiimotedev/wiimotesettingspage.h"
#endif
#ifdef HAVE_GOOGLE_DRIVE
#include "internet/googledrive/googledrivesettingspage.h"
#endif
#ifdef HAVE_DROPBOX
#include "internet/dropbox/dropboxsettingspage.h"
#endif
#ifdef HAVE_BOX
#include "internet/box/boxsettingspage.h"
#endif
#ifdef HAVE_SKYDRIVE
#include "internet/skydrive/skydrivesettingspage.h"
#endif
#ifdef HAVE_SEAFILE
#include "internet/seafile/seafilesettingspage.h"
#endif
#ifdef HAVE_SPOTIFY
#include "internet/spotify/spotifysettingspage.h"
#endif
#include <QAbstractButton>
#include <QPainter>
#include <QPushButton>
@ -169,50 +136,8 @@ SettingsDialog::SettingsDialog(Application* app, BackgroundStreams* streams,
SIGNAL(NotificationPreview(OSD::Behaviour, QString, QString)),
SIGNAL(NotificationPreview(OSD::Behaviour, QString, QString)));
// Internet providers
SettingsCategory* providers = new InternetSettingsCategory(this);
AddCategory(providers);
#ifdef HAVE_LIBLASTFM
providers->AddPage(Page_Lastfm, new LastFMSettingsPage(this));
#endif
#ifdef HAVE_GOOGLE_DRIVE
providers->AddPage(Page_GoogleDrive, new GoogleDriveSettingsPage(this));
#endif
#ifdef HAVE_DROPBOX
providers->AddPage(Page_Dropbox, new DropboxSettingsPage(this));
#endif
#ifdef HAVE_BOX
providers->AddPage(Page_Box, new BoxSettingsPage(this));
#endif
#ifdef HAVE_SKYDRIVE
providers->AddPage(Page_Skydrive, new SkydriveSettingsPage(this));
#endif
#ifdef HAVE_SPOTIFY
providers->AddPage(Page_Spotify, new SpotifySettingsPage(this));
#endif
#ifdef HAVE_SEAFILE
providers->AddPage(Page_Seafile, new SeafileSettingsPage(this));
#endif
#ifdef HAVE_AMAZON_CLOUD_DRIVE
providers->AddPage(Page_AmazonCloudDrive, new AmazonSettingsPage(this));
#endif
providers->AddPage(Page_Magnatune, new MagnatuneSettingsPage(this));
providers->AddPage(Page_DigitallyImported,
new DigitallyImportedSettingsPage(this));
providers->AddPage(Page_Subsonic, new SubsonicSettingsPage(this));
providers->AddPage(Page_Podcasts, new PodcastSettingsPage(this));
providers->AddPage(Page_RadioBrowser, new RadioBrowserSettingsPage(this));
providers->sortChildren(0, Qt::AscendingOrder);
// Internet services category
AddCategory(new InternetSettingsCategory(this));
// List box
connect(ui_->list,