Try out C++11 strongly typed enums.
This commit is contained in:
parent
c7185efc5e
commit
4e74c7af2b
@ -500,7 +500,7 @@ void GlobalSearchView::FocusOnFilter(QKeyEvent* event) {
|
||||
}
|
||||
|
||||
void GlobalSearchView::OpenSettingsDialog() {
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page_GlobalSearch);
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page::GlobalSearch);
|
||||
}
|
||||
|
||||
void GlobalSearchView::GroupByClicked(QAction* action) {
|
||||
|
@ -86,7 +86,7 @@ bool SearchProviderStatusWidget::eventFilter(QObject* object, QEvent* event) {
|
||||
if (!provider_->IsLoggedIn()) {
|
||||
provider_->ShowConfig();
|
||||
} else {
|
||||
engine_->application()->OpenSettingsDialogAtPage(SettingsDialog::Page_GlobalSearch);
|
||||
engine_->application()->OpenSettingsDialogAtPage(SettingsDialog::Page::GlobalSearch);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -207,7 +207,7 @@ void DigitallyImportedServiceBase::LoadPlaylistFinished(QNetworkReply* reply) {
|
||||
}
|
||||
|
||||
void DigitallyImportedServiceBase::ShowSettingsDialog() {
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page_DigitallyImported);
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page::DigitallyImported);
|
||||
}
|
||||
|
||||
DigitallyImportedClient::ChannelList DigitallyImportedServiceBase::Channels() {
|
||||
|
@ -35,7 +35,7 @@ DropboxService::DropboxService(Application* app, InternetModel* parent)
|
||||
app, parent,
|
||||
kServiceName, kServiceId,
|
||||
QIcon(":/providers/dropbox.png"),
|
||||
SettingsDialog::Page_Dropbox),
|
||||
SettingsDialog::Page::Dropbox),
|
||||
network_(new NetworkAccessManager(this)) {
|
||||
QSettings settings;
|
||||
settings.beginGroup(kSettingsGroup);
|
||||
|
@ -40,7 +40,7 @@ GoogleDriveService::GoogleDriveService(Application* app, InternetModel* parent)
|
||||
app, parent,
|
||||
kServiceName, kServiceId,
|
||||
QIcon(":/providers/googledrive.png"),
|
||||
SettingsDialog::Page_GoogleDrive),
|
||||
SettingsDialog::Page::GoogleDrive),
|
||||
client_(new google_drive::Client(this)),
|
||||
task_manager_(app->task_manager()) {
|
||||
app->player()->RegisterUrlHandler(new GoogleDriveUrlHandler(this, this));
|
||||
|
@ -162,7 +162,7 @@ void GroovesharkService::LazyPopulate(QStandardItem* item) {
|
||||
}
|
||||
|
||||
void GroovesharkService::ShowConfig() {
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page_Grooveshark);
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page::Grooveshark);
|
||||
}
|
||||
|
||||
QWidget* GroovesharkService::HeaderWidget() const {
|
||||
|
@ -160,7 +160,7 @@ void LastFMService::ReloadSettings() {
|
||||
}
|
||||
|
||||
void LastFMService::ShowConfig() {
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page_Lastfm);
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page::Lastfm);
|
||||
}
|
||||
|
||||
bool LastFMService::IsAuthenticated() const {
|
||||
|
@ -334,7 +334,7 @@ QUrl MagnatuneService::ModifyUrl(const QUrl& url) const {
|
||||
}
|
||||
|
||||
void MagnatuneService::ShowConfig() {
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page_Magnatune);
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page::Magnatune);
|
||||
}
|
||||
|
||||
void MagnatuneService::Download() {
|
||||
|
@ -713,7 +713,7 @@ void SpotifyService::SyncPlaylistProgress(
|
||||
}
|
||||
|
||||
void SpotifyService::ShowConfig() {
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page_Spotify);
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page::Spotify);
|
||||
}
|
||||
|
||||
void SpotifyService::Logout() {
|
||||
|
@ -41,7 +41,7 @@ UbuntuOneService::UbuntuOneService(Application* app, InternetModel* parent)
|
||||
app, parent,
|
||||
kServiceName, kServiceId,
|
||||
QIcon(":/providers/ubuntuone.png"),
|
||||
SettingsDialog::Page_UbuntuOne) {
|
||||
SettingsDialog::Page::UbuntuOne) {
|
||||
app_->player()->RegisterUrlHandler(new UbuntuOneUrlHandler(this, this));
|
||||
|
||||
QSettings s;
|
||||
|
@ -222,7 +222,7 @@ void AddPodcastDialog::RemovePodcast() {
|
||||
}
|
||||
|
||||
void AddPodcastDialog::OpenSettingsPage() {
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page_Podcasts);
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page::Podcasts);
|
||||
}
|
||||
|
||||
void AddPodcastDialog::OpenOPMLFile() {
|
||||
|
@ -499,7 +499,7 @@ void PodcastService::DownloadProgressChanged(const PodcastEpisode& episode,
|
||||
}
|
||||
|
||||
void PodcastService::ShowConfig() {
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page_Podcasts);
|
||||
app_->OpenSettingsDialogAtPage(SettingsDialog::Page::Podcasts);
|
||||
}
|
||||
|
||||
void PodcastService::CurrentSongChanged(const Song& metadata) {
|
||||
|
@ -1731,7 +1731,7 @@ void MainWindow::PlaylistUndoRedoChanged(QAction *undo, QAction *redo) {
|
||||
|
||||
void MainWindow::ShowLibraryConfig() {
|
||||
EnsureSettingsDialogCreated();
|
||||
settings_dialog_->OpenAtPage(SettingsDialog::Page_Library);
|
||||
settings_dialog_->OpenAtPage(SettingsDialog::Page::Library);
|
||||
}
|
||||
|
||||
void MainWindow::TaskCountChanged(int count) {
|
||||
@ -2058,7 +2058,7 @@ void MainWindow::AddSongInfoGenerator(smart_playlists::GeneratorPtr gen) {
|
||||
}
|
||||
|
||||
void MainWindow::ShowSongInfoConfig() {
|
||||
OpenSettingsDialogAtPage(SettingsDialog::Page_SongInformation);
|
||||
OpenSettingsDialogAtPage(SettingsDialog::Page::SongInformation);
|
||||
}
|
||||
|
||||
void MainWindow::PlaylistViewSelectionModelChanged() {
|
||||
|
@ -125,58 +125,58 @@ SettingsDialog::SettingsDialog(Application* app, BackgroundStreams* streams, QWi
|
||||
|
||||
QTreeWidgetItem* general = AddCategory(tr("General"));
|
||||
|
||||
AddPage(Page_Playback, new PlaybackSettingsPage(this), general);
|
||||
AddPage(Page_Behaviour, new BehaviourSettingsPage(this), general);
|
||||
AddPage(Page_Library, new LibrarySettingsPage(this), general);
|
||||
AddPage(Page_Proxy, new NetworkProxySettingsPage(this), general);
|
||||
AddPage(Page_Transcoding, new TranscoderSettingsPage(this), general);
|
||||
AddPage(Page::Playback, new PlaybackSettingsPage(this), general);
|
||||
AddPage(Page::Behaviour, new BehaviourSettingsPage(this), general);
|
||||
AddPage(Page::Library, new LibrarySettingsPage(this), general);
|
||||
AddPage(Page::Proxy, new NetworkProxySettingsPage(this), general);
|
||||
AddPage(Page::Transcoding, new TranscoderSettingsPage(this), general);
|
||||
|
||||
#ifdef HAVE_WIIMOTEDEV
|
||||
AddPage(Page_Wiimotedev, new WiimoteSettingsPage(this), general);
|
||||
AddPage(Page::Wiimotedev, new WiimoteSettingsPage(this), general);
|
||||
#endif
|
||||
|
||||
// User interface
|
||||
QTreeWidgetItem* iface = AddCategory(tr("User interface"));
|
||||
AddPage(Page_GlobalShortcuts, new GlobalShortcutsSettingsPage(this), iface);
|
||||
AddPage(Page_GlobalSearch, new GlobalSearchSettingsPage(this), iface);
|
||||
AddPage(Page_Appearance, new AppearanceSettingsPage(this), iface);
|
||||
AddPage(Page_SongInformation, new SongInfoSettingsPage(this), iface);
|
||||
AddPage(Page_Notifications, new NotificationsSettingsPage(this), iface);
|
||||
AddPage(Page::GlobalShortcuts, new GlobalShortcutsSettingsPage(this), iface);
|
||||
AddPage(Page::GlobalSearch, new GlobalSearchSettingsPage(this), iface);
|
||||
AddPage(Page::Appearance, new AppearanceSettingsPage(this), iface);
|
||||
AddPage(Page::SongInformation, new SongInfoSettingsPage(this), iface);
|
||||
AddPage(Page::Notifications, new NotificationsSettingsPage(this), iface);
|
||||
|
||||
// Internet providers
|
||||
QTreeWidgetItem* providers = AddCategory(tr("Internet providers"));
|
||||
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
AddPage(Page_Lastfm, new LastFMSettingsPage(this), providers);
|
||||
AddPage(Page::Lastfm, new LastFMSettingsPage(this), providers);
|
||||
#endif
|
||||
|
||||
AddPage(Page_Grooveshark, new GroovesharkSettingsPage(this), providers);
|
||||
AddPage(Page::Grooveshark, new GroovesharkSettingsPage(this), providers);
|
||||
|
||||
#ifdef HAVE_GOOGLE_DRIVE
|
||||
AddPage(Page_GoogleDrive, new GoogleDriveSettingsPage(this), providers);
|
||||
AddPage(Page::GoogleDrive, new GoogleDriveSettingsPage(this), providers);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UBUNTU_ONE
|
||||
AddPage(Page_UbuntuOne, new UbuntuOneSettingsPage(this), providers);
|
||||
AddPage(Page::UbuntuOne, new UbuntuOneSettingsPage(this), providers);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DROPBOX
|
||||
AddPage(Page_Dropbox, new DropboxSettingsPage(this), providers);
|
||||
AddPage(Page::Dropbox, new DropboxSettingsPage(this), providers);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SPOTIFY
|
||||
AddPage(Page_Spotify, new SpotifySettingsPage(this), providers);
|
||||
AddPage(Page::Spotify, new SpotifySettingsPage(this), providers);
|
||||
#endif
|
||||
|
||||
AddPage(Page_Magnatune, new MagnatuneSettingsPage(this), providers);
|
||||
AddPage(Page_DigitallyImported, new DigitallyImportedSettingsPage(this), providers);
|
||||
AddPage(Page_BackgroundStreams, new BackgroundStreamsSettingsPage(this), providers);
|
||||
AddPage(Page_Podcasts, new PodcastSettingsPage(this), providers);
|
||||
AddPage(Page::Magnatune, new MagnatuneSettingsPage(this), providers);
|
||||
AddPage(Page::DigitallyImported, new DigitallyImportedSettingsPage(this), providers);
|
||||
AddPage(Page::BackgroundStreams, new BackgroundStreamsSettingsPage(this), providers);
|
||||
AddPage(Page::Podcasts, new PodcastSettingsPage(this), providers);
|
||||
|
||||
// List box
|
||||
connect(ui_->list, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
|
||||
SLOT(CurrentItemChanged(QTreeWidgetItem*)));
|
||||
ui_->list->setCurrentItem(pages_[Page_Playback].item_);
|
||||
ui_->list->setCurrentItem(pages_[Page::Playback].item_);
|
||||
|
||||
// Make sure the list is big enough to show all the items
|
||||
ui_->list->setMinimumWidth(static_cast<QAbstractItemView*>(ui_->list)->sizeHintForColumn(0));
|
||||
|
@ -56,29 +56,29 @@ public:
|
||||
SettingsDialog(Application* app, BackgroundStreams* streams, QWidget* parent = 0);
|
||||
~SettingsDialog();
|
||||
|
||||
enum Page {
|
||||
Page_Playback,
|
||||
Page_Behaviour,
|
||||
Page_SongInformation,
|
||||
Page_GlobalShortcuts,
|
||||
Page_GlobalSearch,
|
||||
Page_Appearance,
|
||||
Page_Notifications,
|
||||
Page_Library,
|
||||
Page_Lastfm,
|
||||
Page_Grooveshark,
|
||||
Page_Spotify,
|
||||
Page_Magnatune,
|
||||
Page_DigitallyImported,
|
||||
Page_BackgroundStreams,
|
||||
Page_Proxy,
|
||||
Page_Transcoding,
|
||||
Page_Remote,
|
||||
Page_Wiimotedev,
|
||||
Page_Podcasts,
|
||||
Page_GoogleDrive,
|
||||
Page_UbuntuOne,
|
||||
Page_Dropbox,
|
||||
enum class Page {
|
||||
Playback,
|
||||
Behaviour,
|
||||
SongInformation,
|
||||
GlobalShortcuts,
|
||||
GlobalSearch,
|
||||
Appearance,
|
||||
Notifications,
|
||||
Library,
|
||||
Lastfm,
|
||||
Grooveshark,
|
||||
Spotify,
|
||||
Magnatune,
|
||||
DigitallyImported,
|
||||
BackgroundStreams,
|
||||
Proxy,
|
||||
Transcoding,
|
||||
Remote,
|
||||
Wiimotedev,
|
||||
Podcasts,
|
||||
GoogleDrive,
|
||||
UbuntuOne,
|
||||
Dropbox,
|
||||
};
|
||||
|
||||
enum Role {
|
||||
|
Loading…
x
Reference in New Issue
Block a user