Move all the settings pages to their own widgets and classes
This commit is contained in:
parent
50824cafe9
commit
dad76b78dd
@ -115,9 +115,9 @@ set(SOURCES
|
||||
engines/gstenginepipeline.cpp
|
||||
engines/gstelementdeleter.cpp
|
||||
|
||||
internet/digitallyimportedconfig.cpp
|
||||
internet/digitallyimportedservice.cpp
|
||||
internet/digitallyimportedservicebase.cpp
|
||||
internet/digitallyimportedsettingspage.cpp
|
||||
internet/digitallyimportedurlhandler.cpp
|
||||
internet/icecastbackend.cpp
|
||||
internet/icecastfilterwidget.cpp
|
||||
@ -131,9 +131,9 @@ set(SOURCES
|
||||
internet/jamendodynamicplaylist.cpp
|
||||
internet/jamendoplaylistitem.cpp
|
||||
internet/jamendoservice.cpp
|
||||
internet/magnatuneconfig.cpp
|
||||
internet/magnatunedownloaddialog.cpp
|
||||
internet/magnatuneplaylistitem.cpp
|
||||
internet/magnatunesettingspage.cpp
|
||||
internet/magnatuneservice.cpp
|
||||
internet/magnatuneurlhandler.cpp
|
||||
internet/savedradio.cpp
|
||||
@ -144,12 +144,12 @@ set(SOURCES
|
||||
library/groupbydialog.cpp
|
||||
library/library.cpp
|
||||
library/librarybackend.cpp
|
||||
library/libraryconfig.cpp
|
||||
library/librarydirectorymodel.cpp
|
||||
library/libraryfilterwidget.cpp
|
||||
library/librarymodel.cpp
|
||||
library/libraryplaylistitem.cpp
|
||||
library/libraryquery.cpp
|
||||
library/librarysettingspage.cpp
|
||||
library/libraryview.cpp
|
||||
library/libraryviewcontainer.cpp
|
||||
library/librarywatcher.cpp
|
||||
@ -209,10 +209,10 @@ set(SOURCES
|
||||
songinfo/collapsibleinfopane.cpp
|
||||
songinfo/echonestbiographies.cpp
|
||||
songinfo/echonestimages.cpp
|
||||
songinfo/lyricsettings.cpp
|
||||
songinfo/songinfobase.cpp
|
||||
songinfo/songinfofetcher.cpp
|
||||
songinfo/songinfoprovider.cpp
|
||||
songinfo/songinfosettingspage.cpp
|
||||
songinfo/songinfotextview.cpp
|
||||
songinfo/songinfoview.cpp
|
||||
songinfo/songplaystats.cpp
|
||||
@ -228,6 +228,7 @@ set(SOURCES
|
||||
transcoder/transcoderoptionsspeex.cpp
|
||||
transcoder/transcoderoptionsvorbis.cpp
|
||||
transcoder/transcoderoptionswma.cpp
|
||||
transcoder/transcodersettingspage.cpp
|
||||
|
||||
ui/about.cpp
|
||||
ui/addstreamdialog.cpp
|
||||
@ -235,19 +236,25 @@ set(SOURCES
|
||||
ui/albumcovermanager.cpp
|
||||
ui/albumcovermanagerlist.cpp
|
||||
ui/albumcoversearcher.cpp
|
||||
ui/backgroundstreamssettingspage.cpp
|
||||
ui/behavioursettingspage.cpp
|
||||
ui/coverfromurldialog.cpp
|
||||
ui/edittagdialog.cpp
|
||||
ui/equalizer.cpp
|
||||
ui/flowlayout.cpp
|
||||
ui/globalshortcutgrabber.cpp
|
||||
ui/globalshortcutsconfig.cpp
|
||||
ui/globalshortcutssettingspage.cpp
|
||||
ui/iconloader.cpp
|
||||
ui/mainwindow.cpp
|
||||
ui/networkproxysettingspage.cpp
|
||||
ui/notificationssettingspage.cpp
|
||||
ui/organisedialog.cpp
|
||||
ui/organiseerrordialog.cpp
|
||||
ui/playbacksettingspage.cpp
|
||||
ui/qtsystemtrayicon.cpp
|
||||
ui/screensaver.cpp
|
||||
ui/settingsdialog.cpp
|
||||
ui/settingspage.cpp
|
||||
ui/systemtrayicon.cpp
|
||||
ui/trackselectiondialog.cpp
|
||||
ui/windows7thumbbar.cpp
|
||||
@ -339,8 +346,8 @@ set(HEADERS
|
||||
engines/gstenginepipeline.h
|
||||
engines/gstelementdeleter.h
|
||||
|
||||
internet/digitallyimportedconfig.h
|
||||
internet/digitallyimportedservicebase.h
|
||||
internet/digitallyimportedsettingspage.h
|
||||
internet/icecastbackend.h
|
||||
internet/icecastfilterwidget.h
|
||||
internet/icecastmodel.h
|
||||
@ -352,8 +359,8 @@ set(HEADERS
|
||||
internet/internetviewcontainer.h
|
||||
internet/jamendodynamicplaylist.h
|
||||
internet/jamendoservice.h
|
||||
internet/magnatuneconfig.h
|
||||
internet/magnatunedownloaddialog.h
|
||||
internet/magnatunesettingspage.h
|
||||
internet/magnatuneservice.h
|
||||
internet/savedradio.h
|
||||
internet/skyfmservice.h
|
||||
@ -363,10 +370,10 @@ set(HEADERS
|
||||
library/groupbydialog.h
|
||||
library/library.h
|
||||
library/librarybackend.h
|
||||
library/libraryconfig.h
|
||||
library/librarydirectorymodel.h
|
||||
library/libraryfilterwidget.h
|
||||
library/librarymodel.h
|
||||
library/librarysettingspage.h
|
||||
library/libraryview.h
|
||||
library/libraryviewcontainer.h
|
||||
library/librarywatcher.h
|
||||
@ -419,10 +426,10 @@ set(HEADERS
|
||||
songinfo/collapsibleinfopane.h
|
||||
songinfo/echonestbiographies.h
|
||||
songinfo/echonestimages.h
|
||||
songinfo/lyricsettings.h
|
||||
songinfo/songinfobase.h
|
||||
songinfo/songinfofetcher.h
|
||||
songinfo/songinfoprovider.h
|
||||
songinfo/songinfosettingspage.h
|
||||
songinfo/songinfotextview.h
|
||||
songinfo/songinfoview.h
|
||||
songinfo/songplaystats.h
|
||||
@ -433,6 +440,7 @@ set(HEADERS
|
||||
transcoder/transcoder.h
|
||||
transcoder/transcoderoptionsdialog.h
|
||||
transcoder/transcoderoptionsmp3.h
|
||||
transcoder/transcodersettingspage.h
|
||||
|
||||
ui/about.h
|
||||
ui/addstreamdialog.h
|
||||
@ -440,16 +448,22 @@ set(HEADERS
|
||||
ui/albumcovermanager.h
|
||||
ui/albumcovermanagerlist.h
|
||||
ui/albumcoversearcher.h
|
||||
ui/backgroundstreamssettingspage.h
|
||||
ui/behavioursettingspage.h
|
||||
ui/coverfromurldialog.h
|
||||
ui/edittagdialog.h
|
||||
ui/equalizer.h
|
||||
ui/globalshortcutgrabber.h
|
||||
ui/globalshortcutsconfig.h
|
||||
ui/globalshortcutssettingspage.h
|
||||
ui/mainwindow.h
|
||||
ui/networkproxysettingspage.h
|
||||
ui/notificationssettingspage.h
|
||||
ui/organisedialog.h
|
||||
ui/organiseerrordialog.h
|
||||
ui/playbacksettingspage.h
|
||||
ui/qtsystemtrayicon.h
|
||||
ui/settingsdialog.h
|
||||
ui/settingspage.h
|
||||
ui/systemtrayicon.h
|
||||
ui/trackselectiondialog.h
|
||||
ui/windows7thumbbar.h
|
||||
@ -492,16 +506,15 @@ set(UI
|
||||
|
||||
devices/deviceproperties.ui
|
||||
|
||||
internet/digitallyimportedconfig.ui
|
||||
internet/digitallyimportedsettingspage.ui
|
||||
internet/icecastfilterwidget.ui
|
||||
internet/magnatuneconfig.ui
|
||||
internet/magnatunedownloaddialog.ui
|
||||
internet/magnatunesettingspage.ui
|
||||
internet/internetviewcontainer.ui
|
||||
internet/spotifyconfig.ui
|
||||
|
||||
library/groupbydialog.ui
|
||||
library/libraryconfig.ui
|
||||
library/libraryfilterwidget.ui
|
||||
library/librarysettingspage.ui
|
||||
library/libraryviewcontainer.ui
|
||||
|
||||
playlist/dynamicplaylistcontrols.ui
|
||||
@ -509,7 +522,7 @@ set(UI
|
||||
playlist/playlistsequence.ui
|
||||
playlist/queuemanager.ui
|
||||
|
||||
remote/remoteconfig.ui
|
||||
remote/remotesettingspage.ui
|
||||
|
||||
smartplaylists/querysearchpage.ui
|
||||
smartplaylists/querysortpage.ui
|
||||
@ -517,7 +530,7 @@ set(UI
|
||||
smartplaylists/searchtermwidget.ui
|
||||
smartplaylists/wizardfinishpage.ui
|
||||
|
||||
songinfo/lyricsettings.ui
|
||||
songinfo/songinfosettingspage.ui
|
||||
|
||||
transcoder/transcodedialog.ui
|
||||
transcoder/transcodelogdialog.ui
|
||||
@ -528,29 +541,36 @@ set(UI
|
||||
transcoder/transcoderoptionsspeex.ui
|
||||
transcoder/transcoderoptionsvorbis.ui
|
||||
transcoder/transcoderoptionswma.ui
|
||||
transcoder/transcodersettingspage.ui
|
||||
|
||||
ui/about.ui
|
||||
ui/addstreamdialog.ui
|
||||
ui/albumcovermanager.ui
|
||||
ui/albumcoversearcher.ui
|
||||
ui/backgroundstreamssettingspage.ui
|
||||
ui/behavioursettingspage.ui
|
||||
ui/coverfromurldialog.ui
|
||||
ui/edittagdialog.ui
|
||||
ui/equalizer.ui
|
||||
ui/globalshortcutgrabber.ui
|
||||
ui/globalshortcutsconfig.ui
|
||||
ui/globalshortcutssettingspage.ui
|
||||
ui/mainwindow.ui
|
||||
ui/networkproxysettingspage.ui
|
||||
ui/notificationssettingspage.ui
|
||||
ui/organisedialog.ui
|
||||
ui/organiseerrordialog.ui
|
||||
ui/playbacksettingspage.ui
|
||||
ui/settingsdialog.ui
|
||||
ui/trackselectiondialog.ui
|
||||
ui/wiimotedevshortcutsconfig.ui
|
||||
ui/wiimotedevshortcutgrabber.ui
|
||||
|
||||
widgets/equalizerslider.ui
|
||||
widgets/errordialog.ui
|
||||
widgets/fileview.ui
|
||||
widgets/osdpretty.ui
|
||||
widgets/trackslider.ui
|
||||
|
||||
wiimotedev/wiimotesettingspage.ui
|
||||
wiimotedev/wiimoteshortcutgrabber.ui
|
||||
)
|
||||
|
||||
set(RESOURCES
|
||||
@ -604,8 +624,8 @@ if(HAVE_LIBLASTFM)
|
||||
list(APPEND SOURCES
|
||||
covers/lastfmcoverprovider.cpp
|
||||
internet/fixlastfm.cpp
|
||||
internet/lastfmconfig.cpp
|
||||
internet/lastfmservice.cpp
|
||||
internet/lastfmsettingspage.cpp
|
||||
internet/lastfmstationdialog.cpp
|
||||
internet/lastfmurlhandler.cpp
|
||||
songinfo/echonestsimilarartists.cpp
|
||||
@ -616,8 +636,8 @@ if(HAVE_LIBLASTFM)
|
||||
)
|
||||
list(APPEND HEADERS
|
||||
covers/lastfmcoverprovider.h
|
||||
internet/lastfmconfig.h
|
||||
internet/lastfmservice.h
|
||||
internet/lastfmsettingspage.h
|
||||
internet/lastfmstationdialog.h
|
||||
songinfo/echonestsimilarartists.h
|
||||
songinfo/echonesttags.h
|
||||
@ -626,7 +646,7 @@ if(HAVE_LIBLASTFM)
|
||||
suggesters/lastfmsuggester.h
|
||||
)
|
||||
list(APPEND UI
|
||||
internet/lastfmconfig.ui
|
||||
internet/lastfmsettingspage.ui
|
||||
internet/lastfmstationdialog.ui
|
||||
)
|
||||
endif(HAVE_LIBLASTFM)
|
||||
@ -634,22 +654,22 @@ endif(HAVE_LIBLASTFM)
|
||||
if(HAVE_SPOTIFY)
|
||||
list(APPEND SOURCES
|
||||
internet/spotifyblobdownloader.cpp
|
||||
internet/spotifyconfig.cpp
|
||||
internet/spotifysearchplaylisttype.cpp
|
||||
internet/spotifyserver.cpp
|
||||
internet/spotifyservice.cpp
|
||||
internet/spotifysearchplaylisttype.cpp
|
||||
internet/spotifysettingspage.cpp
|
||||
internet/spotifyurlhandler.cpp
|
||||
resolvers/spotifyresolver.cpp
|
||||
)
|
||||
list(APPEND HEADERS
|
||||
internet/spotifyblobdownloader.h
|
||||
internet/spotifyconfig.h
|
||||
internet/spotifyserver.h
|
||||
internet/spotifyservice.h
|
||||
internet/spotifysettingspage.h
|
||||
resolvers/spotifyresolver.h
|
||||
)
|
||||
list(APPEND UI
|
||||
internet/spotifyconfig.ui)
|
||||
internet/spotifysettingspage.ui)
|
||||
endif(HAVE_SPOTIFY)
|
||||
|
||||
if(APPLE)
|
||||
@ -735,15 +755,16 @@ if(HAVE_DBUS)
|
||||
dbus/org.wiimotedev.deviceEvents.xml
|
||||
dbus/wiimotedev)
|
||||
|
||||
list(APPEND SOURCES wiimotedev/shortcuts.cpp)
|
||||
list(APPEND HEADERS wiimotedev/shortcuts.h)
|
||||
|
||||
list(APPEND SOURCES ui/wiimotedevshortcutgrabber.cpp)
|
||||
list(APPEND HEADERS ui/wiimotedevshortcutgrabber.h)
|
||||
|
||||
|
||||
list(APPEND SOURCES ui/wiimotedevshortcutsconfig.cpp)
|
||||
list(APPEND HEADERS ui/wiimotedevshortcutsconfig.h)
|
||||
list(APPEND SOURCES
|
||||
wiimotedev/shortcuts.cpp
|
||||
wiimotedev/wiimotesettingspage.cpp
|
||||
wiimotedev/wiimoteshortcutgrabber.cpp
|
||||
)
|
||||
list(APPEND HEADERS
|
||||
wiimotedev/shortcuts.h
|
||||
wiimotedev/wiimotesettingspage.h
|
||||
wiimotedev/wiimoteshortcutgrabber.h
|
||||
)
|
||||
endif(ENABLE_WIIMOTEDEV)
|
||||
|
||||
# DeviceKit lister source
|
||||
@ -837,14 +858,14 @@ if(HAVE_REMOTE)
|
||||
remote/icesession.h
|
||||
remote/portforwarder.h
|
||||
remote/remote.h
|
||||
remote/remoteconfig.h
|
||||
remote/remotesettingspage.h
|
||||
remote/streampipeline.h
|
||||
)
|
||||
list(APPEND SOURCES
|
||||
remote/icesession.cpp
|
||||
remote/portforwarder.h
|
||||
remote/remote.cpp
|
||||
remote/remoteconfig.cpp
|
||||
remote/remotesettingspage.cpp
|
||||
remote/streampipeline.cpp
|
||||
)
|
||||
endif(HAVE_REMOTE)
|
||||
@ -901,9 +922,9 @@ list(APPEND OTHER_SOURCES
|
||||
devices/wmdmloader.cpp
|
||||
internet/spotifyblobdownloader.cpp
|
||||
internet/spotifyblobdownloader.h
|
||||
internet/spotifyconfig.cpp
|
||||
internet/spotifyconfig.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ui_spotifyconfig.h
|
||||
internet/spotifysettingspage.cpp
|
||||
internet/spotifysettingspage.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ui_spotifysettingspage.h
|
||||
internet/spotifysearchplaylisttype.cpp
|
||||
internet/spotifysearchplaylisttype.h
|
||||
internet/spotifyserver.cpp
|
||||
@ -914,19 +935,19 @@ list(APPEND OTHER_SOURCES
|
||||
internet/spotifyurlhandler.h
|
||||
remote/remote.cpp
|
||||
remote/remote.h
|
||||
remote/remoteconfig.cpp
|
||||
remote/remoteconfig.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ui_remoteconfig.h
|
||||
remote/remotesettingspage.cpp
|
||||
remote/remotesettingspage.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ui_remotesettingspage.h
|
||||
suggesters/lastfmsuggester.cpp
|
||||
suggesters/lastfmsuggester.h
|
||||
ui/macsystemtrayicon.h
|
||||
ui/macsystemtrayicon.mm
|
||||
ui/wiimotedevshortcutsconfig.cpp
|
||||
ui/wiimotedevshortcutsconfig.h
|
||||
ui/wiimotedevshortcutgrabber.cpp
|
||||
ui/wiimotedevshortcutgrabber.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ui_wiimotedevshortcutsconfig.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ui_wiimotedevshortcutgrabber.h
|
||||
wiimotedev/wiimotesettingspage.cpp
|
||||
wiimotedev/wiimotesettingspage.h
|
||||
wiimotedev/wiimoteshortcutgrabber.cpp
|
||||
wiimotedev/wiimoteshortcutgrabber.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ui_wiimotesettingspage.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ui_wiimoteshortcutgrabber.h
|
||||
widgets/osd_mac.mm
|
||||
widgets/osd_win.cpp
|
||||
widgets/osd_x11.cpp
|
||||
|
@ -15,25 +15,26 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "digitallyimportedconfig.h"
|
||||
#include "digitallyimportedservicebase.h"
|
||||
#include "ui_digitallyimportedconfig.h"
|
||||
#include "digitallyimportedsettingspage.h"
|
||||
#include "ui_digitallyimportedsettingspage.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
|
||||
DigitallyImportedConfig::DigitallyImportedConfig(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
ui_(new Ui_DigitallyImportedConfig)
|
||||
DigitallyImportedSettingsPage::DigitallyImportedSettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog),
|
||||
ui_(new Ui_DigitallyImportedSettingsPage)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
setWindowIcon(QIcon(":/providers/digitallyimported-32.png"));
|
||||
}
|
||||
|
||||
DigitallyImportedConfig::~DigitallyImportedConfig() {
|
||||
DigitallyImportedSettingsPage::~DigitallyImportedSettingsPage() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void DigitallyImportedConfig::Load() {
|
||||
void DigitallyImportedSettingsPage::Load() {
|
||||
QSettings s;
|
||||
s.beginGroup(DigitallyImportedServiceBase::kSettingsGroup);
|
||||
|
||||
@ -42,7 +43,7 @@ void DigitallyImportedConfig::Load() {
|
||||
ui_->password->setText(s.value("password").toString());
|
||||
}
|
||||
|
||||
void DigitallyImportedConfig::Save() {
|
||||
void DigitallyImportedSettingsPage::Save() {
|
||||
QSettings s;
|
||||
s.beginGroup(DigitallyImportedServiceBase::kSettingsGroup);
|
||||
|
39
src/internet/digitallyimportedsettingspage.h
Normal file
39
src/internet/digitallyimportedsettingspage.h
Normal file
@ -0,0 +1,39 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DIGITALLYIMPORTEDSETTINGSPAGE_H
|
||||
#define DIGITALLYIMPORTEDSETTINGSPAGE_H
|
||||
|
||||
#include "ui/settingspage.h"
|
||||
|
||||
class Ui_DigitallyImportedSettingsPage;
|
||||
|
||||
class DigitallyImportedSettingsPage : public SettingsPage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DigitallyImportedSettingsPage(SettingsDialog* dialog);
|
||||
~DigitallyImportedSettingsPage();
|
||||
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
private:
|
||||
Ui_DigitallyImportedSettingsPage* ui_;
|
||||
};
|
||||
|
||||
#endif // DIGITALLYIMPORTEDSETTINGSPAGE_H
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DigitallyImportedConfig</class>
|
||||
<widget class="QWidget" name="DigitallyImportedConfig">
|
||||
<class>DigitallyImportedSettingsPage</class>
|
||||
<widget class="QWidget" name="DigitallyImportedSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string>Digitally Imported</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
@ -15,10 +15,10 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "lastfmconfig.h"
|
||||
#include "lastfmsettingspage.h"
|
||||
#include "lastfmservice.h"
|
||||
#include "internetmodel.h"
|
||||
#include "ui_lastfmconfig.h"
|
||||
#include "ui_lastfmsettingspage.h"
|
||||
#include "ui/iconloader.h"
|
||||
|
||||
#include <lastfm/ws.h>
|
||||
@ -32,10 +32,10 @@ const char* kSubscribedIcon = "task-complete";
|
||||
const char* kNotSubscribedIcon = "dialog-warning";
|
||||
const char* kWaitingIcon = ":spinner.gif";
|
||||
|
||||
LastFMConfig::LastFMConfig(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
LastFMSettingsPage::LastFMSettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog),
|
||||
service_(static_cast<LastFMService*>(InternetModel::ServiceByName("Last.fm"))),
|
||||
ui_(new Ui_LastFMConfig),
|
||||
ui_(new Ui_LastFMSettingsPage),
|
||||
loading_icon_(new QMovie(kWaitingIcon, QByteArray(), this)),
|
||||
waiting_for_auth_(false)
|
||||
{
|
||||
@ -43,6 +43,7 @@ LastFMConfig::LastFMConfig(QWidget *parent)
|
||||
ui_->busy->hide();
|
||||
|
||||
// Icons
|
||||
setWindowIcon(QIcon(":/last.fm/as.png"));
|
||||
ui_->sign_out->setIcon(IconLoader::Load("list-remove"));
|
||||
ui_->warn_icon->setPixmap(IconLoader::Load("dialog-warning").pixmap(16));
|
||||
ui_->warn_icon->setMinimumSize(16, 16);
|
||||
@ -50,28 +51,24 @@ LastFMConfig::LastFMConfig(QWidget *parent)
|
||||
connect(service_, SIGNAL(AuthenticationComplete(bool)), SLOT(AuthenticationComplete(bool)));
|
||||
connect(service_, SIGNAL(UpdatedSubscriberStatus(bool)), SLOT(UpdatedSubscriberStatus(bool)));
|
||||
connect(ui_->sign_out, SIGNAL(clicked()), SLOT(SignOut()));
|
||||
connect(ui_->login, SIGNAL(clicked()), SLOT(Validate()));
|
||||
connect(ui_->login, SIGNAL(clicked()), SLOT(Login()));
|
||||
|
||||
ui_->username->setMinimumWidth(QFontMetrics(QFont()).width("WWWWWWWWWWWW"));
|
||||
resize(sizeHint());
|
||||
}
|
||||
|
||||
LastFMConfig::~LastFMConfig() {
|
||||
LastFMSettingsPage::~LastFMSettingsPage() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
bool LastFMConfig::NeedsValidation() const {
|
||||
return !ui_->username->text().isEmpty() && !ui_->password->text().isEmpty();
|
||||
}
|
||||
|
||||
void LastFMConfig::Validate() {
|
||||
void LastFMSettingsPage::Login() {
|
||||
ui_->busy->show();
|
||||
waiting_for_auth_ = true;
|
||||
|
||||
service_->Authenticate(ui_->username->text(), ui_->password->text());
|
||||
}
|
||||
|
||||
void LastFMConfig::AuthenticationComplete(bool success) {
|
||||
void LastFMSettingsPage::AuthenticationComplete(bool success) {
|
||||
if (!waiting_for_auth_)
|
||||
return; // Wasn't us that was waiting for auth
|
||||
|
||||
@ -91,7 +88,7 @@ void LastFMConfig::AuthenticationComplete(bool success) {
|
||||
service_->UpdateSubscriberStatus();
|
||||
}
|
||||
|
||||
void LastFMConfig::Load() {
|
||||
void LastFMSettingsPage::Load() {
|
||||
ui_->scrobble->setChecked(service_->IsScrobblingEnabled());
|
||||
ui_->love_ban_->setChecked(service_->AreButtonsVisible());
|
||||
ui_->scrobble_button->setChecked(service_->IsScrobbleButtonVisible());
|
||||
@ -105,7 +102,7 @@ void LastFMConfig::Load() {
|
||||
RefreshControls(service_->IsAuthenticated());
|
||||
}
|
||||
|
||||
void LastFMConfig::UpdatedSubscriberStatus(bool is_subscriber) {
|
||||
void LastFMSettingsPage::UpdatedSubscriberStatus(bool is_subscriber) {
|
||||
const char* icon_path = is_subscriber ? kSubscribedIcon : kNotSubscribedIcon;
|
||||
ui_->icon->setPixmap(IconLoader::Load(icon_path).pixmap(16));
|
||||
loading_icon_->stop();
|
||||
@ -127,7 +124,7 @@ void LastFMConfig::UpdatedSubscriberStatus(bool is_subscriber) {
|
||||
}
|
||||
}
|
||||
|
||||
void LastFMConfig::Save() {
|
||||
void LastFMSettingsPage::Save() {
|
||||
QSettings s;
|
||||
s.beginGroup(LastFMService::kSettingsGroup);
|
||||
s.setValue("ScrobblingEnabled", ui_->scrobble->isChecked());
|
||||
@ -138,7 +135,7 @@ void LastFMConfig::Save() {
|
||||
service_->ReloadSettings();
|
||||
}
|
||||
|
||||
void LastFMConfig::SignOut() {
|
||||
void LastFMSettingsPage::SignOut() {
|
||||
ui_->username->clear();
|
||||
ui_->password->clear();
|
||||
RefreshControls(false);
|
||||
@ -146,7 +143,7 @@ void LastFMConfig::SignOut() {
|
||||
service_->SignOut();
|
||||
}
|
||||
|
||||
void LastFMConfig::RefreshControls(bool authenticated) {
|
||||
void LastFMSettingsPage::RefreshControls(bool authenticated) {
|
||||
ui_->groupBox->setVisible(!authenticated);
|
||||
ui_->sign_out->setVisible(authenticated);
|
||||
if (authenticated) {
|
@ -15,39 +15,33 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LASTFMCONFIG_H
|
||||
#define LASTFMCONFIG_H
|
||||
#ifndef LASTFMSETTINGSPAGE_H
|
||||
#define LASTFMSETTINGSPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui/settingspage.h"
|
||||
|
||||
class LastFMService;
|
||||
class Ui_LastFMConfig;
|
||||
class Ui_LastFMSettingsPage;
|
||||
|
||||
class LastFMConfig : public QWidget {
|
||||
class LastFMSettingsPage : public SettingsPage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LastFMConfig(QWidget* parent = 0);
|
||||
~LastFMConfig();
|
||||
public:
|
||||
LastFMSettingsPage(SettingsDialog* dialog);
|
||||
~LastFMSettingsPage();
|
||||
|
||||
bool NeedsValidation() const;
|
||||
|
||||
public slots:
|
||||
void Validate();
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
signals:
|
||||
void ValidationComplete(bool success);
|
||||
|
||||
private slots:
|
||||
private slots:
|
||||
void Login();
|
||||
void AuthenticationComplete(bool success);
|
||||
void SignOut();
|
||||
void UpdatedSubscriberStatus(bool is_subscriber);
|
||||
|
||||
private:
|
||||
private:
|
||||
LastFMService* service_;
|
||||
Ui_LastFMConfig* ui_;
|
||||
Ui_LastFMSettingsPage* ui_;
|
||||
QMovie* loading_icon_;
|
||||
|
||||
bool waiting_for_auth_;
|
||||
@ -55,4 +49,4 @@ class LastFMConfig : public QWidget {
|
||||
void RefreshControls(bool authenticated);
|
||||
};
|
||||
|
||||
#endif // LASTFMCONFIG_H
|
||||
#endif // LASTFMSETTINGSPAGE_H
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LastFMConfig</class>
|
||||
<widget class="QWidget" name="LastFMConfig">
|
||||
<class>LastFMSettingsPage</class>
|
||||
<widget class="QWidget" name="LastFMSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -10,6 +10,9 @@
|
||||
<height>551</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Last.fm</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
@ -15,12 +15,12 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "magnatuneconfig.h"
|
||||
#include "magnatunesettingspage.h"
|
||||
|
||||
#include "core/network.h"
|
||||
#include "magnatuneservice.h"
|
||||
#include "internetmodel.h"
|
||||
#include "ui_magnatuneconfig.h"
|
||||
#include "ui_magnatunesettingspage.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QNetworkReply>
|
||||
@ -28,14 +28,15 @@
|
||||
#include <QSettings>
|
||||
#include <QtDebug>
|
||||
|
||||
MagnatuneConfig::MagnatuneConfig(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
MagnatuneSettingsPage::MagnatuneSettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog),
|
||||
credentials_changed_(false),
|
||||
network_(new NetworkAccessManager(this)),
|
||||
ui_(new Ui_MagnatuneConfig)
|
||||
ui_(new Ui_MagnatuneSettingsPage)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
ui_->busy->hide();
|
||||
setWindowIcon(QIcon(":/providers/magnatune.png"));
|
||||
|
||||
connect(ui_->membership, SIGNAL(currentIndexChanged(int)), SLOT(MembershipChanged(int)));
|
||||
|
||||
@ -45,21 +46,17 @@ MagnatuneConfig::MagnatuneConfig(QWidget *parent)
|
||||
SLOT(CredentialsChanged()));
|
||||
connect(ui_->password, SIGNAL(textEdited(const QString&)),
|
||||
SLOT(CredentialsChanged()));
|
||||
connect(ui_->login, SIGNAL(clicked()), SLOT(Validate()));
|
||||
connect(ui_->login, SIGNAL(clicked()), SLOT(Login()));
|
||||
}
|
||||
|
||||
MagnatuneConfig::~MagnatuneConfig() {
|
||||
MagnatuneSettingsPage::~MagnatuneSettingsPage() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
bool MagnatuneConfig::NeedsValidation() const {
|
||||
return credentials_changed_;
|
||||
}
|
||||
|
||||
const char* kMagnatuneDownloadValidateUrl = "http://download.magnatune.com/";
|
||||
const char* kMagnatuneStreamingValidateUrl = "http://streaming.magnatune.com/";
|
||||
|
||||
void MagnatuneConfig::Validate() {
|
||||
void MagnatuneSettingsPage::Login() {
|
||||
if (!credentials_changed_)
|
||||
return;
|
||||
ui_->busy->show();
|
||||
@ -85,10 +82,10 @@ void MagnatuneConfig::Validate() {
|
||||
QNetworkRequest::AlwaysNetwork);
|
||||
|
||||
QNetworkReply* reply = network_->head(req);
|
||||
connect(reply, SIGNAL(finished()), SLOT(ValidationFinished()));
|
||||
connect(reply, SIGNAL(finished()), SLOT(LoginFinished()));
|
||||
}
|
||||
|
||||
void MagnatuneConfig::ValidationFinished() {
|
||||
void MagnatuneSettingsPage::LoginFinished() {
|
||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
|
||||
Q_ASSERT(reply);
|
||||
reply->deleteLater();
|
||||
@ -107,14 +104,14 @@ void MagnatuneConfig::ValidationFinished() {
|
||||
ui_->login->setEnabled(!success);
|
||||
}
|
||||
|
||||
void MagnatuneConfig::AuthenticationRequired(
|
||||
void MagnatuneSettingsPage::AuthenticationRequired(
|
||||
QNetworkReply* reply, QAuthenticator*) {
|
||||
// We send the authentication with the first request so this means we got
|
||||
// a 401 Authentication Required, ie. the credentials are incorrect.
|
||||
reply->abort();
|
||||
}
|
||||
|
||||
void MagnatuneConfig::Load() {
|
||||
void MagnatuneSettingsPage::Load() {
|
||||
QSettings s;
|
||||
s.beginGroup(MagnatuneService::kSettingsGroup);
|
||||
|
||||
@ -126,7 +123,7 @@ void MagnatuneConfig::Load() {
|
||||
credentials_changed_ = false;
|
||||
}
|
||||
|
||||
void MagnatuneConfig::Save() {
|
||||
void MagnatuneSettingsPage::Save() {
|
||||
QSettings s;
|
||||
s.beginGroup(MagnatuneService::kSettingsGroup);
|
||||
|
||||
@ -138,13 +135,13 @@ void MagnatuneConfig::Save() {
|
||||
InternetModel::Service<MagnatuneService>()->ReloadSettings();
|
||||
}
|
||||
|
||||
void MagnatuneConfig::MembershipChanged(int value) {
|
||||
void MagnatuneSettingsPage::MembershipChanged(int value) {
|
||||
bool enabled = MagnatuneService::MembershipType(value) !=
|
||||
MagnatuneService::Membership_None;
|
||||
ui_->login_container->setEnabled(enabled);
|
||||
ui_->preferences_group->setEnabled(enabled);
|
||||
}
|
||||
|
||||
void MagnatuneConfig::CredentialsChanged() {
|
||||
void MagnatuneSettingsPage::CredentialsChanged() {
|
||||
credentials_changed_ = true;
|
||||
}
|
@ -15,43 +15,37 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MAGNATUNECONFIG_H
|
||||
#define MAGNATUNECONFIG_H
|
||||
#ifndef MAGNATUNESETTINGSPAGE_H
|
||||
#define MAGNATUNESETTINGSPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui/settingspage.h"
|
||||
|
||||
class QAuthenticator;
|
||||
class QNetworkReply;
|
||||
|
||||
class NetworkAccessManager;
|
||||
class Ui_MagnatuneConfig;
|
||||
class Ui_MagnatuneSettingsPage;
|
||||
|
||||
class MagnatuneConfig : public QWidget {
|
||||
class MagnatuneSettingsPage : public SettingsPage {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MagnatuneConfig(QWidget* parent = 0);
|
||||
~MagnatuneConfig();
|
||||
MagnatuneSettingsPage(SettingsDialog* dialog);
|
||||
~MagnatuneSettingsPage();
|
||||
|
||||
bool NeedsValidation() const;
|
||||
|
||||
public slots:
|
||||
void Load();
|
||||
void Save();
|
||||
void Validate();
|
||||
|
||||
signals:
|
||||
void ValidationComplete(bool);
|
||||
|
||||
private slots:
|
||||
void Login();
|
||||
void MembershipChanged(int value);
|
||||
void ValidationFinished();
|
||||
void LoginFinished();
|
||||
void AuthenticationRequired(QNetworkReply* reply, QAuthenticator* auth);
|
||||
void CredentialsChanged();
|
||||
|
||||
private:
|
||||
bool credentials_changed_;
|
||||
NetworkAccessManager* network_;
|
||||
Ui_MagnatuneConfig* ui_;
|
||||
Ui_MagnatuneSettingsPage* ui_;
|
||||
};
|
||||
|
||||
#endif // MAGNATUNECONFIG_H
|
||||
#endif // MAGNATUNESETTINGSPAGE_H
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MagnatuneConfig</class>
|
||||
<widget class="QWidget" name="MagnatuneConfig">
|
||||
<class>MagnatuneSettingsPage</class>
|
||||
<widget class="QWidget" name="MagnatuneSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string>Magnatune</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
@ -15,12 +15,12 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "spotifyconfig.h"
|
||||
#include "spotifysettingspage.h"
|
||||
|
||||
#include "core/network.h"
|
||||
#include "spotifyservice.h"
|
||||
#include "internetmodel.h"
|
||||
#include "ui_spotifyconfig.h"
|
||||
#include "ui_spotifysettingspage.h"
|
||||
#include "ui/iconloader.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
@ -29,10 +29,10 @@
|
||||
#include <QSettings>
|
||||
#include <QtDebug>
|
||||
|
||||
SpotifyConfig::SpotifyConfig(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
SpotifySettingsPage::SpotifySettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog),
|
||||
network_(new NetworkAccessManager(this)),
|
||||
ui_(new Ui_SpotifyConfig),
|
||||
ui_(new Ui_SpotifySettingsPage),
|
||||
service_(InternetModel::Service<SpotifyService>()),
|
||||
validated_(false)
|
||||
{
|
||||
@ -40,12 +40,14 @@ SpotifyConfig::SpotifyConfig(QWidget *parent)
|
||||
ui_->busy->hide();
|
||||
ui_->warn_icon->setPixmap(IconLoader::Load("dialog-warning").pixmap(16));
|
||||
|
||||
setWindowIcon(QIcon(":/icons/svg/spotify.svg"));
|
||||
|
||||
QFont bold_font(font());
|
||||
bold_font.setBold(true);
|
||||
ui_->blob_status->setFont(bold_font);
|
||||
|
||||
connect(ui_->download_blob, SIGNAL(clicked()), SLOT(DownloadBlob()));
|
||||
connect(ui_->login, SIGNAL(clicked()), SLOT(Validate()));
|
||||
connect(ui_->login, SIGNAL(clicked()), SLOT(Login()));
|
||||
|
||||
connect(service_, SIGNAL(LoginFinished(bool)), SLOT(LoginFinished(bool)));
|
||||
connect(service_, SIGNAL(BlobStateChanged()), SLOT(BlobStateChanged()));
|
||||
@ -53,11 +55,11 @@ SpotifyConfig::SpotifyConfig(QWidget *parent)
|
||||
BlobStateChanged();
|
||||
}
|
||||
|
||||
SpotifyConfig::~SpotifyConfig() {
|
||||
SpotifySettingsPage::~SpotifySettingsPage() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void SpotifyConfig::BlobStateChanged() {
|
||||
void SpotifySettingsPage::BlobStateChanged() {
|
||||
const bool installed = service_->IsBlobInstalled();
|
||||
|
||||
ui_->account_group->setEnabled(installed);
|
||||
@ -70,32 +72,29 @@ void SpotifyConfig::BlobStateChanged() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void SpotifyConfig::DownloadBlob() {
|
||||
void SpotifySettingsPage::DownloadBlob() {
|
||||
service_->InstallBlob();
|
||||
}
|
||||
|
||||
bool SpotifyConfig::NeedsValidation() const {
|
||||
void SpotifySettingsPage::Login() {
|
||||
if (!service_->IsBlobInstalled()) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ui_->username->text() == original_username_ &&
|
||||
ui_->password->text() == original_password_) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
return !validated_;
|
||||
}
|
||||
|
||||
void SpotifyConfig::Validate() {
|
||||
if (!NeedsValidation())
|
||||
if (!validated_) {
|
||||
return;
|
||||
}
|
||||
|
||||
ui_->busy->show();
|
||||
service_->Login(ui_->username->text(), ui_->password->text());
|
||||
}
|
||||
|
||||
void SpotifyConfig::Load() {
|
||||
void SpotifySettingsPage::Load() {
|
||||
QSettings s;
|
||||
s.beginGroup(SpotifyService::kSettingsGroup);
|
||||
|
||||
@ -107,7 +106,7 @@ void SpotifyConfig::Load() {
|
||||
validated_ = false;
|
||||
}
|
||||
|
||||
void SpotifyConfig::Save() {
|
||||
void SpotifySettingsPage::Save() {
|
||||
QSettings s;
|
||||
s.beginGroup(SpotifyService::kSettingsGroup);
|
||||
|
||||
@ -117,7 +116,7 @@ void SpotifyConfig::Save() {
|
||||
InternetModel::Service<SpotifyService>()->ReloadSettings();
|
||||
}
|
||||
|
||||
void SpotifyConfig::LoginFinished(bool success) {
|
||||
void SpotifySettingsPage::LoginFinished(bool success) {
|
||||
validated_ = success;
|
||||
ui_->busy->hide();
|
||||
ui_->login->setEnabled(!success);
|
@ -15,44 +15,36 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SPOTIFYCONFIG_H
|
||||
#define SPOTIFYCONFIG_H
|
||||
#ifndef SPOTIFYSETTINGSPAGE_H
|
||||
#define SPOTIFYSETTINGSPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QAuthenticator;
|
||||
class QNetworkReply;
|
||||
#include "ui/settingspage.h"
|
||||
|
||||
class NetworkAccessManager;
|
||||
class Ui_SpotifyConfig;
|
||||
class Ui_SpotifySettingsPage;
|
||||
class SpotifyService;
|
||||
|
||||
class SpotifyConfig : public QWidget {
|
||||
class SpotifySettingsPage : public SettingsPage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SpotifyConfig(QWidget* parent = 0);
|
||||
~SpotifyConfig();
|
||||
SpotifySettingsPage(SettingsDialog* dialog);
|
||||
~SpotifySettingsPage();
|
||||
|
||||
bool NeedsValidation() const;
|
||||
|
||||
signals:
|
||||
void ValidationComplete(bool success);
|
||||
|
||||
public slots:
|
||||
void Load();
|
||||
void Save();
|
||||
void Validate();
|
||||
|
||||
public slots:
|
||||
void BlobStateChanged();
|
||||
void DownloadBlob();
|
||||
|
||||
private slots:
|
||||
void Login();
|
||||
void LoginFinished(bool success);
|
||||
|
||||
private:
|
||||
NetworkAccessManager* network_;
|
||||
Ui_SpotifyConfig* ui_;
|
||||
Ui_SpotifySettingsPage* ui_;
|
||||
SpotifyService* service_;
|
||||
|
||||
bool validated_;
|
||||
@ -60,4 +52,4 @@ private:
|
||||
QString original_password_;
|
||||
};
|
||||
|
||||
#endif // SPOTIFYCONFIG_H
|
||||
#endif // SPOTIFYSETTINGSPAGE_H
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SpotifyConfig</class>
|
||||
<widget class="QWidget" name="SpotifyConfig">
|
||||
<class>SpotifySettingsPage</class>
|
||||
<widget class="QWidget" name="SpotifySettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string>Spotify</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
@ -15,58 +15,45 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "libraryconfig.h"
|
||||
#include "librarysettingspage.h"
|
||||
#include "librarydirectorymodel.h"
|
||||
#include "librarymodel.h"
|
||||
#include "libraryview.h"
|
||||
#include "librarywatcher.h"
|
||||
#include "ui_libraryconfig.h"
|
||||
#include "ui_librarysettingspage.h"
|
||||
#include "core/utilities.h"
|
||||
#include "playlist/playlistdelegates.h"
|
||||
#include "ui/iconloader.h"
|
||||
#include "core/utilities.h"
|
||||
#include "ui/settingsdialog.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QSettings>
|
||||
#include <QDir>
|
||||
|
||||
const char* LibraryConfig::kSettingsGroup = "LibraryConfig";
|
||||
const char* LibrarySettingsPage::kSettingsGroup = "LibraryConfig";
|
||||
|
||||
|
||||
LibraryConfig::LibraryConfig(QWidget* parent)
|
||||
: QWidget(parent),
|
||||
ui_(new Ui_LibraryConfig),
|
||||
model_(NULL)
|
||||
LibrarySettingsPage::LibrarySettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog),
|
||||
ui_(new Ui_LibrarySettingsPage),
|
||||
initialised_model_(false)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
ui_->list->setItemDelegate(new NativeSeparatorsDelegate(this));
|
||||
|
||||
// Icons
|
||||
setWindowIcon(IconLoader::Load("folder-sound"));
|
||||
ui_->add->setIcon(IconLoader::Load("document-open-folder"));
|
||||
|
||||
connect(ui_->add, SIGNAL(clicked()), SLOT(Add()));
|
||||
connect(ui_->remove, SIGNAL(clicked()), SLOT(Remove()));
|
||||
}
|
||||
|
||||
LibraryConfig::~LibraryConfig() {
|
||||
LibrarySettingsPage::~LibrarySettingsPage() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void LibraryConfig::SetModel(LibraryDirectoryModel *model) {
|
||||
if (ui_->list->selectionModel()) {
|
||||
disconnect(ui_->list->selectionModel(),
|
||||
SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
|
||||
this, SLOT(CurrentRowChanged(QModelIndex)));
|
||||
}
|
||||
|
||||
model_ = model;
|
||||
ui_->list->setModel(model_);
|
||||
|
||||
connect(ui_->list->selectionModel(),
|
||||
SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
|
||||
SLOT(CurrentRowChanged(QModelIndex)));
|
||||
}
|
||||
|
||||
void LibraryConfig::Add() {
|
||||
void LibrarySettingsPage::Add() {
|
||||
QSettings settings;
|
||||
settings.beginGroup(kSettingsGroup);
|
||||
|
||||
@ -75,21 +62,21 @@ void LibraryConfig::Add() {
|
||||
path = QFileDialog::getExistingDirectory(this, tr("Add directory..."), path);
|
||||
|
||||
if (!path.isNull()) {
|
||||
model_->AddDirectory(path);
|
||||
dialog()->library_directory_model()->AddDirectory(path);
|
||||
}
|
||||
|
||||
settings.setValue("last_path", path);
|
||||
}
|
||||
|
||||
void LibraryConfig::Remove() {
|
||||
model_->RemoveDirectory(ui_->list->currentIndex());
|
||||
void LibrarySettingsPage::Remove() {
|
||||
dialog()->library_directory_model()->RemoveDirectory(ui_->list->currentIndex());
|
||||
}
|
||||
|
||||
void LibraryConfig::CurrentRowChanged(const QModelIndex& index) {
|
||||
void LibrarySettingsPage::CurrentRowChanged(const QModelIndex& index) {
|
||||
ui_->remove->setEnabled(index.isValid());
|
||||
}
|
||||
|
||||
void LibraryConfig::Save() {
|
||||
void LibrarySettingsPage::Save() {
|
||||
QSettings s;
|
||||
s.beginGroup(LibraryView::kSettingsGroup);
|
||||
s.setValue("auto_open", ui_->auto_open->isChecked());
|
||||
@ -108,11 +95,22 @@ void LibraryConfig::Save() {
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
void LibraryConfig::showEvent(QShowEvent *) {
|
||||
Load();
|
||||
}
|
||||
void LibrarySettingsPage::Load() {
|
||||
if (!initialised_model_) {
|
||||
if (ui_->list->selectionModel()) {
|
||||
disconnect(ui_->list->selectionModel(),
|
||||
SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
|
||||
this, SLOT(CurrentRowChanged(QModelIndex)));
|
||||
}
|
||||
|
||||
ui_->list->setModel(dialog()->library_directory_model());
|
||||
initialised_model_ = true;
|
||||
|
||||
connect(ui_->list->selectionModel(),
|
||||
SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
|
||||
SLOT(CurrentRowChanged(QModelIndex)));
|
||||
}
|
||||
|
||||
void LibraryConfig::Load() {
|
||||
QSettings s;
|
||||
s.beginGroup(LibraryView::kSettingsGroup);
|
||||
ui_->auto_open->setChecked(s.value("auto_open", true).toBool());
|
@ -15,43 +15,37 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBRARYCONFIG_H
|
||||
#define LIBRARYCONFIG_H
|
||||
#ifndef LIBRARYSETTINGSPAGE_H
|
||||
#define LIBRARYSETTINGSPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui/settingspage.h"
|
||||
|
||||
class Ui_LibraryConfig;
|
||||
class Ui_LibrarySettingsPage;
|
||||
class LibraryDirectoryModel;
|
||||
|
||||
class QModelIndex;
|
||||
|
||||
class LibraryConfig : public QWidget {
|
||||
class LibrarySettingsPage : public SettingsPage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LibraryConfig(QWidget* parent = 0);
|
||||
~LibraryConfig();
|
||||
public:
|
||||
LibrarySettingsPage(SettingsDialog* dialog);
|
||||
~LibrarySettingsPage();
|
||||
|
||||
static const char* kSettingsGroup;
|
||||
|
||||
void SetModel(LibraryDirectoryModel* model);
|
||||
|
||||
public slots:
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *);
|
||||
|
||||
private slots:
|
||||
private slots:
|
||||
void Add();
|
||||
void Remove();
|
||||
|
||||
void CurrentRowChanged(const QModelIndex& index);
|
||||
|
||||
private:
|
||||
Ui_LibraryConfig* ui_;
|
||||
LibraryDirectoryModel* model_;
|
||||
private:
|
||||
Ui_LibrarySettingsPage* ui_;
|
||||
bool initialised_model_;
|
||||
};
|
||||
|
||||
#endif // LIBRARYCONFIG_H
|
||||
#endif // LIBRARYSETTINGSPAGE_H
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LibraryConfig</class>
|
||||
<widget class="QWidget" name="LibraryConfig">
|
||||
<class>LibrarySettingsPage</class>
|
||||
<widget class="QWidget" name="LibrarySettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -10,6 +10,9 @@
|
||||
<height>395</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Music Library</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "remote.h"
|
||||
#include "remoteconfig.h"
|
||||
#include "remotesettingspage.h"
|
||||
#include "core/player.h"
|
||||
#include "engines/enginebase.h"
|
||||
#include "playlist/playlist.h"
|
||||
@ -59,11 +59,11 @@ Remote::Remote(Player* player, QObject* parent)
|
||||
|
||||
void Remote::ReloadSettings() {
|
||||
QSettings s;
|
||||
s.beginGroup(RemoteConfig::kSettingsGroup);
|
||||
s.beginGroup(RemoteSettingsPage::kSettingsGroup);
|
||||
|
||||
QString username = s.value("username").toString();
|
||||
QString password = s.value("password").toString();
|
||||
QString agent_name = s.value("agent_name", RemoteConfig::DefaultAgentName()).toString();
|
||||
QString agent_name = s.value("agent_name", RemoteSettingsPage::DefaultAgentName()).toString();
|
||||
|
||||
// Have the settings changed?
|
||||
if (username != connection_->username() ||
|
||||
|
@ -15,8 +15,8 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "remoteconfig.h"
|
||||
#include "ui_remoteconfig.h"
|
||||
#include "remotesettingspage.h"
|
||||
#include "ui_remotesettingspage.h"
|
||||
#include "ui/iconloader.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
@ -26,43 +26,40 @@
|
||||
#include <QSettings>
|
||||
|
||||
const char* kClientLoginUrl = "https://www.google.com/accounts/ClientLogin";
|
||||
const char* RemoteConfig::kSettingsGroup = "Remote";
|
||||
const char* RemoteSettingsPage::kSettingsGroup = "Remote";
|
||||
|
||||
RemoteConfig::RemoteConfig(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
ui_(new Ui_RemoteConfig),
|
||||
RemoteSettingsPage::RemoteSettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog),
|
||||
ui_(new Ui_RemoteSettingsPage),
|
||||
waiting_for_auth_(false),
|
||||
network_(new NetworkAccessManager(this))
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
ui_->busy->hide();
|
||||
ui_->icon->setPixmap(IconLoader::Load("task-reject").pixmap(16));
|
||||
setWindowIcon(IconLoader::Load("network-server"));
|
||||
|
||||
// Icons
|
||||
ui_->sign_out->setIcon(IconLoader::Load("list-remove"));
|
||||
ui_->sign_out->hide();
|
||||
|
||||
connect(ui_->login, SIGNAL(clicked()), SLOT(Validate()));
|
||||
connect(ui_->login, SIGNAL(clicked()), SLOT(Login()));
|
||||
connect(ui_->sign_out, SIGNAL(clicked()), SLOT(SignOut()));
|
||||
|
||||
ui_->username->setMinimumWidth(QFontMetrics(QFont()).width("WWWWWWWWWWWW"));
|
||||
resize(sizeHint());
|
||||
}
|
||||
|
||||
QString RemoteConfig::DefaultAgentName() {
|
||||
QString RemoteSettingsPage::DefaultAgentName() {
|
||||
return QString("%1 on %2").arg(QCoreApplication::applicationName(),
|
||||
QHostInfo::localHostName());
|
||||
}
|
||||
|
||||
RemoteConfig::~RemoteConfig() {
|
||||
RemoteSettingsPage::~RemoteSettingsPage() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
bool RemoteConfig::NeedsValidation() const {
|
||||
return !ui_->username->text().isEmpty() && !ui_->password->text().isEmpty();
|
||||
}
|
||||
|
||||
void RemoteConfig::Validate() {
|
||||
void RemoteSettingsPage::Login() {
|
||||
ui_->busy->show();
|
||||
waiting_for_auth_ = true;
|
||||
|
||||
@ -72,7 +69,7 @@ void RemoteConfig::Validate() {
|
||||
// Validates a Google account against ClientLogin and fetches a token usable for
|
||||
// X-GOOGLE-TOKEN SASL authentication for Google Talk:
|
||||
// http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html#ClientLogin
|
||||
void RemoteConfig::ValidateGoogleAccount(const QString& username, const QString& password) {
|
||||
void RemoteSettingsPage::ValidateGoogleAccount(const QString& username, const QString& password) {
|
||||
QNetworkRequest request = QNetworkRequest(QUrl(kClientLoginUrl));
|
||||
QString post_data =
|
||||
"accountType=HOSTED_OR_GOOGLE&"
|
||||
@ -81,10 +78,10 @@ void RemoteConfig::ValidateGoogleAccount(const QString& username, const QString&
|
||||
"Email=" + QUrl::toPercentEncoding(username) + "&"
|
||||
"Passwd=" + QUrl::toPercentEncoding(password);
|
||||
QNetworkReply* reply = network_->post(request, post_data.toUtf8());
|
||||
connect(reply, SIGNAL(finished()), SLOT(ValidateFinished()));
|
||||
connect(reply, SIGNAL(finished()), SLOT(LoginFinished()));
|
||||
}
|
||||
|
||||
void RemoteConfig::ValidateFinished() {
|
||||
void RemoteSettingsPage::LoginFinished() {
|
||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
|
||||
Q_ASSERT(reply);
|
||||
reply->deleteLater();
|
||||
@ -95,15 +92,15 @@ void RemoteConfig::ValidateFinished() {
|
||||
QStringList params = data.split('\n');
|
||||
foreach (const QString& param, params) {
|
||||
if (param.startsWith("Auth=")) {
|
||||
AuthenticationComplete(param.split('=')[1]);
|
||||
LoginComplete(param.split('=')[1]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
AuthenticationComplete(QString::null);
|
||||
LoginComplete(QString::null);
|
||||
}
|
||||
|
||||
void RemoteConfig::AuthenticationComplete(const QString& token) {
|
||||
void RemoteSettingsPage::LoginComplete(const QString& token) {
|
||||
if (!waiting_for_auth_)
|
||||
return; // Wasn't us that was waiting for auth
|
||||
|
||||
@ -131,7 +128,7 @@ void RemoteConfig::AuthenticationComplete(const QString& token) {
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteConfig::Load() {
|
||||
void RemoteSettingsPage::Load() {
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
|
||||
@ -139,7 +136,7 @@ void RemoteConfig::Load() {
|
||||
ui_->agent_name->setText(s.value("agent_name", DefaultAgentName()).toString());
|
||||
}
|
||||
|
||||
void RemoteConfig::Save() {
|
||||
void RemoteSettingsPage::Save() {
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
|
||||
@ -147,7 +144,7 @@ void RemoteConfig::Save() {
|
||||
s.setValue("agent_name", ui_->agent_name->text());
|
||||
}
|
||||
|
||||
void RemoteConfig::SignOut() {
|
||||
void RemoteSettingsPage::SignOut() {
|
||||
ui_->username->clear();
|
||||
ui_->password->clear();
|
||||
ui_->sign_out->hide();
|
@ -15,47 +15,40 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef REMOTECONFIG_H
|
||||
#define REMOTECONFIG_H
|
||||
|
||||
#include <QWidget>
|
||||
#ifndef REMOTESETTINGSPAGE_H
|
||||
#define REMOTESETTINGSPAGE_H
|
||||
|
||||
#include "core/network.h"
|
||||
#include "ui/settingspage.h"
|
||||
|
||||
class Ui_RemoteConfig;
|
||||
class Ui_RemoteSettingsPage;
|
||||
|
||||
class RemoteConfig : public QWidget {
|
||||
class RemoteSettingsPage : public SettingsPage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RemoteConfig(QWidget* parent = 0);
|
||||
~RemoteConfig();
|
||||
RemoteSettingsPage(SettingsDialog* dialog);
|
||||
~RemoteSettingsPage();
|
||||
|
||||
static QString DefaultAgentName();
|
||||
|
||||
bool NeedsValidation() const;
|
||||
|
||||
static const char* kSettingsGroup;
|
||||
|
||||
public slots:
|
||||
void Validate();
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
signals:
|
||||
void ValidationComplete(bool success);
|
||||
|
||||
private slots:
|
||||
void AuthenticationComplete(const QString& token);
|
||||
void Login();
|
||||
void LoginFinished();
|
||||
void LoginComplete(const QString& token);
|
||||
void SignOut();
|
||||
void ValidateFinished();
|
||||
|
||||
private:
|
||||
void ValidateGoogleAccount(const QString& username, const QString& password);
|
||||
|
||||
Ui_RemoteConfig* ui_;
|
||||
Ui_RemoteSettingsPage* ui_;
|
||||
bool waiting_for_auth_;
|
||||
NetworkAccessManager* network_;
|
||||
};
|
||||
|
||||
#endif // REMOTECONFIG_H
|
||||
#endif // REMOTESETTINGSPAGE_H
|
@ -1,15 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RemoteConfig</class>
|
||||
<widget class="QWidget" name="RemoteConfig">
|
||||
<class>RemoteSettingsPage</class>
|
||||
<widget class="QWidget" name="RemoteSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>505</width>
|
||||
<width>507</width>
|
||||
<height>435</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Remote Control</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
@ -1,75 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LyricSettings</class>
|
||||
<widget class="QWidget" name="LyricSettings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>414</width>
|
||||
<height>255</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Choose the websites you want Clementine to use when searching for lyrics.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="providers"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="up">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Move up</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="down">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Move down</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -15,19 +15,25 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "lyricsettings.h"
|
||||
#include "songinfofetcher.h"
|
||||
#include "songinfosettingspage.h"
|
||||
#include "songinfotextview.h"
|
||||
#include "songinfoview.h"
|
||||
#include "ultimatelyricsprovider.h"
|
||||
#include "ui_lyricsettings.h"
|
||||
#include "ui_songinfosettingspage.h"
|
||||
#include "ui/iconloader.h"
|
||||
#include "ui/settingsdialog.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QSettings>
|
||||
|
||||
LyricSettings::LyricSettings(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
ui_(new Ui_LyricSettings),
|
||||
view_(NULL)
|
||||
|
||||
SongInfoSettingsPage::SongInfoSettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog),
|
||||
ui_(new Ui_SongInfoSettingsPage)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
setWindowIcon(IconLoader::Load("view-media-lyrics"));
|
||||
|
||||
connect(ui_->up, SIGNAL(clicked()), SLOT(MoveUp()));
|
||||
connect(ui_->down, SIGNAL(clicked()), SLOT(MoveDown()));
|
||||
@ -35,14 +41,29 @@ LyricSettings::LyricSettings(QWidget *parent)
|
||||
SLOT(CurrentItemChanged(QListWidgetItem*)));
|
||||
connect(ui_->providers, SIGNAL(itemChanged(QListWidgetItem*)),
|
||||
SLOT(ItemChanged(QListWidgetItem*)));
|
||||
|
||||
QFile song_info_preview(":/lumberjacksong.txt");
|
||||
song_info_preview.open(QIODevice::ReadOnly);
|
||||
ui_->song_info_font_preview->setText(QString::fromUtf8(song_info_preview.readAll()));
|
||||
|
||||
connect(ui_->song_info_font_size, SIGNAL(valueChanged(double)), SLOT(FontSizeChanged(double)));
|
||||
}
|
||||
|
||||
LyricSettings::~LyricSettings() {
|
||||
SongInfoSettingsPage::~SongInfoSettingsPage() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void LyricSettings::Load() {
|
||||
QList<const UltimateLyricsProvider*> providers = view_->lyric_providers();
|
||||
void SongInfoSettingsPage::Load() {
|
||||
QSettings s;
|
||||
|
||||
s.beginGroup(SongInfoTextView::kSettingsGroup);
|
||||
ui_->song_info_font_size->setValue(
|
||||
s.value("font_size", SongInfoTextView::kDefaultFontSize).toReal());
|
||||
ui_->song_info_timeout->setValue(
|
||||
s.value("timeout", SongInfoFetcher::kDefaultTimeoutDuration).toInt());
|
||||
s.endGroup();
|
||||
|
||||
QList<const UltimateLyricsProvider*> providers = dialog()->song_info_view()->lyric_providers();
|
||||
|
||||
ui_->providers->clear();
|
||||
foreach (const UltimateLyricsProvider* provider, providers) {
|
||||
@ -54,10 +75,15 @@ void LyricSettings::Load() {
|
||||
}
|
||||
}
|
||||
|
||||
void LyricSettings::Save() {
|
||||
void SongInfoSettingsPage::Save() {
|
||||
QSettings s;
|
||||
s.beginGroup(SongInfoView::kSettingsGroup);
|
||||
|
||||
s.beginGroup(SongInfoTextView::kSettingsGroup);
|
||||
s.setValue("font_size", ui_->song_info_font_preview->font().pointSizeF());
|
||||
s.setValue("timeout", ui_->song_info_timeout->value());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(SongInfoView::kSettingsGroup);
|
||||
QVariantList search_order;
|
||||
for (int i=0 ; i<ui_->providers->count() ; ++i) {
|
||||
const QListWidgetItem* item = ui_->providers->item(i);
|
||||
@ -65,9 +91,10 @@ void LyricSettings::Save() {
|
||||
search_order << item->text();
|
||||
}
|
||||
s.setValue("search_order", search_order);
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
void LyricSettings::CurrentItemChanged(QListWidgetItem* item) {
|
||||
void SongInfoSettingsPage::CurrentItemChanged(QListWidgetItem* item) {
|
||||
if (!item) {
|
||||
ui_->up->setEnabled(false);
|
||||
ui_->down->setEnabled(false);
|
||||
@ -78,23 +105,30 @@ void LyricSettings::CurrentItemChanged(QListWidgetItem* item) {
|
||||
}
|
||||
}
|
||||
|
||||
void LyricSettings::MoveUp() {
|
||||
void SongInfoSettingsPage::MoveUp() {
|
||||
Move(-1);
|
||||
}
|
||||
|
||||
void LyricSettings::MoveDown() {
|
||||
void SongInfoSettingsPage::MoveDown() {
|
||||
Move(+1);
|
||||
}
|
||||
|
||||
void LyricSettings::Move(int d) {
|
||||
void SongInfoSettingsPage::Move(int d) {
|
||||
const int row = ui_->providers->currentRow();
|
||||
QListWidgetItem* item = ui_->providers->takeItem(row);
|
||||
ui_->providers->insertItem(row + d, item);
|
||||
ui_->providers->setCurrentRow(row + d);
|
||||
}
|
||||
|
||||
void LyricSettings::ItemChanged(QListWidgetItem* item) {
|
||||
void SongInfoSettingsPage::ItemChanged(QListWidgetItem* item) {
|
||||
const bool checked = item->checkState() == Qt::Checked;
|
||||
item->setForeground(checked ? palette().color(QPalette::Active, QPalette::Text)
|
||||
: palette().color(QPalette::Disabled, QPalette::Text));
|
||||
}
|
||||
|
||||
void SongInfoSettingsPage::FontSizeChanged(double value) {
|
||||
QFont font;
|
||||
font.setPointSizeF(value);
|
||||
|
||||
ui_->song_info_font_preview->setFont(font);
|
||||
}
|
@ -15,24 +15,22 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LYRICSETTINGS_H
|
||||
#define LYRICSETTINGS_H
|
||||
#ifndef SONGINFOSETTINGSPAGE_H
|
||||
#define SONGINFOSETTINGSPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui/settingspage.h"
|
||||
|
||||
class SongInfoView;
|
||||
class Ui_LyricSettings;
|
||||
class Ui_SongInfoSettingsPage;
|
||||
|
||||
class QListWidgetItem;
|
||||
|
||||
class LyricSettings : public QWidget {
|
||||
class SongInfoSettingsPage : public SettingsPage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LyricSettings(QWidget *parent = 0);
|
||||
~LyricSettings();
|
||||
|
||||
void SetSongInfoView(SongInfoView* view) { view_ = view; }
|
||||
SongInfoSettingsPage(SettingsDialog* parent);
|
||||
~SongInfoSettingsPage();
|
||||
|
||||
void Load();
|
||||
void Save();
|
||||
@ -45,9 +43,10 @@ private slots:
|
||||
void CurrentItemChanged(QListWidgetItem* item);
|
||||
void ItemChanged(QListWidgetItem* item);
|
||||
|
||||
void FontSizeChanged(double value);
|
||||
|
||||
private:
|
||||
Ui_LyricSettings* ui_;
|
||||
SongInfoView* view_;
|
||||
Ui_SongInfoSettingsPage* ui_;
|
||||
};
|
||||
|
||||
#endif // LYRICSETTINGS_H
|
||||
#endif // SONGINFOSETTINGSPAGE_H
|
183
src/songinfo/songinfosettingspage.ui
Normal file
183
src/songinfo/songinfosettingspage.ui
Normal file
@ -0,0 +1,183 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SongInfoSettingsPage</class>
|
||||
<widget class="QWidget" name="SongInfoSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>625</width>
|
||||
<height>556</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Song Information</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Appearance</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Font size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="song_info_font_size">
|
||||
<property name="suffix">
|
||||
<string> pt</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>5.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>50.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.500000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QTextEdit" name="song_info_font_preview">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Network</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_6">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Timeout</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="song_info_timeout">
|
||||
<property name="suffix">
|
||||
<string> ms</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>60000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Lyrics</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_15">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Choose the websites you want Clementine to use when searching for lyrics.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="providers"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="up">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Move up</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="down">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Move down</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
50
src/transcoder/transcodersettingspage.cpp
Normal file
50
src/transcoder/transcodersettingspage.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "transcodersettingspage.h"
|
||||
#include "ui_transcodersettingspage.h"
|
||||
#include "ui/iconloader.h"
|
||||
|
||||
TranscoderSettingsPage::TranscoderSettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog),
|
||||
ui_(new Ui_TranscoderSettingsPage)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
setWindowIcon(IconLoader::Load("tools-wizard"));
|
||||
}
|
||||
|
||||
TranscoderSettingsPage::~TranscoderSettingsPage() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void TranscoderSettingsPage::Load() {
|
||||
ui_->transcoding_aac->Load();
|
||||
ui_->transcoding_flac->Load();
|
||||
ui_->transcoding_mp3->Load();
|
||||
ui_->transcoding_speex->Load();
|
||||
ui_->transcoding_vorbis->Load();
|
||||
ui_->transcoding_wma->Load();
|
||||
}
|
||||
|
||||
void TranscoderSettingsPage::Save() {
|
||||
ui_->transcoding_aac->Save();
|
||||
ui_->transcoding_flac->Save();
|
||||
ui_->transcoding_mp3->Save();
|
||||
ui_->transcoding_speex->Save();
|
||||
ui_->transcoding_vorbis->Save();
|
||||
ui_->transcoding_wma->Save();
|
||||
}
|
@ -15,26 +15,25 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DIGITALLYIMPORTEDCONFIG_H
|
||||
#define DIGITALLYIMPORTEDCONFIG_H
|
||||
#ifndef TRANSCODERSETTINGSPAGE_H
|
||||
#define TRANSCODERSETTINGSPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui/settingspage.h"
|
||||
|
||||
class Ui_DigitallyImportedConfig;
|
||||
class Ui_TranscoderSettingsPage;
|
||||
|
||||
class DigitallyImportedConfig : public QWidget {
|
||||
class TranscoderSettingsPage : public SettingsPage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DigitallyImportedConfig(QWidget* parent = 0);
|
||||
~DigitallyImportedConfig();
|
||||
TranscoderSettingsPage(SettingsDialog* dialog);
|
||||
~TranscoderSettingsPage();
|
||||
|
||||
public slots:
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
private:
|
||||
Ui_DigitallyImportedConfig* ui_;
|
||||
Ui_TranscoderSettingsPage* ui_;
|
||||
};
|
||||
|
||||
#endif // DIGITALLYIMPORTEDCONFIG_H
|
||||
#endif // TRANSCODERSETTINGSPAGE_H
|
172
src/transcoder/transcodersettingspage.ui
Normal file
172
src/transcoder/transcodersettingspage.ui
Normal file
@ -0,0 +1,172 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TranscoderSettingsPage</class>
|
||||
<widget class="QWidget" name="TranscoderSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Transcoding</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>These settings are used in the "Transcode Music" dialog, and when converting music before copying it to a device.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>MP3</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_20">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="TranscoderOptionsMP3" name="transcoding_mp3" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>Vorbis</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_25">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="TranscoderOptionsVorbis" name="transcoding_vorbis" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>FLAC</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_24">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="TranscoderOptionsFlac" name="transcoding_flac" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>Speex</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_23">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="TranscoderOptionsSpeex" name="transcoding_speex" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_5">
|
||||
<attribute name="title">
|
||||
<string>AAC</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_22">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="TranscoderOptionsAAC" name="transcoding_aac" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_6">
|
||||
<attribute name="title">
|
||||
<string>WMA</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_21">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="TranscoderOptionsWma" name="transcoding_wma" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>TranscoderOptionsMP3</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>transcoder/transcoderoptionsmp3.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TranscoderOptionsVorbis</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>transcoder/transcoderoptionsvorbis.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TranscoderOptionsSpeex</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>transcoder/transcoderoptionsspeex.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TranscoderOptionsAAC</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>transcoder/transcoderoptionsaac.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TranscoderOptionsFlac</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>transcoder/transcoderoptionsflac.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TranscoderOptionsWma</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>transcoder/transcoderoptionswma.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
81
src/ui/backgroundstreamssettingspage.cpp
Normal file
81
src/ui/backgroundstreamssettingspage.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "backgroundstreamssettingspage.h"
|
||||
#include "iconloader.h"
|
||||
#include "settingsdialog.h"
|
||||
#include "ui_backgroundstreamssettingspage.h"
|
||||
#include "core/backgroundstreams.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QGroupBox>
|
||||
|
||||
BackgroundStreamsSettingsPage::BackgroundStreamsSettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog),
|
||||
ui_(new Ui_BackgroundStreamsSettingsPage)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
setWindowIcon(QIcon(":/icons/32x32/weather-showers-scattered.png"));
|
||||
|
||||
foreach (const QString& name, dialog->background_streams()->streams()) {
|
||||
AddStream(name);
|
||||
}
|
||||
}
|
||||
|
||||
BackgroundStreamsSettingsPage::~BackgroundStreamsSettingsPage() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void BackgroundStreamsSettingsPage::Load() {
|
||||
}
|
||||
|
||||
void BackgroundStreamsSettingsPage::Save() {
|
||||
dialog()->background_streams()->SaveStreams();
|
||||
}
|
||||
|
||||
void BackgroundStreamsSettingsPage::AddStream(const QString& name) {
|
||||
BackgroundStreams* streams = dialog()->background_streams();
|
||||
|
||||
QGroupBox* box = new QGroupBox(tr(name.toUtf8()));
|
||||
QSlider* slider = new QSlider(Qt::Horizontal, box);
|
||||
QCheckBox* check = new QCheckBox(box);
|
||||
QHBoxLayout* hbox_layout = new QHBoxLayout(box);
|
||||
hbox_layout->addWidget(slider);
|
||||
hbox_layout->addWidget(check);
|
||||
|
||||
QVBoxLayout* streams_layout = qobject_cast<QVBoxLayout*>(layout());
|
||||
streams_layout->insertWidget(streams_layout->count() - 1, box);
|
||||
|
||||
slider->setProperty("stream_name", name);
|
||||
check->setProperty("stream_name", name);
|
||||
|
||||
connect(slider, SIGNAL(valueChanged(int)), SLOT(StreamVolumeChanged(int)));
|
||||
connect(check, SIGNAL(toggled(bool)), SLOT(EnableStream(bool)));
|
||||
|
||||
slider->setValue(streams->GetStreamVolume(name));
|
||||
check->setCheckState(streams->IsPlaying(name) ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
|
||||
void BackgroundStreamsSettingsPage::EnableStream(bool enabled) {
|
||||
const QString name = sender()->property("stream_name").toString();
|
||||
dialog()->background_streams()->EnableStream(name, enabled);
|
||||
}
|
||||
|
||||
void BackgroundStreamsSettingsPage::StreamVolumeChanged(int value) {
|
||||
const QString name = sender()->property("stream_name").toString();
|
||||
dialog()->background_streams()->SetStreamVolume(name, value);
|
||||
}
|
46
src/ui/backgroundstreamssettingspage.h
Normal file
46
src/ui/backgroundstreamssettingspage.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef BACKGROUNDSTREAMSSETTINGSPAGE_H
|
||||
#define BACKGROUNDSTREAMSSETTINGSPAGE_H
|
||||
|
||||
#include "settingspage.h"
|
||||
|
||||
class Ui_BackgroundStreamsSettingsPage;
|
||||
|
||||
class BackgroundStreamsSettingsPage : public SettingsPage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BackgroundStreamsSettingsPage(SettingsDialog* dialog);
|
||||
~BackgroundStreamsSettingsPage();
|
||||
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
private slots:
|
||||
void EnableStream(bool enabled);
|
||||
void StreamVolumeChanged(int value);
|
||||
|
||||
private:
|
||||
void AddStream(const QString& name);
|
||||
|
||||
private:
|
||||
Ui_BackgroundStreamsSettingsPage* ui_;
|
||||
};
|
||||
|
||||
#endif // BACKGROUNDSTREAMSSETTINGSPAGE_H
|
41
src/ui/backgroundstreamssettingspage.ui
Normal file
41
src/ui/backgroundstreamssettingspage.ui
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BackgroundStreamsSettingsPage</class>
|
||||
<widget class="QWidget" name="BackgroundStreamsSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>475</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Background Streams</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>You can listen to background streams at the same time as other music.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>256</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
157
src/ui/behavioursettingspage.cpp
Normal file
157
src/ui/behavioursettingspage.cpp
Normal file
@ -0,0 +1,157 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "behavioursettingspage.h"
|
||||
#include "mainwindow.h"
|
||||
#include "ui_behavioursettingspage.h"
|
||||
#include "playlist/playlist.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
|
||||
BehaviourSettingsPage::BehaviourSettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog),
|
||||
ui_(new Ui_BehaviourSettingsPage)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
|
||||
connect(ui_->b_show_tray_icon_, SIGNAL(toggled(bool)), SLOT(ShowTrayIconToggled(bool)));
|
||||
|
||||
ui_->doubleclick_addmode->setItemData(0, MainWindow::AddBehaviour_Append);
|
||||
ui_->doubleclick_addmode->setItemData(1, MainWindow::AddBehaviour_Load);
|
||||
ui_->doubleclick_addmode->setItemData(2, MainWindow::AddBehaviour_OpenInNew);
|
||||
ui_->doubleclick_addmode->setItemData(3, MainWindow::AddBehaviour_Enqueue);
|
||||
|
||||
ui_->doubleclick_playmode->setItemData(0, MainWindow::PlayBehaviour_Never);
|
||||
ui_->doubleclick_playmode->setItemData(1, MainWindow::PlayBehaviour_IfStopped);
|
||||
ui_->doubleclick_playmode->setItemData(2, MainWindow::PlayBehaviour_Always);
|
||||
|
||||
ui_->menu_playmode->setItemData(0, MainWindow::PlayBehaviour_Never);
|
||||
ui_->menu_playmode->setItemData(1, MainWindow::PlayBehaviour_IfStopped);
|
||||
ui_->menu_playmode->setItemData(2, MainWindow::PlayBehaviour_Always);
|
||||
|
||||
// Populate the language combo box. We do this by looking at all the
|
||||
// compiled in translations.
|
||||
QDir dir(":/translations/");
|
||||
QStringList codes(dir.entryList(QStringList() << "*.qm"));
|
||||
QRegExp lang_re("^clementine_(.*).qm$");
|
||||
foreach (const QString& filename, codes) {
|
||||
// The regex captures the "ru" from "clementine_ru.qm"
|
||||
if (!lang_re.exactMatch(filename))
|
||||
continue;
|
||||
|
||||
QString code = lang_re.cap(1);
|
||||
QString name = QString("%1 (%2)").arg(
|
||||
QLocale::languageToString(QLocale(code).language()), code);
|
||||
|
||||
language_map_[name] = code;
|
||||
}
|
||||
|
||||
language_map_["English (en)"] = "en";
|
||||
|
||||
// Sort the names and show them in the UI
|
||||
QStringList names = language_map_.keys();
|
||||
qStableSort(names);
|
||||
ui_->language->addItems(names);
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
ui_->b_show_tray_icon_->setEnabled(false);
|
||||
ui_->startup_group_->setEnabled(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
BehaviourSettingsPage::~BehaviourSettingsPage() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void BehaviourSettingsPage::Load() {
|
||||
QSettings s;
|
||||
|
||||
s.beginGroup(MainWindow::kSettingsGroup);
|
||||
ui_->b_show_tray_icon_->setChecked(s.value("showtray", true).toBool());
|
||||
ui_->b_keep_running_->setChecked(s.value("keeprunning",
|
||||
ui_->b_show_tray_icon_->isChecked()).toBool());
|
||||
ui_->doubleclick_addmode->setCurrentIndex(ui_->doubleclick_addmode->findData(
|
||||
s.value("doubleclick_addmode", MainWindow::AddBehaviour_Append).toInt()));
|
||||
ui_->doubleclick_playmode->setCurrentIndex(ui_->doubleclick_playmode->findData(
|
||||
s.value("doubleclick_playmode", MainWindow::PlayBehaviour_IfStopped).toInt()));
|
||||
ui_->menu_playmode->setCurrentIndex(ui_->menu_playmode->findData(
|
||||
s.value("menu_playmode", MainWindow::PlayBehaviour_IfStopped).toInt()));
|
||||
|
||||
MainWindow::StartupBehaviour behaviour = MainWindow::StartupBehaviour(
|
||||
s.value("startupbehaviour", MainWindow::Startup_Remember).toInt());
|
||||
switch (behaviour) {
|
||||
case MainWindow::Startup_AlwaysHide: ui_->b_always_hide_->setChecked(true); break;
|
||||
case MainWindow::Startup_AlwaysShow: ui_->b_always_show_->setChecked(true); break;
|
||||
case MainWindow::Startup_Remember: ui_->b_remember_->setChecked(true); break;
|
||||
}
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup("General");
|
||||
QString name = language_map_.key(s.value("language").toString());
|
||||
if (name.isEmpty())
|
||||
ui_->language->setCurrentIndex(0);
|
||||
else
|
||||
ui_->language->setCurrentIndex(ui_->language->findText(name));
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(Playlist::kSettingsGroup);
|
||||
ui_->b_grey_out_deleted_->setChecked(s.value("greyoutdeleted", false).toBool());
|
||||
ui_->b_enable_background_img_->setChecked(s.value("bg_enabled", true).toBool());
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
void BehaviourSettingsPage::Save() {
|
||||
QSettings s;
|
||||
|
||||
MainWindow::StartupBehaviour behaviour = MainWindow::Startup_Remember;
|
||||
if (ui_->b_always_hide_->isChecked()) behaviour = MainWindow::Startup_AlwaysHide;
|
||||
if (ui_->b_always_show_->isChecked()) behaviour = MainWindow::Startup_AlwaysShow;
|
||||
if (ui_->b_remember_->isChecked()) behaviour = MainWindow::Startup_Remember;
|
||||
|
||||
MainWindow::AddBehaviour doubleclick_addmode = MainWindow::AddBehaviour(
|
||||
ui_->doubleclick_addmode->itemData(ui_->doubleclick_addmode->currentIndex()).toInt());
|
||||
MainWindow::PlayBehaviour doubleclick_playmode = MainWindow::PlayBehaviour(
|
||||
ui_->doubleclick_playmode->itemData(ui_->doubleclick_playmode->currentIndex()).toInt());
|
||||
MainWindow::PlayBehaviour menu_playmode = MainWindow::PlayBehaviour(
|
||||
ui_->menu_playmode->itemData(ui_->menu_playmode->currentIndex()).toInt());
|
||||
|
||||
s.beginGroup(MainWindow::kSettingsGroup);
|
||||
s.setValue("showtray", ui_->b_show_tray_icon_->isChecked());
|
||||
s.setValue("keeprunning", ui_->b_keep_running_->isChecked());
|
||||
s.setValue("startupbehaviour", int(behaviour));
|
||||
s.setValue("doubleclick_addmode", doubleclick_addmode);
|
||||
s.setValue("doubleclick_playmode", doubleclick_playmode);
|
||||
s.setValue("menu_playmode", menu_playmode);
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup("General");
|
||||
s.setValue("language", language_map_.contains(ui_->language->currentText()) ?
|
||||
language_map_[ui_->language->currentText()] : QString());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(Playlist::kSettingsGroup);
|
||||
s.setValue("greyoutdeleted", ui_->b_grey_out_deleted_->isChecked());
|
||||
s.setValue("bg_enabled", ui_->b_enable_background_img_->isChecked());
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
void BehaviourSettingsPage::ShowTrayIconToggled(bool on) {
|
||||
ui_->b_always_hide_->setEnabled(on);
|
||||
if (!on && ui_->b_always_hide_->isChecked())
|
||||
ui_->b_remember_->setChecked(true);
|
||||
}
|
46
src/ui/behavioursettingspage.h
Normal file
46
src/ui/behavioursettingspage.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef BEHAVIOURSETTINGSPAGE_H
|
||||
#define BEHAVIOURSETTINGSPAGE_H
|
||||
|
||||
#include "settingspage.h"
|
||||
|
||||
#include <QMap>
|
||||
|
||||
class Ui_BehaviourSettingsPage;
|
||||
|
||||
class BehaviourSettingsPage : public SettingsPage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BehaviourSettingsPage(SettingsDialog* dialog);
|
||||
~BehaviourSettingsPage();
|
||||
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
private slots:
|
||||
void ShowTrayIconToggled(bool on);
|
||||
|
||||
private:
|
||||
Ui_BehaviourSettingsPage* ui_;
|
||||
|
||||
QMap<QString, QString> language_map_;
|
||||
};
|
||||
|
||||
#endif // BEHAVIOURSETTINGSPAGE_H
|
231
src/ui/behavioursettingspage.ui
Normal file
231
src/ui/behavioursettingspage.ui
Normal file
@ -0,0 +1,231 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BehaviourSettingsPage</class>
|
||||
<widget class="QWidget" name="BehaviourSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>497</width>
|
||||
<height>516</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Behavior</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="b_show_tray_icon_">
|
||||
<property name="text">
|
||||
<string>Show tray icon</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="b_keep_running_">
|
||||
<property name="text">
|
||||
<string>Keep running in the background when the window is closed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="b_enable_background_img_">
|
||||
<property name="text">
|
||||
<string>Enable playlist background image</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Language</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<item>
|
||||
<widget class="QComboBox" name="language">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Use the system default</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>You will need to restart Clementine if you change the language.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="startup_group_">
|
||||
<property name="title">
|
||||
<string>When Clementine starts</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="b_always_show_">
|
||||
<property name="text">
|
||||
<string>Always show the main window</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="b_always_hide_">
|
||||
<property name="text">
|
||||
<string>Always hide the main window</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="b_remember_">
|
||||
<property name="text">
|
||||
<string>Remember from last time</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="b_grey_out_deleted_">
|
||||
<property name="text">
|
||||
<string>Grey out non existent songs in my playlists</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_8">
|
||||
<property name="title">
|
||||
<string>Using the menu to add a song will...</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_18">
|
||||
<item>
|
||||
<widget class="QComboBox" name="menu_playmode">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Never start playing</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Play if there is nothing already playing</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Always start playing</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_7">
|
||||
<property name="title">
|
||||
<string>Double clicking a song will...</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QComboBox" name="doubleclick_addmode">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Append to the playlist</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Replace the playlist</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Open in new playlist</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Add to the queue</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="doubleclick_playmode">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Never start playing</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Play if there is nothing already playing</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Always start playing</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -16,26 +16,29 @@
|
||||
*/
|
||||
|
||||
#include "globalshortcutgrabber.h"
|
||||
#include "globalshortcutsconfig.h"
|
||||
#include "ui_globalshortcutsconfig.h"
|
||||
#include "globalshortcutssettingspage.h"
|
||||
#include "ui_globalshortcutssettingspage.h"
|
||||
#include "core/globalshortcuts.h"
|
||||
#include "ui/iconloader.h"
|
||||
#include "ui/settingsdialog.h"
|
||||
|
||||
#include <QtDebug>
|
||||
#include <QSettings>
|
||||
#include <QPushButton>
|
||||
#include <QKeyEvent>
|
||||
#include <QProcess>
|
||||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
#include <QPushButton>
|
||||
#include <QSettings>
|
||||
#include <QtDebug>
|
||||
|
||||
GlobalShortcutsConfig::GlobalShortcutsConfig(QWidget* parent)
|
||||
: QWidget(parent),
|
||||
ui_(new Ui_GlobalShortcutsConfig),
|
||||
manager_(NULL),
|
||||
GlobalShortcutsSettingsPage::GlobalShortcutsSettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog),
|
||||
ui_(new Ui_GlobalShortcutsSettingsPage),
|
||||
initialised_(false),
|
||||
grabber_(new GlobalShortcutGrabber)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
ui_->shortcut_options->setEnabled(false);
|
||||
ui_->list->header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
setWindowIcon(IconLoader::Load("input-keyboard"));
|
||||
|
||||
settings_.beginGroup(GlobalShortcuts::kSettingsGroup);
|
||||
|
||||
@ -47,35 +50,47 @@ GlobalShortcutsConfig::GlobalShortcutsConfig(QWidget* parent)
|
||||
connect(ui_->gnome_open, SIGNAL(clicked()), SLOT(OpenGnomeKeybindingProperties()));
|
||||
}
|
||||
|
||||
void GlobalShortcutsConfig::SetManager(GlobalShortcuts *manager) {
|
||||
manager_ = manager;
|
||||
|
||||
connect(ui_->mac_open, SIGNAL(clicked()), manager_, SLOT(ShowMacAccessibilityDialog()));
|
||||
|
||||
if (!manager->IsGsdAvailable()) {
|
||||
ui_->gnome_container->hide();
|
||||
}
|
||||
|
||||
foreach (const GlobalShortcuts::Shortcut& s, manager_->shortcuts().values()) {
|
||||
Shortcut shortcut;
|
||||
shortcut.s = s;
|
||||
shortcut.key = s.action->shortcut();
|
||||
shortcut.item = new QTreeWidgetItem(ui_->list,
|
||||
QStringList() << s.action->text()
|
||||
<< s.action->shortcut().toString(QKeySequence::NativeText));
|
||||
shortcut.item->setData(0, Qt::UserRole, s.id);
|
||||
shortcuts_[s.id] = shortcut;
|
||||
}
|
||||
|
||||
ui_->list->sortItems(0, Qt::AscendingOrder);
|
||||
ItemClicked(ui_->list->topLevelItem(0));
|
||||
}
|
||||
|
||||
GlobalShortcutsConfig::~GlobalShortcutsConfig() {
|
||||
GlobalShortcutsSettingsPage::~GlobalShortcutsSettingsPage() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void GlobalShortcutsConfig::Load() {
|
||||
bool GlobalShortcutsSettingsPage::IsEnabled() const {
|
||||
#ifdef Q_OS_MAC
|
||||
if (QSysInfo::MacintoshVersion != QSysInfo::MV_SNOWLEOPARD) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GlobalShortcutsSettingsPage::Load() {
|
||||
GlobalShortcuts* manager = dialog()->global_shortcuts_manager();
|
||||
|
||||
if (!initialised_) {
|
||||
initialised_ = true;
|
||||
|
||||
connect(ui_->mac_open, SIGNAL(clicked()), manager, SLOT(ShowMacAccessibilityDialog()));
|
||||
|
||||
if (!manager->IsGsdAvailable()) {
|
||||
ui_->gnome_container->hide();
|
||||
}
|
||||
|
||||
foreach (const GlobalShortcuts::Shortcut& s, manager->shortcuts().values()) {
|
||||
Shortcut shortcut;
|
||||
shortcut.s = s;
|
||||
shortcut.key = s.action->shortcut();
|
||||
shortcut.item = new QTreeWidgetItem(ui_->list,
|
||||
QStringList() << s.action->text()
|
||||
<< s.action->shortcut().toString(QKeySequence::NativeText));
|
||||
shortcut.item->setData(0, Qt::UserRole, s.id);
|
||||
shortcuts_[s.id] = shortcut;
|
||||
}
|
||||
|
||||
ui_->list->sortItems(0, Qt::AscendingOrder);
|
||||
ItemClicked(ui_->list->topLevelItem(0));
|
||||
}
|
||||
|
||||
foreach (const Shortcut& s, shortcuts_.values()) {
|
||||
SetShortcut(s.s.id, s.s.action->shortcut());
|
||||
}
|
||||
@ -85,17 +100,17 @@ void GlobalShortcutsConfig::Load() {
|
||||
ui_->gnome_checkbox->setChecked(use_gnome);
|
||||
}
|
||||
|
||||
ui_->mac_container->setVisible(!manager_->IsMacAccessibilityEnabled());
|
||||
ui_->mac_container->setVisible(!manager->IsMacAccessibilityEnabled());
|
||||
}
|
||||
|
||||
void GlobalShortcutsConfig::SetShortcut(const QString& id, const QKeySequence& key) {
|
||||
void GlobalShortcutsSettingsPage::SetShortcut(const QString& id, const QKeySequence& key) {
|
||||
Shortcut& shortcut = shortcuts_[id];
|
||||
|
||||
shortcut.key = key;
|
||||
shortcut.item->setText(1, key.toString(QKeySequence::NativeText));
|
||||
}
|
||||
|
||||
void GlobalShortcutsConfig::Save() {
|
||||
void GlobalShortcutsSettingsPage::Save() {
|
||||
foreach (const Shortcut& s, shortcuts_.values()) {
|
||||
s.s.action->setShortcut(s.key);
|
||||
settings_.setValue(s.s.id, s.key.toString());
|
||||
@ -103,10 +118,10 @@ void GlobalShortcutsConfig::Save() {
|
||||
|
||||
settings_.setValue("use_gnome", ui_->gnome_checkbox->isChecked());
|
||||
|
||||
manager_->ReloadSettings();
|
||||
dialog()->global_shortcuts_manager()->ReloadSettings();
|
||||
}
|
||||
|
||||
void GlobalShortcutsConfig::ItemClicked(QTreeWidgetItem* item) {
|
||||
void GlobalShortcutsSettingsPage::ItemClicked(QTreeWidgetItem* item) {
|
||||
current_id_ = item->data(0, Qt::UserRole).toString();
|
||||
Shortcut& shortcut = shortcuts_[current_id_];
|
||||
|
||||
@ -122,18 +137,19 @@ void GlobalShortcutsConfig::ItemClicked(QTreeWidgetItem* item) {
|
||||
ui_->radio_custom->setChecked(true);
|
||||
}
|
||||
|
||||
void GlobalShortcutsConfig::NoneClicked() {
|
||||
void GlobalShortcutsSettingsPage::NoneClicked() {
|
||||
SetShortcut(current_id_, QKeySequence());
|
||||
}
|
||||
|
||||
void GlobalShortcutsConfig::DefaultClicked() {
|
||||
void GlobalShortcutsSettingsPage::DefaultClicked() {
|
||||
SetShortcut(current_id_, shortcuts_[current_id_].s.default_key);
|
||||
}
|
||||
|
||||
void GlobalShortcutsConfig::ChangeClicked() {
|
||||
manager_->Unregister();
|
||||
void GlobalShortcutsSettingsPage::ChangeClicked() {
|
||||
GlobalShortcuts* manager = dialog()->global_shortcuts_manager();
|
||||
manager->Unregister();
|
||||
QKeySequence key = grabber_->GetKey(shortcuts_[current_id_].s.action->text());
|
||||
manager_->Register();
|
||||
manager->Register();
|
||||
|
||||
if (key.isEmpty())
|
||||
return;
|
||||
@ -148,7 +164,7 @@ void GlobalShortcutsConfig::ChangeClicked() {
|
||||
SetShortcut(current_id_, key);
|
||||
}
|
||||
|
||||
void GlobalShortcutsConfig::OpenGnomeKeybindingProperties() {
|
||||
void GlobalShortcutsSettingsPage::OpenGnomeKeybindingProperties() {
|
||||
if (!QProcess::startDetached("gnome-keybinding-properties")) {
|
||||
QMessageBox::warning(this, "Error",
|
||||
tr("The \"%1\" command could not be started.")
|
@ -15,35 +15,35 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GLOBALSHORTCUTSCONFIG_H
|
||||
#define GLOBALSHORTCUTSCONFIG_H
|
||||
#ifndef GLOBALSHORTCUTSSETTINGSPAGE_H
|
||||
#define GLOBALSHORTCUTSSETTINGSPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMap>
|
||||
#include <QSettings>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include "core/globalshortcuts.h"
|
||||
#include "ui/settingspage.h"
|
||||
|
||||
class QTreeWidgetItem;
|
||||
|
||||
class Ui_GlobalShortcutsConfig;
|
||||
class Ui_GlobalShortcutsSettingsPage;
|
||||
class GlobalShortcutGrabber;
|
||||
|
||||
class GlobalShortcutsConfig : public QWidget {
|
||||
class GlobalShortcutsSettingsPage : public SettingsPage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GlobalShortcutsConfig(QWidget* parent = 0);
|
||||
~GlobalShortcutsConfig();
|
||||
public:
|
||||
GlobalShortcutsSettingsPage(SettingsDialog* dialog);
|
||||
~GlobalShortcutsSettingsPage();
|
||||
|
||||
void SetManager(GlobalShortcuts* manager);
|
||||
bool IsEnabled() const;
|
||||
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
private slots:
|
||||
private slots:
|
||||
void ItemClicked(QTreeWidgetItem*);
|
||||
void NoneClicked();
|
||||
void DefaultClicked();
|
||||
@ -51,7 +51,7 @@ class GlobalShortcutsConfig : public QWidget {
|
||||
|
||||
void OpenGnomeKeybindingProperties();
|
||||
|
||||
private:
|
||||
private:
|
||||
struct Shortcut {
|
||||
GlobalShortcuts::Shortcut s;
|
||||
QKeySequence key;
|
||||
@ -60,10 +60,10 @@ class GlobalShortcutsConfig : public QWidget {
|
||||
|
||||
void SetShortcut(const QString& id, const QKeySequence& key);
|
||||
|
||||
private:
|
||||
Ui_GlobalShortcutsConfig* ui_;
|
||||
private:
|
||||
Ui_GlobalShortcutsSettingsPage* ui_;
|
||||
|
||||
GlobalShortcuts* manager_;
|
||||
bool initialised_;
|
||||
boost::scoped_ptr<GlobalShortcutGrabber> grabber_;
|
||||
|
||||
QSettings settings_;
|
||||
@ -72,4 +72,4 @@ class GlobalShortcutsConfig : public QWidget {
|
||||
QString current_id_;
|
||||
};
|
||||
|
||||
#endif // GLOBALSHORTCUTSCONFIG_H
|
||||
#endif // GLOBALSHORTCUTSSETTINGSPAGE_H
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GlobalShortcutsConfig</class>
|
||||
<widget class="QWidget" name="GlobalShortcutsConfig">
|
||||
<class>GlobalShortcutsSettingsPage</class>
|
||||
<widget class="QWidget" name="GlobalShortcutsSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
@ -48,7 +48,6 @@
|
||||
#include "library/groupbydialog.h"
|
||||
#include "library/library.h"
|
||||
#include "library/librarybackend.h"
|
||||
#include "library/libraryconfig.h"
|
||||
#include "library/librarydirectorymodel.h"
|
||||
#include "library/libraryfilterwidget.h"
|
||||
#include "library/libraryviewcontainer.h"
|
||||
|
89
src/ui/networkproxysettingspage.cpp
Normal file
89
src/ui/networkproxysettingspage.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "iconloader.h"
|
||||
#include "networkproxysettingspage.h"
|
||||
#include "ui_networkproxysettingspage.h"
|
||||
#include "core/networkproxyfactory.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
|
||||
NetworkProxySettingsPage::NetworkProxySettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog),
|
||||
ui_(new Ui_NetworkProxySettingsPage)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
setWindowIcon(IconLoader::Load("applications-internet"));
|
||||
}
|
||||
|
||||
NetworkProxySettingsPage::~NetworkProxySettingsPage() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void NetworkProxySettingsPage::Load() {
|
||||
QSettings s;
|
||||
|
||||
s.beginGroup(NetworkProxyFactory::kSettingsGroup);
|
||||
NetworkProxyFactory::Mode mode = NetworkProxyFactory::Mode(
|
||||
s.value("mode", NetworkProxyFactory::Mode_System).toInt());
|
||||
switch (mode) {
|
||||
case NetworkProxyFactory::Mode_Manual:
|
||||
ui_->proxy_manual->setChecked(true);
|
||||
break;
|
||||
|
||||
case NetworkProxyFactory::Mode_Direct:
|
||||
ui_->proxy_direct->setChecked(true);
|
||||
break;
|
||||
|
||||
case NetworkProxyFactory::Mode_System:
|
||||
default:
|
||||
ui_->proxy_system->setChecked(true);
|
||||
break;
|
||||
}
|
||||
|
||||
ui_->proxy_type->setCurrentIndex(s.value("type", QNetworkProxy::HttpProxy)
|
||||
.toInt() == QNetworkProxy::HttpProxy ? 0 : 1);
|
||||
ui_->proxy_hostname->setText(s.value("hostname").toString());
|
||||
ui_->proxy_port->setValue(s.value("port").toInt());
|
||||
ui_->proxy_auth->setChecked(s.value("use_authentication", false).toBool());
|
||||
ui_->proxy_username->setText(s.value("username").toString());
|
||||
ui_->proxy_password->setText(s.value("password").toString());
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
void NetworkProxySettingsPage::Save() {
|
||||
QSettings s;
|
||||
|
||||
NetworkProxyFactory::Mode mode = NetworkProxyFactory::Mode_System;
|
||||
if (ui_->proxy_direct->isChecked()) mode = NetworkProxyFactory::Mode_Direct;
|
||||
else if (ui_->proxy_system->isChecked()) mode = NetworkProxyFactory::Mode_System;
|
||||
else if (ui_->proxy_manual->isChecked()) mode = NetworkProxyFactory::Mode_Manual;
|
||||
|
||||
s.beginGroup(NetworkProxyFactory::kSettingsGroup);
|
||||
s.setValue("mode", mode);
|
||||
s.setValue("type", ui_->proxy_type->currentIndex() == 0 ?
|
||||
QNetworkProxy::HttpProxy : QNetworkProxy::Socks5Proxy);
|
||||
s.setValue("hostname", ui_->proxy_hostname->text());
|
||||
s.setValue("port", ui_->proxy_port->value());
|
||||
s.setValue("use_authentication", ui_->proxy_auth->isChecked());
|
||||
s.setValue("username", ui_->proxy_username->text());
|
||||
s.setValue("password", ui_->proxy_password->text());
|
||||
s.endGroup();
|
||||
|
||||
NetworkProxyFactory::Instance()->ReloadSettings();
|
||||
}
|
39
src/ui/networkproxysettingspage.h
Normal file
39
src/ui/networkproxysettingspage.h
Normal file
@ -0,0 +1,39 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef NETWORKPROXYSETTINGSPAGE_H
|
||||
#define NETWORKPROXYSETTINGSPAGE_H
|
||||
|
||||
#include "settingspage.h"
|
||||
|
||||
class Ui_NetworkProxySettingsPage;
|
||||
|
||||
class NetworkProxySettingsPage : public SettingsPage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
NetworkProxySettingsPage(SettingsDialog* dialog);
|
||||
~NetworkProxySettingsPage();
|
||||
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
private:
|
||||
Ui_NetworkProxySettingsPage* ui_;
|
||||
};
|
||||
|
||||
#endif // NETWORKPROXYSETTINGSPAGE_H
|
167
src/ui/networkproxysettingspage.ui
Normal file
167
src/ui/networkproxysettingspage.ui
Normal file
@ -0,0 +1,167 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NetworkProxySettingsPage</class>
|
||||
<widget class="QWidget" name="NetworkProxySettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Network Proxy</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="proxy_system">
|
||||
<property name="text">
|
||||
<string>Use the system proxy settings</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="proxy_direct">
|
||||
<property name="text">
|
||||
<string>Direct internet connection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="proxy_manual">
|
||||
<property name="text">
|
||||
<string>Manual proxy configuration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="proxy_manual_container" native="true">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="leftMargin">
|
||||
<number>24</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QComboBox" name="proxy_type">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>HTTP proxy</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>SOCKS proxy</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="proxy_hostname"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="proxy_port">
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>8080</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="proxy_auth">
|
||||
<property name="title">
|
||||
<string>Use authentication</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_7">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Username</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="proxy_username"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="proxy_password">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>36</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>proxy_manual</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>proxy_manual_container</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>39</x>
|
||||
<y>76</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>29</x>
|
||||
<y>99</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
300
src/ui/notificationssettingspage.cpp
Normal file
300
src/ui/notificationssettingspage.cpp
Normal file
@ -0,0 +1,300 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "iconloader.h"
|
||||
#include "notificationssettingspage.h"
|
||||
#include "settingsdialog.h"
|
||||
#include "ui_notificationssettingspage.h"
|
||||
#include "widgets/osdpretty.h"
|
||||
|
||||
#include <QColorDialog>
|
||||
#include <QFontDialog>
|
||||
#include <QMenu>
|
||||
#include <QToolTip>
|
||||
|
||||
NotificationsSettingsPage::NotificationsSettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog),
|
||||
ui_(new Ui_NotificationsSettingsPage),
|
||||
pretty_popup_(new OSDPretty(OSDPretty::Mode_Draggable))
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
setWindowIcon(IconLoader::Load("help-hint"));
|
||||
|
||||
pretty_popup_->ShowMessage(tr("OSD Preview"), tr("Drag to reposition"),
|
||||
QImage(":nocover.png"));
|
||||
|
||||
ui_->notifications_bg_preset->setItemData(0, QColor(OSDPretty::kPresetBlue), Qt::DecorationRole);
|
||||
ui_->notifications_bg_preset->setItemData(1, QColor(OSDPretty::kPresetOrange), Qt::DecorationRole);
|
||||
|
||||
// Create and populate the helper menus
|
||||
QMenu* menu = new QMenu(this);
|
||||
menu->addAction(ui_->action_artist);
|
||||
menu->addAction(ui_->action_album);
|
||||
menu->addAction(ui_->action_title);
|
||||
menu->addAction(ui_->action_albumartist);
|
||||
menu->addAction(ui_->action_year);
|
||||
menu->addAction(ui_->action_composer);
|
||||
menu->addAction(ui_->action_length);
|
||||
menu->addAction(ui_->action_disc);
|
||||
menu->addAction(ui_->action_track);
|
||||
menu->addAction(ui_->action_genre);
|
||||
menu->addAction(ui_->action_playcount);
|
||||
menu->addAction(ui_->action_skipcount);
|
||||
menu->addSeparator();
|
||||
menu->addAction(ui_->action_newline);
|
||||
ui_->notifications_exp_chooser1->setMenu(menu);
|
||||
ui_->notifications_exp_chooser2->setMenu(menu);
|
||||
ui_->notifications_exp_chooser1->setPopupMode(QToolButton::InstantPopup);
|
||||
ui_->notifications_exp_chooser2->setPopupMode(QToolButton::InstantPopup);
|
||||
// We need this because by default menus don't show tooltips
|
||||
connect(menu, SIGNAL(hovered(QAction*)), SLOT(ShowMenuTooltip(QAction*)));
|
||||
|
||||
connect(ui_->notifications_none, SIGNAL(toggled(bool)), SLOT(NotificationTypeChanged()));
|
||||
connect(ui_->notifications_native, SIGNAL(toggled(bool)), SLOT(NotificationTypeChanged()));
|
||||
connect(ui_->notifications_tray, SIGNAL(toggled(bool)), SLOT(NotificationTypeChanged()));
|
||||
connect(ui_->notifications_pretty, SIGNAL(toggled(bool)), SLOT(NotificationTypeChanged()));
|
||||
connect(ui_->notifications_opacity, SIGNAL(valueChanged(int)), SLOT(PrettyOpacityChanged(int)));
|
||||
connect(ui_->notifications_bg_preset, SIGNAL(activated(int)), SLOT(PrettyColorPresetChanged(int)));
|
||||
connect(ui_->notifications_fg_choose, SIGNAL(clicked()), SLOT(ChooseFgColor()));
|
||||
connect(ui_->notifications_font_choose, SIGNAL(clicked()), SLOT(ChooseFont()));
|
||||
connect(ui_->notifications_exp_chooser1, SIGNAL(triggered(QAction*)), SLOT(InsertVariableFirstLine(QAction*)));
|
||||
connect(ui_->notifications_exp_chooser2, SIGNAL(triggered(QAction*)), SLOT(InsertVariableSecondLine(QAction*)));
|
||||
connect(ui_->notifications_disable_duration, SIGNAL(toggled(bool)), ui_->notifications_duration, SLOT(setDisabled(bool)));
|
||||
|
||||
if (!OSD::SupportsNativeNotifications())
|
||||
ui_->notifications_native->setEnabled(false);
|
||||
if (!OSD::SupportsTrayPopups())
|
||||
ui_->notifications_tray->setEnabled(false);
|
||||
|
||||
connect(ui_->notifications_pretty, SIGNAL(toggled(bool)), SLOT(UpdatePopupVisible()));
|
||||
|
||||
connect(ui_->notifications_custom_text_enabled, SIGNAL(toggled(bool)), SLOT(NotificationCustomTextChanged(bool)));
|
||||
connect(ui_->notifications_preview, SIGNAL(clicked()), SLOT(PrepareNotificationPreview()));
|
||||
|
||||
// Icons
|
||||
ui_->notifications_exp_chooser1->setIcon(IconLoader::Load("list-add"));
|
||||
ui_->notifications_exp_chooser2->setIcon(IconLoader::Load("list-add"));
|
||||
}
|
||||
|
||||
NotificationsSettingsPage::~NotificationsSettingsPage() {
|
||||
delete pretty_popup_;
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::showEvent(QShowEvent*) {
|
||||
UpdatePopupVisible();
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::hideEvent(QHideEvent*) {
|
||||
UpdatePopupVisible();
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::Load() {
|
||||
QSettings s;
|
||||
|
||||
s.beginGroup(OSD::kSettingsGroup);
|
||||
OSD::Behaviour osd_behaviour = OSD::Behaviour(s.value("Behaviour", OSD::Native).toInt());
|
||||
switch (osd_behaviour) {
|
||||
case OSD::Native:
|
||||
if (OSD::SupportsNativeNotifications()) {
|
||||
ui_->notifications_native->setChecked(true);
|
||||
break;
|
||||
}
|
||||
// Fallthrough
|
||||
|
||||
case OSD::Pretty:
|
||||
ui_->notifications_pretty->setChecked(true);
|
||||
break;
|
||||
|
||||
case OSD::TrayPopup:
|
||||
if (OSD::SupportsTrayPopups()) {
|
||||
ui_->notifications_tray->setChecked(true);
|
||||
break;
|
||||
}
|
||||
// Fallthrough
|
||||
|
||||
case OSD::Disabled:
|
||||
default:
|
||||
ui_->notifications_none->setChecked(true);
|
||||
break;
|
||||
}
|
||||
ui_->notifications_duration->setValue(s.value("Timeout", 5000).toInt() / 1000);
|
||||
ui_->notifications_volume->setChecked(s.value("ShowOnVolumeChange", false).toBool());
|
||||
ui_->notifications_play_mode->setChecked(s.value("ShowOnPlayModeChange", true).toBool());
|
||||
ui_->notifications_art->setChecked(s.value("ShowArt", true).toBool());
|
||||
ui_->notifications_custom_text_enabled->setChecked(s.value("CustomTextEnabled", false).toBool());
|
||||
ui_->notifications_custom_text1->setText(s.value("CustomText1").toString());
|
||||
ui_->notifications_custom_text2->setText(s.value("CustomText2").toString());
|
||||
s.endGroup();
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
ui_->notifications_options->setEnabled(ui_->notifications_pretty->isChecked());
|
||||
#endif
|
||||
|
||||
// Pretty OSD
|
||||
pretty_popup_->ReloadSettings();
|
||||
ui_->notifications_opacity->setValue(pretty_popup_->background_opacity() * 100);
|
||||
|
||||
QRgb color = pretty_popup_->background_color();
|
||||
if (color == OSDPretty::kPresetBlue)
|
||||
ui_->notifications_bg_preset->setCurrentIndex(0);
|
||||
else if (color == OSDPretty::kPresetOrange)
|
||||
ui_->notifications_bg_preset->setCurrentIndex(1);
|
||||
else
|
||||
ui_->notifications_bg_preset->setCurrentIndex(2);
|
||||
ui_->notifications_bg_preset->setItemData(2, QColor(color), Qt::DecorationRole);
|
||||
ui_->notifications_disable_duration->setChecked(pretty_popup_->disable_duration());
|
||||
UpdatePopupVisible();
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::Save() {
|
||||
QSettings s;
|
||||
|
||||
OSD::Behaviour osd_behaviour = OSD::Disabled;
|
||||
if (ui_->notifications_none->isChecked()) osd_behaviour = OSD::Disabled;
|
||||
else if (ui_->notifications_native->isChecked()) osd_behaviour = OSD::Native;
|
||||
else if (ui_->notifications_tray->isChecked()) osd_behaviour = OSD::TrayPopup;
|
||||
else if (ui_->notifications_pretty->isChecked()) osd_behaviour = OSD::Pretty;
|
||||
|
||||
s.beginGroup(OSD::kSettingsGroup);
|
||||
s.setValue("Behaviour", int(osd_behaviour));
|
||||
s.setValue("Timeout", ui_->notifications_duration->value() * 1000);
|
||||
s.setValue("ShowOnVolumeChange", ui_->notifications_volume->isChecked());
|
||||
s.setValue("ShowOnPlayModeChange", ui_->notifications_play_mode->isChecked());
|
||||
s.setValue("ShowArt", ui_->notifications_art->isChecked());
|
||||
s.setValue("CustomTextEnabled", ui_->notifications_custom_text_enabled->isChecked());
|
||||
s.setValue("CustomText1", ui_->notifications_custom_text1->text());
|
||||
s.setValue("CustomText2", ui_->notifications_custom_text2->text());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(OSDPretty::kSettingsGroup);
|
||||
s.setValue("foreground_color", pretty_popup_->foreground_color());
|
||||
s.setValue("background_color", pretty_popup_->background_color());
|
||||
s.setValue("background_opacity", pretty_popup_->background_opacity());
|
||||
s.setValue("popup_display", pretty_popup_->popup_display());
|
||||
s.setValue("popup_pos", pretty_popup_->popup_pos());
|
||||
s.setValue("font", pretty_popup_->font().toString());
|
||||
s.setValue("disable_duration", ui_->notifications_disable_duration->isChecked());
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::PrettyOpacityChanged(int value) {
|
||||
pretty_popup_->set_background_opacity(qreal(value) / 100.0);
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::UpdatePopupVisible() {
|
||||
pretty_popup_->setVisible(
|
||||
isVisible() &&
|
||||
ui_->notifications_pretty->isChecked());
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::PrettyColorPresetChanged(int index) {
|
||||
if (dialog()->is_loading_settings())
|
||||
return;
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
pretty_popup_->set_background_color(OSDPretty::kPresetBlue);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
pretty_popup_->set_background_color(OSDPretty::kPresetOrange);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
default:
|
||||
ChooseBgColor();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::ChooseBgColor() {
|
||||
QColor color = QColorDialog::getColor(pretty_popup_->background_color(), this);
|
||||
if (!color.isValid())
|
||||
return;
|
||||
|
||||
pretty_popup_->set_background_color(color.rgb());
|
||||
ui_->notifications_bg_preset->setItemData(2, color, Qt::DecorationRole);
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::ChooseFgColor() {
|
||||
QColor color = QColorDialog::getColor(pretty_popup_->foreground_color(), this);
|
||||
if (!color.isValid())
|
||||
return;
|
||||
|
||||
pretty_popup_->set_foreground_color(color.rgb());
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::ChooseFont() {
|
||||
bool ok;
|
||||
QFont font = QFontDialog::getFont(&ok, pretty_popup_->font(), this);
|
||||
if (ok)
|
||||
pretty_popup_->set_font(font);
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::NotificationCustomTextChanged(bool enabled) {
|
||||
ui_->notifications_custom_text1->setEnabled(enabled);
|
||||
ui_->notifications_custom_text2->setEnabled(enabled);
|
||||
ui_->notifications_exp_chooser1->setEnabled(enabled);
|
||||
ui_->notifications_exp_chooser2->setEnabled(enabled);
|
||||
ui_->notifications_preview->setEnabled(enabled);
|
||||
ui_->label_19->setEnabled(enabled);
|
||||
ui_->label_20->setEnabled(enabled);
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::PrepareNotificationPreview() {
|
||||
OSD::Behaviour notificationType = OSD::Disabled;
|
||||
if (ui_->notifications_native->isChecked()) {
|
||||
notificationType = OSD::Native;
|
||||
} else if (ui_->notifications_pretty->isChecked()) {
|
||||
notificationType = OSD::Pretty;
|
||||
} else if (ui_->notifications_tray->isChecked()) {
|
||||
notificationType = OSD::TrayPopup;
|
||||
}
|
||||
|
||||
// If user changes timeout or other options, that won't be reflected in the preview
|
||||
emit NotificationPreview(notificationType, ui_->notifications_custom_text1->text(), ui_->notifications_custom_text2->text());
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::InsertVariableFirstLine(QAction* action) {
|
||||
// We use action name, therefore those shouldn't be translatable
|
||||
ui_->notifications_custom_text1->insert(action->text());
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::InsertVariableSecondLine(QAction* action) {
|
||||
// We use action name, therefore those shouldn't be translatable
|
||||
ui_->notifications_custom_text2->insert(action->text());
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::ShowMenuTooltip(QAction* action) {
|
||||
QToolTip::showText(QCursor::pos(), action->toolTip());
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::NotificationTypeChanged() {
|
||||
bool enabled = !ui_->notifications_none->isChecked();
|
||||
bool pretty = ui_->notifications_pretty->isChecked();
|
||||
|
||||
ui_->notifications_general->setEnabled(enabled);
|
||||
ui_->notifications_pretty_group->setEnabled(pretty);
|
||||
ui_->notifications_custom_text_group->setEnabled(enabled);
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
ui_->notifications_options->setEnabled(pretty);
|
||||
#endif
|
||||
ui_->notifications_duration->setEnabled(!pretty || (pretty && !ui_->notifications_disable_duration->isChecked()));
|
||||
ui_->notifications_disable_duration->setEnabled(pretty);
|
||||
}
|
60
src/ui/notificationssettingspage.h
Normal file
60
src/ui/notificationssettingspage.h
Normal file
@ -0,0 +1,60 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef NOTIFICATIONSSETTINGSPAGE_H
|
||||
#define NOTIFICATIONSSETTINGSPAGE_H
|
||||
|
||||
#include "settingspage.h"
|
||||
|
||||
class Ui_NotificationsSettingsPage;
|
||||
|
||||
class NotificationsSettingsPage : public SettingsPage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
NotificationsSettingsPage(SettingsDialog* dialog);
|
||||
~NotificationsSettingsPage();
|
||||
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
protected:
|
||||
void hideEvent(QHideEvent*);
|
||||
void showEvent(QShowEvent*);
|
||||
|
||||
private slots:
|
||||
void NotificationTypeChanged();
|
||||
void NotificationCustomTextChanged(bool enabled);
|
||||
void PrepareNotificationPreview();
|
||||
void InsertVariableFirstLine(QAction* action);
|
||||
void InsertVariableSecondLine(QAction* action);
|
||||
void ShowMenuTooltip(QAction* action);
|
||||
|
||||
void PrettyOpacityChanged(int value);
|
||||
void PrettyColorPresetChanged(int index);
|
||||
void ChooseBgColor();
|
||||
void ChooseFgColor();
|
||||
void ChooseFont();
|
||||
|
||||
void UpdatePopupVisible();
|
||||
|
||||
private:
|
||||
Ui_NotificationsSettingsPage* ui_;
|
||||
OSDPretty* pretty_popup_;
|
||||
};
|
||||
|
||||
#endif // NOTIFICATIONSSETTINGSPAGE_H
|
440
src/ui/notificationssettingspage.ui
Normal file
440
src/ui/notificationssettingspage.ui
Normal file
@ -0,0 +1,440 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NotificationsSettingsPage</class>
|
||||
<widget class="QWidget" name="NotificationsSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>526</width>
|
||||
<height>642</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Notifications</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Clementine can show a message when the track changes.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Notification type</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="notifications_none">
|
||||
<property name="text">
|
||||
<string>Disabled</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="notifications_native">
|
||||
<property name="text">
|
||||
<string>Show a native desktop notification</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="notifications_pretty">
|
||||
<property name="text">
|
||||
<string>Show a pretty OSD</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="notifications_tray">
|
||||
<property name="text">
|
||||
<string>Show a popup from the system tray</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="notifications_general">
|
||||
<property name="title">
|
||||
<string>General settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QWidget" name="notifications_options" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Popup duration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="notifications_duration">
|
||||
<property name="suffix">
|
||||
<string> seconds</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="notifications_disable_duration">
|
||||
<property name="text">
|
||||
<string>Disable duration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="notifications_volume">
|
||||
<property name="text">
|
||||
<string>Show a notification when I change the volume</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="notifications_play_mode">
|
||||
<property name="text">
|
||||
<string>Show a notification when I change the repeat/shuffle mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="notifications_art">
|
||||
<property name="text">
|
||||
<string>Include album art in the notification</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="notifications_custom_text_group">
|
||||
<property name="title">
|
||||
<string>Custom message settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_26">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="notifications_custom_text_enabled">
|
||||
<property name="text">
|
||||
<string>Use a custom message for notifications</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="notifications_preview">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="notifications_custom_text1">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="notifications_exp_chooser1">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>Summary</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>Body</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="notifications_custom_text2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="notifications_exp_chooser2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="notifications_pretty_group">
|
||||
<property name="title">
|
||||
<string>Pretty OSD options</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Background opacity</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QSlider" name="notifications_opacity">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Background color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="notifications_bg_preset">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Basic Blue</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Clementine Orange</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Custom...</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Text options</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="notifications_fg_choose">
|
||||
<property name="text">
|
||||
<string>Choose color...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="notifications_font_choose">
|
||||
<property name="text">
|
||||
<string>Choose font...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<action name="action_artist">
|
||||
<property name="text">
|
||||
<string notr="true">%artist%</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add song artist tag</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_album">
|
||||
<property name="text">
|
||||
<string notr="true">%album%</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add song album tag</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_title">
|
||||
<property name="text">
|
||||
<string notr="true">%title%</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add song title tag</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_albumartist">
|
||||
<property name="text">
|
||||
<string notr="true">%albumartist%</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add song albumartist tag</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_year">
|
||||
<property name="text">
|
||||
<string notr="true">%year%</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add song year tag</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_composer">
|
||||
<property name="text">
|
||||
<string notr="true">%composer%</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add song composer tag</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_disc">
|
||||
<property name="text">
|
||||
<string notr="true">%disc%</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add song disc tag</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_track">
|
||||
<property name="text">
|
||||
<string notr="true">%track%</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add song track tag</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_genre">
|
||||
<property name="text">
|
||||
<string notr="true">%genre%</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add song genre tag</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_length">
|
||||
<property name="text">
|
||||
<string notr="true">%length%</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add song length tag</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_playcount">
|
||||
<property name="text">
|
||||
<string notr="true">%playcount%</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add song play count</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_skipcount">
|
||||
<property name="text">
|
||||
<string notr="true">%skipcount%</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add song skip count</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_newline">
|
||||
<property name="text">
|
||||
<string notr="true">%newline%</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add a new line if supported by the notification type</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
143
src/ui/playbacksettingspage.cpp
Normal file
143
src/ui/playbacksettingspage.cpp
Normal file
@ -0,0 +1,143 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "iconloader.h"
|
||||
#include "playbacksettingspage.h"
|
||||
#include "settingsdialog.h"
|
||||
#include "ui_playbacksettingspage.h"
|
||||
#include "engines/gstengine.h"
|
||||
#include "playlist/playlist.h"
|
||||
|
||||
|
||||
PlaybackSettingsPage::PlaybackSettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog),
|
||||
ui_(new Ui_PlaybackSettingsPage)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
setWindowIcon(IconLoader::Load("media-playback-start"));
|
||||
|
||||
connect(ui_->fading_cross, SIGNAL(toggled(bool)), SLOT(FadingOptionsChanged()));
|
||||
connect(ui_->fading_out, SIGNAL(toggled(bool)), SLOT(FadingOptionsChanged()));
|
||||
connect(ui_->fading_auto, SIGNAL(toggled(bool)), SLOT(FadingOptionsChanged()));
|
||||
connect(ui_->gst_plugin, SIGNAL(currentIndexChanged(int)), SLOT(GstPluginChanged(int)));
|
||||
|
||||
connect(ui_->replaygain_preamp, SIGNAL(valueChanged(int)), SLOT(RgPreampChanged(int)));
|
||||
ui_->replaygain_preamp_label->setMinimumWidth(
|
||||
QFontMetrics(ui_->replaygain_preamp_label->font()).width("-WW.W dB"));
|
||||
RgPreampChanged(ui_->replaygain_preamp->value());
|
||||
}
|
||||
|
||||
PlaybackSettingsPage::~PlaybackSettingsPage() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void PlaybackSettingsPage::Load() {
|
||||
const GstEngine* engine = dialog()->gst_engine();
|
||||
|
||||
if (ui_->gst_plugin->count() <= 1 && engine) {
|
||||
GstEngine::PluginDetailsList list = engine->GetOutputsList();
|
||||
|
||||
ui_->gst_plugin->setItemData(0, GstEngine::kAutoSink);
|
||||
foreach (const GstEngine::PluginDetails& details, list) {
|
||||
if (details.name == "autoaudiosink")
|
||||
continue;
|
||||
|
||||
ui_->gst_plugin->addItem(details.long_name, details.name);
|
||||
}
|
||||
ui_->gst_group->setEnabled(true);
|
||||
ui_->replaygain_group->setEnabled(true);
|
||||
}
|
||||
|
||||
QSettings s;
|
||||
|
||||
s.beginGroup(Playlist::kSettingsGroup);
|
||||
ui_->current_glow->setChecked(s.value("glow_effect", true).toBool());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(Engine::Base::kSettingsGroup);
|
||||
ui_->fading_out->setChecked(s.value("FadeoutEnabled", true).toBool());
|
||||
ui_->fading_cross->setChecked(s.value("CrossfadeEnabled", true).toBool());
|
||||
ui_->fading_auto->setChecked(s.value("AutoCrossfadeEnabled", false).toBool());
|
||||
ui_->fading_duration->setValue(s.value("FadeoutDuration", 2000).toInt());
|
||||
ui_->fading_samealbum->setChecked(s.value("NoCrossfadeSameAlbum", true).toBool());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(GstEngine::kSettingsGroup);
|
||||
QString sink = s.value("sink", GstEngine::kAutoSink).toString();
|
||||
ui_->gst_plugin->setCurrentIndex(0);
|
||||
for (int i=0 ; i<ui_->gst_plugin->count() ; ++i) {
|
||||
if (ui_->gst_plugin->itemData(i).toString() == sink) {
|
||||
ui_->gst_plugin->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ui_->gst_device->setText(s.value("device").toString());
|
||||
ui_->replaygain->setChecked(s.value("rgenabled", false).toBool());
|
||||
ui_->replaygain_mode->setCurrentIndex(s.value("rgmode", 0).toInt());
|
||||
ui_->replaygain_preamp->setValue(s.value("rgpreamp", 0.0).toDouble() * 10 + 150);
|
||||
ui_->replaygain_compression->setChecked(s.value("rgcompression", true).toBool());
|
||||
ui_->buffer_duration->setValue(s.value("bufferduration", 4000).toInt());
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
void PlaybackSettingsPage::Save() {
|
||||
QSettings s;
|
||||
|
||||
s.beginGroup(Playlist::kSettingsGroup);
|
||||
s.setValue("glow_effect", ui_->current_glow->isChecked());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(Engine::Base::kSettingsGroup);
|
||||
s.setValue("FadeoutEnabled", ui_->fading_out->isChecked());
|
||||
s.setValue("FadeoutDuration", ui_->fading_duration->value());
|
||||
s.setValue("CrossfadeEnabled", ui_->fading_cross->isChecked());
|
||||
s.setValue("AutoCrossfadeEnabled", ui_->fading_auto->isChecked());
|
||||
s.setValue("NoCrossfadeSameAlbum", ui_->fading_samealbum->isChecked());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(GstEngine::kSettingsGroup);
|
||||
s.setValue("sink", ui_->gst_plugin->itemData(ui_->gst_plugin->currentIndex()).toString());
|
||||
s.setValue("device", ui_->gst_device->text());
|
||||
s.setValue("rgenabled", ui_->replaygain->isChecked());
|
||||
s.setValue("rgmode", ui_->replaygain_mode->currentIndex());
|
||||
s.setValue("rgpreamp", float(ui_->replaygain_preamp->value()) / 10 - 15);
|
||||
s.setValue("rgcompression", ui_->replaygain_compression->isChecked());
|
||||
s.setValue("bufferduration", ui_->buffer_duration->value());
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
void PlaybackSettingsPage::GstPluginChanged(int index) {
|
||||
QString name = ui_->gst_plugin->itemData(index).toString();
|
||||
|
||||
bool enabled = GstEngine::DoesThisSinkSupportChangingTheOutputDeviceToAUserEditableString(name);
|
||||
|
||||
ui_->gst_device->setEnabled(enabled);
|
||||
ui_->gst_device_label->setEnabled(enabled);
|
||||
}
|
||||
|
||||
void PlaybackSettingsPage::RgPreampChanged(int value) {
|
||||
float db = float(value) / 10 - 15;
|
||||
QString db_str;
|
||||
db_str.sprintf("%+.1f dB", db);
|
||||
ui_->replaygain_preamp_label->setText(db_str);
|
||||
}
|
||||
|
||||
void PlaybackSettingsPage::FadingOptionsChanged() {
|
||||
ui_->fading_options->setEnabled(
|
||||
ui_->fading_out->isChecked() || ui_->fading_cross->isChecked() ||
|
||||
ui_->fading_auto->isChecked());
|
||||
}
|
44
src/ui/playbacksettingspage.h
Normal file
44
src/ui/playbacksettingspage.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PLAYBACKSETTINGSPAGE_H
|
||||
#define PLAYBACKSETTINGSPAGE_H
|
||||
|
||||
#include "settingspage.h"
|
||||
|
||||
class Ui_PlaybackSettingsPage;
|
||||
|
||||
class PlaybackSettingsPage : public SettingsPage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PlaybackSettingsPage(SettingsDialog* dialog);
|
||||
~PlaybackSettingsPage();
|
||||
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
private slots:
|
||||
void GstPluginChanged(int index);
|
||||
void FadingOptionsChanged();
|
||||
void RgPreampChanged(int value);
|
||||
|
||||
private:
|
||||
Ui_PlaybackSettingsPage* ui_;
|
||||
};
|
||||
|
||||
#endif // PLAYBACKSETTINGSPAGE_H
|
340
src/ui/playbacksettingspage.ui
Normal file
340
src/ui/playbacksettingspage.ui
Normal file
@ -0,0 +1,340 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PlaybackSettingsPage</class>
|
||||
<widget class="QWidget" name="PlaybackSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>596</width>
|
||||
<height>638</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Playback</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="current_glow">
|
||||
<property name="text">
|
||||
<string>Show a glowing animation on the current track</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Fading</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="fading_out">
|
||||
<property name="text">
|
||||
<string>Fade out when stopping a track</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="fading_cross">
|
||||
<property name="text">
|
||||
<string>Cross-fade when changing tracks manually</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="fading_auto">
|
||||
<property name="text">
|
||||
<string>Cross-fade when changing tracks automatically</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="fading_samealbum">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Except between tracks on the same album or in the same CUE sheet</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="fading_options" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Fading duration</string>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>22</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="fading_duration">
|
||||
<property name="suffix">
|
||||
<string> ms</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>257</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="replaygain_group">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Replay Gain</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="replaygain">
|
||||
<property name="text">
|
||||
<string>Use Replay Gain metadata if it is available</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Replay Gain mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="replaygain_mode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Radio (equal loudness for all tracks)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Album (ideal loudness for all tracks)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Pre-amp</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="replaygain_preamp_label"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="StickySlider" name="replaygain_preamp">
|
||||
<property name="maximum">
|
||||
<number>300</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>150</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sticky_center" stdset="0">
|
||||
<number>150</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="replaygain_compression">
|
||||
<property name="text">
|
||||
<string>Apply compression to prevent clipping</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gst_group">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>GStreamer audio engine</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Output plugin</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="gst_plugin">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Choose automatically</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="LineEdit" name="gst_device">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="hint" stdset="0">
|
||||
<string>Leave blank for the default. Examples: "/dev/dsp", "front", etc.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="gst_device_label">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Output device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="buffer_duration_label">
|
||||
<property name="text">
|
||||
<string>Buffer duration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="buffer_duration">
|
||||
<property name="suffix">
|
||||
<string> ms</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>60000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>114</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>widgets/lineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>StickySlider</class>
|
||||
<extends>QSlider</extends>
|
||||
<header>widgets/stickyslider.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>replaygain</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>widget</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>89</x>
|
||||
<y>259</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>143</x>
|
||||
<y>285</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>fading_auto</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>fading_samealbum</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>109</x>
|
||||
<y>133</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>113</x>
|
||||
<y>153</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -15,836 +15,157 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "backgroundstreamssettingspage.h"
|
||||
#include "behavioursettingspage.h"
|
||||
#include "config.h"
|
||||
#include "core/backgroundstreams.h"
|
||||
#include "core/networkproxyfactory.h"
|
||||
#include "globalshortcutssettingspage.h"
|
||||
#include "iconloader.h"
|
||||
#include "playbacksettingspage.h"
|
||||
#include "networkproxysettingspage.h"
|
||||
#include "notificationssettingspage.h"
|
||||
#include "mainwindow.h"
|
||||
#include "settingsdialog.h"
|
||||
#include "core/backgroundstreams.h"
|
||||
#include "core/networkproxyfactory.h"
|
||||
#include "engines/enginebase.h"
|
||||
#include "engines/gstengine.h"
|
||||
#include "internet/digitallyimportedsettingspage.h"
|
||||
#include "internet/magnatunesettingspage.h"
|
||||
#include "library/librarysettingspage.h"
|
||||
#include "playlist/playlistview.h"
|
||||
#include "songinfo/songinfofetcher.h"
|
||||
#include "songinfo/songinfotextview.h"
|
||||
#include "songinfo/songinfosettingspage.h"
|
||||
#include "transcoder/transcodersettingspage.h"
|
||||
|
||||
#include "widgets/osdpretty.h"
|
||||
|
||||
#include "ui_settingsdialog.h"
|
||||
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
# include "internet/lastfmconfig.h"
|
||||
# include "internet/lastfmsettingspage.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WIIMOTEDEV
|
||||
# include "ui/wiimotedevshortcutsconfig.h"
|
||||
# include "ui_wiimotedevshortcutsconfig.h"
|
||||
# include "wiimotedev/shortcuts.h"
|
||||
# include "wiimotedev/wiimotesettingspage.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REMOTE
|
||||
# include "remote/remoteconfig.h"
|
||||
# include "remote/remotesettingspage.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SPOTIFY
|
||||
# include "internet/spotifyconfig.h"
|
||||
# include "internet/spotifysettingspage.h"
|
||||
#endif
|
||||
|
||||
#include <QColorDialog>
|
||||
#include <QDir>
|
||||
#include <QFontDialog>
|
||||
#include <QMenu>
|
||||
#include <QSettings>
|
||||
#include <QToolTip>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
void SettingsDialog::AddStream(const QString& name) {
|
||||
QGroupBox* box = new QGroupBox(tr(name.toUtf8()));
|
||||
QSlider* slider = new QSlider(Qt::Horizontal, box);
|
||||
QCheckBox* check = new QCheckBox(box);
|
||||
QHBoxLayout* layout = new QHBoxLayout(box);
|
||||
layout->addWidget(slider);
|
||||
layout->addWidget(check);
|
||||
|
||||
QVBoxLayout* streams_layout = qobject_cast<QVBoxLayout*>(
|
||||
ui_->streams_page->layout());
|
||||
streams_layout->insertWidget(streams_layout->count() - 1, box);
|
||||
|
||||
slider->setProperty("stream_name", name);
|
||||
check->setProperty("stream_name", name);
|
||||
|
||||
connect(slider, SIGNAL(valueChanged(int)), SLOT(StreamVolumeChanged(int)));
|
||||
connect(check, SIGNAL(toggled(bool)), SLOT(EnableStream(bool)));
|
||||
|
||||
slider->setValue(streams_->GetStreamVolume(name));
|
||||
check->setCheckState(streams_->IsPlaying(name) ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
|
||||
void SettingsDialog::EnableStream(bool enabled) {
|
||||
const QString name = sender()->property("stream_name").toString();
|
||||
streams_->EnableStream(name, enabled);
|
||||
}
|
||||
|
||||
void SettingsDialog::StreamVolumeChanged(int value) {
|
||||
const QString name = sender()->property("stream_name").toString();
|
||||
streams_->SetStreamVolume(name, value);
|
||||
}
|
||||
|
||||
void SettingsDialog::AddStreams() {
|
||||
foreach (const QString& name, streams_->streams()) {
|
||||
AddStream(name);
|
||||
}
|
||||
}
|
||||
|
||||
SettingsDialog::SettingsDialog(BackgroundStreams* streams, QWidget* parent)
|
||||
: QDialog(parent),
|
||||
model_(NULL),
|
||||
gst_engine_(NULL),
|
||||
song_info_view_(NULL),
|
||||
streams_(streams),
|
||||
ui_(new Ui_SettingsDialog),
|
||||
loading_settings_(false),
|
||||
pretty_popup_(new OSDPretty(OSDPretty::Mode_Draggable)),
|
||||
streams_(streams)
|
||||
loading_settings_(false)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
pretty_popup_->ShowMessage(tr("OSD Preview"), tr("Drag to reposition"),
|
||||
QImage(":nocover.png"));
|
||||
|
||||
AddPage(Page_Playback, new PlaybackSettingsPage(this));
|
||||
AddPage(Page_Behaviour, new BehaviourSettingsPage(this));
|
||||
AddPage(Page_SongInformation, new SongInfoSettingsPage(this));
|
||||
AddPage(Page_GlobalShortcuts, new GlobalShortcutsSettingsPage(this));
|
||||
AddPage(Page_Notifications, new NotificationsSettingsPage(this));
|
||||
AddPage(Page_Library, new LibrarySettingsPage(this));
|
||||
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
ui_->list->insertItem(Page_Lastfm, tr("Last.fm"));
|
||||
ui_->list->item(Page_Lastfm)->setIcon(QIcon(":/last.fm/as.png"));
|
||||
|
||||
QWidget* lastfm_page = new QWidget;
|
||||
QVBoxLayout* lastfm_layout = new QVBoxLayout;
|
||||
lastfm_layout->setContentsMargins(0, 0, 0, 0);
|
||||
lastfm_config_ = new LastFMConfig;
|
||||
lastfm_layout->addWidget(lastfm_config_);
|
||||
lastfm_page->setLayout(lastfm_layout);
|
||||
|
||||
ui_->stacked_widget->insertWidget(Page_Lastfm, lastfm_page);
|
||||
AddPage(Page_Lastfm, new LastFMSettingsPage(this));
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SPOTIFY
|
||||
ui_->list->insertItem(Page_Spotify, tr("Spotify"));
|
||||
ui_->list->item(Page_Spotify)->setIcon(QIcon(":/icons/svg/spotify.svg"));
|
||||
|
||||
QWidget* spotify_page = new QWidget;
|
||||
QVBoxLayout* spotify_layout = new QVBoxLayout;
|
||||
spotify_layout->setContentsMargins(0, 0, 0, 0);
|
||||
spotify_config_ = new SpotifyConfig;
|
||||
spotify_layout->addWidget(spotify_config_);
|
||||
spotify_page->setLayout(spotify_layout);
|
||||
|
||||
ui_->stacked_widget->insertWidget(Page_Spotify, spotify_page);
|
||||
AddPage(Page_Spotify, new SpotifySettingsPage(this));
|
||||
#endif
|
||||
|
||||
AddPage(Page_Magnatune, new MagnatuneSettingsPage(this));
|
||||
AddPage(Page_DigitallyImported, new DigitallyImportedSettingsPage(this));
|
||||
AddPage(Page_BackgroundStreams, new BackgroundStreamsSettingsPage(this));
|
||||
AddPage(Page_Proxy, new NetworkProxySettingsPage(this));
|
||||
AddPage(Page_Transcoding, new TranscoderSettingsPage(this));
|
||||
|
||||
#ifdef HAVE_REMOTE
|
||||
ui_->list->insertItem(Page_Remote, tr("Remote Control"));
|
||||
ui_->list->item(Page_Remote)->setIcon(IconLoader::Load("network-server"));
|
||||
|
||||
QWidget* remote_page = new QWidget;
|
||||
QVBoxLayout* remote_layout = new QVBoxLayout;
|
||||
remote_layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
remote_config_ = new RemoteConfig;
|
||||
remote_layout->addWidget(remote_config_);
|
||||
remote_page->setLayout(remote_layout);
|
||||
|
||||
ui_->stacked_widget->insertWidget(Page_Remote, remote_page);
|
||||
AddPage(Page_Remote, new RemoteSettingsPage(this));
|
||||
#endif
|
||||
|
||||
|
||||
// Icons
|
||||
ui_->list->item(Page_Playback)->setIcon(IconLoader::Load("media-playback-start"));
|
||||
ui_->list->item(Page_SongInformation)->setIcon(IconLoader::Load("view-media-lyrics"));
|
||||
ui_->list->item(Page_GlobalShortcuts)->setIcon(IconLoader::Load("input-keyboard"));
|
||||
ui_->list->item(Page_Notifications)->setIcon(IconLoader::Load("help-hint"));
|
||||
ui_->list->item(Page_Library)->setIcon(IconLoader::Load("folder-sound"));
|
||||
ui_->list->item(Page_BackgroundStreams)->setIcon(QIcon(":/icons/32x32/weather-showers-scattered.png"));
|
||||
ui_->list->item(Page_Proxy)->setIcon(IconLoader::Load("applications-internet"));
|
||||
ui_->list->item(Page_Transcoding)->setIcon(IconLoader::Load("tools-wizard"));
|
||||
|
||||
AddStreams();
|
||||
|
||||
#ifdef HAVE_WIIMOTEDEV
|
||||
// Wiimotedev page
|
||||
ui_->list->insertItem(Page_Wiimotedev, "Wiimotedev");
|
||||
ui_->list->item(Page_Wiimotedev)->setIcon(QIcon(":/icons/32x32/wiimotedev.png"));
|
||||
|
||||
QWidget* wiimotedev_page = new QWidget(this);
|
||||
wiimotedev_page->setObjectName(QString::fromUtf8("wiimotedev_page"));
|
||||
QVBoxLayout* wiimotedev_layout = new QVBoxLayout(wiimotedev_page);
|
||||
wiimotedev_layout->setObjectName(QString::fromUtf8("wiimotedev_layout"));
|
||||
wiimotedev_config_ = new WiimotedevShortcutsConfig(wiimotedev_page);
|
||||
wiimotedev_config_->setObjectName(QString::fromUtf8("wiimotedev_config"));
|
||||
wiimotedev_layout->addWidget(wiimotedev_config_);
|
||||
|
||||
ui_->stacked_widget->addWidget(wiimotedev_page);
|
||||
|
||||
connect(wiimotedev_config_, SIGNAL(SetWiimotedevInterfaceActived(bool)), this, SIGNAL(SetWiimotedevInterfaceActived(bool)));
|
||||
#endif
|
||||
|
||||
// Playback
|
||||
connect(ui_->fading_cross, SIGNAL(toggled(bool)), SLOT(FadingOptionsChanged()));
|
||||
connect(ui_->fading_out, SIGNAL(toggled(bool)), SLOT(FadingOptionsChanged()));
|
||||
connect(ui_->fading_auto, SIGNAL(toggled(bool)), SLOT(FadingOptionsChanged()));
|
||||
connect(ui_->gst_plugin, SIGNAL(currentIndexChanged(int)), SLOT(GstPluginChanged(int)));
|
||||
|
||||
connect(ui_->replaygain_preamp, SIGNAL(valueChanged(int)), SLOT(RgPreampChanged(int)));
|
||||
ui_->replaygain_preamp_label->setMinimumWidth(
|
||||
QFontMetrics(ui_->replaygain_preamp_label->font()).width("-WW.W dB"));
|
||||
RgPreampChanged(ui_->replaygain_preamp->value());
|
||||
|
||||
// Behaviour
|
||||
connect(ui_->b_show_tray_icon_, SIGNAL(toggled(bool)), SLOT(ShowTrayIconToggled(bool)));
|
||||
|
||||
ui_->doubleclick_addmode->setItemData(0, MainWindow::AddBehaviour_Append);
|
||||
ui_->doubleclick_addmode->setItemData(1, MainWindow::AddBehaviour_Load);
|
||||
ui_->doubleclick_addmode->setItemData(2, MainWindow::AddBehaviour_OpenInNew);
|
||||
ui_->doubleclick_addmode->setItemData(3, MainWindow::AddBehaviour_Enqueue);
|
||||
|
||||
ui_->doubleclick_playmode->setItemData(0, MainWindow::PlayBehaviour_Never);
|
||||
ui_->doubleclick_playmode->setItemData(1, MainWindow::PlayBehaviour_IfStopped);
|
||||
ui_->doubleclick_playmode->setItemData(2, MainWindow::PlayBehaviour_Always);
|
||||
|
||||
ui_->menu_playmode->setItemData(0, MainWindow::PlayBehaviour_Never);
|
||||
ui_->menu_playmode->setItemData(1, MainWindow::PlayBehaviour_IfStopped);
|
||||
ui_->menu_playmode->setItemData(2, MainWindow::PlayBehaviour_Always);
|
||||
|
||||
// Populate the language combo box. We do this by looking at all the
|
||||
// compiled in translations.
|
||||
QDir dir(":/translations/");
|
||||
QStringList codes(dir.entryList(QStringList() << "*.qm"));
|
||||
QRegExp lang_re("^clementine_(.*).qm$");
|
||||
foreach (const QString& filename, codes) {
|
||||
// The regex captures the "ru" from "clementine_ru.qm"
|
||||
if (!lang_re.exactMatch(filename))
|
||||
continue;
|
||||
|
||||
QString code = lang_re.cap(1);
|
||||
QString name = QString("%1 (%2)").arg(
|
||||
QLocale::languageToString(QLocale(code).language()), code);
|
||||
|
||||
language_map_[name] = code;
|
||||
}
|
||||
|
||||
language_map_["English (en)"] = "en";
|
||||
|
||||
// Sort the names and show them in the UI
|
||||
QStringList names = language_map_.keys();
|
||||
qStableSort(names);
|
||||
ui_->language->addItems(names);
|
||||
|
||||
// Song info
|
||||
QFile song_info_preview(":/lumberjacksong.txt");
|
||||
song_info_preview.open(QIODevice::ReadOnly);
|
||||
ui_->song_info_font_preview->setText(QString::fromUtf8(song_info_preview.readAll()));
|
||||
|
||||
connect(ui_->song_info_font_size, SIGNAL(valueChanged(double)), SLOT(SongInfoFontSizeChanged(double)));
|
||||
|
||||
// Global shortcuts
|
||||
#ifdef Q_OS_MAC
|
||||
if (QSysInfo::MacintoshVersion != QSysInfo::MV_SNOWLEOPARD) {
|
||||
ui_->list->item(Page_GlobalShortcuts)->setFlags(Qt::NoItemFlags);
|
||||
}
|
||||
AddPage(Page_Wiimotedev, new WiimoteSettingsPage(this));
|
||||
#endif
|
||||
|
||||
// List box
|
||||
connect(ui_->list, SIGNAL(currentTextChanged(QString)), SLOT(CurrentTextChanged(QString)));
|
||||
ui_->list->setCurrentRow(Page_Playback);
|
||||
|
||||
// Notifications
|
||||
ui_->notifications_bg_preset->setItemData(0, QColor(OSDPretty::kPresetBlue), Qt::DecorationRole);
|
||||
ui_->notifications_bg_preset->setItemData(1, QColor(OSDPretty::kPresetOrange), Qt::DecorationRole);
|
||||
|
||||
// Create and populate the helper menus
|
||||
QMenu* menu = new QMenu(this);
|
||||
menu->addAction(ui_->action_artist);
|
||||
menu->addAction(ui_->action_album);
|
||||
menu->addAction(ui_->action_title);
|
||||
menu->addAction(ui_->action_albumartist);
|
||||
menu->addAction(ui_->action_year);
|
||||
menu->addAction(ui_->action_composer);
|
||||
menu->addAction(ui_->action_length);
|
||||
menu->addAction(ui_->action_disc);
|
||||
menu->addAction(ui_->action_track);
|
||||
menu->addAction(ui_->action_genre);
|
||||
menu->addAction(ui_->action_playcount);
|
||||
menu->addAction(ui_->action_skipcount);
|
||||
menu->addSeparator();
|
||||
menu->addAction(ui_->action_newline);
|
||||
ui_->notifications_exp_chooser1->setMenu(menu);
|
||||
ui_->notifications_exp_chooser2->setMenu(menu);
|
||||
ui_->notifications_exp_chooser1->setPopupMode(QToolButton::InstantPopup);
|
||||
ui_->notifications_exp_chooser2->setPopupMode(QToolButton::InstantPopup);
|
||||
// We need this because by default menus don't show tooltips
|
||||
connect(menu, SIGNAL(hovered(QAction*)), SLOT(ShowMenuTooltip(QAction*)));
|
||||
|
||||
connect(ui_->notifications_none, SIGNAL(toggled(bool)), SLOT(NotificationTypeChanged()));
|
||||
connect(ui_->notifications_native, SIGNAL(toggled(bool)), SLOT(NotificationTypeChanged()));
|
||||
connect(ui_->notifications_tray, SIGNAL(toggled(bool)), SLOT(NotificationTypeChanged()));
|
||||
connect(ui_->notifications_pretty, SIGNAL(toggled(bool)), SLOT(NotificationTypeChanged()));
|
||||
connect(ui_->notifications_opacity, SIGNAL(valueChanged(int)), SLOT(PrettyOpacityChanged(int)));
|
||||
connect(ui_->notifications_bg_preset, SIGNAL(activated(int)), SLOT(PrettyColorPresetChanged(int)));
|
||||
connect(ui_->notifications_fg_choose, SIGNAL(clicked()), SLOT(ChooseFgColor()));
|
||||
connect(ui_->notifications_font_choose, SIGNAL(clicked()), SLOT(ChooseFont()));
|
||||
connect(ui_->notifications_exp_chooser1, SIGNAL(triggered(QAction*)), SLOT(InsertVariableFirstLine(QAction*)));
|
||||
connect(ui_->notifications_exp_chooser2, SIGNAL(triggered(QAction*)), SLOT(InsertVariableSecondLine(QAction*)));
|
||||
connect(ui_->notifications_disable_duration, SIGNAL(toggled(bool)), ui_->notifications_duration, SLOT(setDisabled(bool)));
|
||||
|
||||
if (!OSD::SupportsNativeNotifications())
|
||||
ui_->notifications_native->setEnabled(false);
|
||||
if (!OSD::SupportsTrayPopups())
|
||||
ui_->notifications_tray->setEnabled(false);
|
||||
|
||||
connect(ui_->stacked_widget, SIGNAL(currentChanged(int)), SLOT(UpdatePopupVisible()));
|
||||
connect(ui_->notifications_pretty, SIGNAL(toggled(bool)), SLOT(UpdatePopupVisible()));
|
||||
|
||||
connect(ui_->notifications_custom_text_enabled, SIGNAL(toggled(bool)), SLOT(NotificationCustomTextChanged(bool)));
|
||||
connect(ui_->notifications_preview, SIGNAL(clicked()), SLOT(PrepareNotificationPreview()));
|
||||
|
||||
// Icons
|
||||
ui_->notifications_exp_chooser1->setIcon(IconLoader::Load("list-add"));
|
||||
ui_->notifications_exp_chooser2->setIcon(IconLoader::Load("list-add"));
|
||||
|
||||
// Make sure the list is big enough to show all the items
|
||||
ui_->list->setMinimumWidth(ui_->list->sizeHintForColumn(0));
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
ui_->b_show_tray_icon_->setEnabled(false);
|
||||
ui_->startup_group_->setEnabled(false);
|
||||
#endif
|
||||
|
||||
ui_->buttonBox->button(QDialogButtonBox::Cancel)->setShortcut(QKeySequence::Close);
|
||||
}
|
||||
|
||||
SettingsDialog::~SettingsDialog() {
|
||||
delete pretty_popup_;
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void SettingsDialog::CurrentTextChanged(const QString &text) {
|
||||
ui_->title->setText("<b>" + text + "</b>");
|
||||
}
|
||||
void SettingsDialog::AddPage(Page id, SettingsPage* page) {
|
||||
// Connect page's signals to the settings dialog's signals
|
||||
connect(page, SIGNAL(NotificationPreview(OSD::Behaviour,QString,QString)),
|
||||
SIGNAL(NotificationPreview(OSD::Behaviour,QString,QString)));
|
||||
connect(page, SIGNAL(SetWiimotedevInterfaceActived(bool)),
|
||||
SIGNAL(SetWiimotedevInterfaceActived(bool)));
|
||||
|
||||
void SettingsDialog::SetLibraryDirectoryModel(LibraryDirectoryModel* model) {
|
||||
ui_->library_config->SetModel(model);
|
||||
}
|
||||
// Create the list item
|
||||
QListWidgetItem* item = new QListWidgetItem(page->windowIcon(),
|
||||
page->windowTitle());
|
||||
ui_->list->addItem(item);
|
||||
|
||||
void SettingsDialog::SetGlobalShortcutManager(GlobalShortcuts *manager) {
|
||||
ui_->global_shortcuts->SetManager(manager);
|
||||
if (!page->IsEnabled()) {
|
||||
item->setFlags(Qt::NoItemFlags);
|
||||
}
|
||||
|
||||
// Add the page to the stack
|
||||
ui_->stacked_widget->addWidget(page);
|
||||
|
||||
// Remember where the page is
|
||||
PageData data;
|
||||
data.index_ = ui_->list->row(item);
|
||||
data.page_ = page;
|
||||
pages_[id] = data;
|
||||
}
|
||||
|
||||
void SettingsDialog::accept() {
|
||||
QSettings s;
|
||||
|
||||
// Behaviour
|
||||
MainWindow::StartupBehaviour behaviour = MainWindow::Startup_Remember;
|
||||
if (ui_->b_always_hide_->isChecked()) behaviour = MainWindow::Startup_AlwaysHide;
|
||||
if (ui_->b_always_show_->isChecked()) behaviour = MainWindow::Startup_AlwaysShow;
|
||||
if (ui_->b_remember_->isChecked()) behaviour = MainWindow::Startup_Remember;
|
||||
|
||||
MainWindow::AddBehaviour doubleclick_addmode = MainWindow::AddBehaviour(
|
||||
ui_->doubleclick_addmode->itemData(ui_->doubleclick_addmode->currentIndex()).toInt());
|
||||
MainWindow::PlayBehaviour doubleclick_playmode = MainWindow::PlayBehaviour(
|
||||
ui_->doubleclick_playmode->itemData(ui_->doubleclick_playmode->currentIndex()).toInt());
|
||||
MainWindow::PlayBehaviour menu_playmode = MainWindow::PlayBehaviour(
|
||||
ui_->menu_playmode->itemData(ui_->menu_playmode->currentIndex()).toInt());
|
||||
|
||||
s.beginGroup(MainWindow::kSettingsGroup);
|
||||
s.setValue("showtray", ui_->b_show_tray_icon_->isChecked());
|
||||
s.setValue("keeprunning", ui_->b_keep_running_->isChecked());
|
||||
s.setValue("startupbehaviour", int(behaviour));
|
||||
s.setValue("doubleclick_addmode", doubleclick_addmode);
|
||||
s.setValue("doubleclick_playmode", doubleclick_playmode);
|
||||
s.setValue("menu_playmode", menu_playmode);
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup("General");
|
||||
s.setValue("language", language_map_.contains(ui_->language->currentText()) ?
|
||||
language_map_[ui_->language->currentText()] : QString());
|
||||
s.endGroup();
|
||||
|
||||
// Playback
|
||||
s.beginGroup(Playlist::kSettingsGroup);
|
||||
s.setValue("glow_effect", ui_->current_glow->isChecked());
|
||||
s.setValue("greyoutdeleted", ui_->b_grey_out_deleted_->isChecked());
|
||||
s.setValue("bg_enabled", ui_->b_enable_background_img_->isChecked());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(Engine::Base::kSettingsGroup);
|
||||
s.setValue("FadeoutEnabled", ui_->fading_out->isChecked());
|
||||
s.setValue("FadeoutDuration", ui_->fading_duration->value());
|
||||
s.setValue("CrossfadeEnabled", ui_->fading_cross->isChecked());
|
||||
s.setValue("AutoCrossfadeEnabled", ui_->fading_auto->isChecked());
|
||||
s.setValue("NoCrossfadeSameAlbum", ui_->fading_samealbum->isChecked());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(GstEngine::kSettingsGroup);
|
||||
s.setValue("sink", ui_->gst_plugin->itemData(ui_->gst_plugin->currentIndex()).toString());
|
||||
s.setValue("device", ui_->gst_device->text());
|
||||
s.setValue("rgenabled", ui_->replaygain->isChecked());
|
||||
s.setValue("rgmode", ui_->replaygain_mode->currentIndex());
|
||||
s.setValue("rgpreamp", float(ui_->replaygain_preamp->value()) / 10 - 15);
|
||||
s.setValue("rgcompression", ui_->replaygain_compression->isChecked());
|
||||
s.setValue("bufferduration", ui_->buffer_duration->value());
|
||||
s.endGroup();
|
||||
|
||||
// Song info
|
||||
s.beginGroup(SongInfoTextView::kSettingsGroup);
|
||||
s.setValue("font_size", ui_->song_info_font_preview->font().pointSizeF());
|
||||
s.setValue("timeout", ui_->song_info_timeout->value());
|
||||
s.endGroup();
|
||||
|
||||
ui_->lyric_settings->Save();
|
||||
|
||||
// Wii remotes
|
||||
#ifdef HAVE_WIIMOTEDEV
|
||||
s.beginGroup(WiimotedevShortcuts::kActionsGroup);
|
||||
s.remove("");
|
||||
foreach (const WiimotedevShortcutsConfig::Shortcut& shortcut, wiimotedev_config_->actions_)
|
||||
s.setValue(QString::number(shortcut.button), shortcut.action);
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(WiimotedevShortcuts::kSettingsGroup);
|
||||
s.setValue("first_conf", false);
|
||||
s.setValue("enabled", wiimotedev_config_->ui_->wiimotedev_enable->isChecked());
|
||||
s.setValue("only_when_focused", wiimotedev_config_->ui_->wiimotedev_focus->isChecked());
|
||||
s.setValue("use_active_action", wiimotedev_config_->ui_->wiimotedev_active->isChecked());
|
||||
s.setValue("use_notification", wiimotedev_config_->ui_->wiimotedev_notification->isChecked());
|
||||
s.setValue("device", wiimotedev_config_->ui_->wiimotedev_device->value());
|
||||
s.endGroup();
|
||||
#endif
|
||||
|
||||
// Notifications
|
||||
OSD::Behaviour osd_behaviour = OSD::Disabled;
|
||||
if (ui_->notifications_none->isChecked()) osd_behaviour = OSD::Disabled;
|
||||
else if (ui_->notifications_native->isChecked()) osd_behaviour = OSD::Native;
|
||||
else if (ui_->notifications_tray->isChecked()) osd_behaviour = OSD::TrayPopup;
|
||||
else if (ui_->notifications_pretty->isChecked()) osd_behaviour = OSD::Pretty;
|
||||
|
||||
s.beginGroup(OSD::kSettingsGroup);
|
||||
s.setValue("Behaviour", int(osd_behaviour));
|
||||
s.setValue("Timeout", ui_->notifications_duration->value() * 1000);
|
||||
s.setValue("ShowOnVolumeChange", ui_->notifications_volume->isChecked());
|
||||
s.setValue("ShowOnPlayModeChange", ui_->notifications_play_mode->isChecked());
|
||||
s.setValue("ShowArt", ui_->notifications_art->isChecked());
|
||||
s.setValue("CustomTextEnabled", ui_->notifications_custom_text_enabled->isChecked());
|
||||
s.setValue("CustomText1", ui_->notifications_custom_text1->text());
|
||||
s.setValue("CustomText2", ui_->notifications_custom_text2->text());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(OSDPretty::kSettingsGroup);
|
||||
s.setValue("foreground_color", pretty_popup_->foreground_color());
|
||||
s.setValue("background_color", pretty_popup_->background_color());
|
||||
s.setValue("background_opacity", pretty_popup_->background_opacity());
|
||||
s.setValue("popup_display", pretty_popup_->popup_display());
|
||||
s.setValue("popup_pos", pretty_popup_->popup_pos());
|
||||
s.setValue("font", pretty_popup_->font().toString());
|
||||
s.setValue("disable_duration", ui_->notifications_disable_duration->isChecked());
|
||||
s.endGroup();
|
||||
|
||||
// Network proxy
|
||||
NetworkProxyFactory::Mode mode = NetworkProxyFactory::Mode_System;
|
||||
if (ui_->proxy_direct->isChecked()) mode = NetworkProxyFactory::Mode_Direct;
|
||||
else if (ui_->proxy_system->isChecked()) mode = NetworkProxyFactory::Mode_System;
|
||||
else if (ui_->proxy_manual->isChecked()) mode = NetworkProxyFactory::Mode_Manual;
|
||||
|
||||
s.beginGroup(NetworkProxyFactory::kSettingsGroup);
|
||||
s.setValue("mode", mode);
|
||||
s.setValue("type", ui_->proxy_type->currentIndex() == 0 ?
|
||||
QNetworkProxy::HttpProxy : QNetworkProxy::Socks5Proxy);
|
||||
s.setValue("hostname", ui_->proxy_hostname->text());
|
||||
s.setValue("port", ui_->proxy_port->value());
|
||||
s.setValue("use_authentication", ui_->proxy_auth->isChecked());
|
||||
s.setValue("username", ui_->proxy_username->text());
|
||||
s.setValue("password", ui_->proxy_password->text());
|
||||
s.endGroup();
|
||||
|
||||
// Transcoding
|
||||
ui_->transcoding_aac->Save();
|
||||
ui_->transcoding_flac->Save();
|
||||
ui_->transcoding_mp3->Save();
|
||||
ui_->transcoding_speex->Save();
|
||||
ui_->transcoding_vorbis->Save();
|
||||
ui_->transcoding_wma->Save();
|
||||
|
||||
ui_->library_config->Save();
|
||||
ui_->magnatune->Save();
|
||||
ui_->digitally_imported->Save();
|
||||
ui_->global_shortcuts->Save();
|
||||
|
||||
streams_->SaveStreams();
|
||||
|
||||
// Save settings different from login data
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
lastfm_config_->Save();
|
||||
#endif
|
||||
#ifdef HAVE_REMOTE
|
||||
remote_config_->Save();
|
||||
#endif
|
||||
foreach (const PageData& data, pages_.values()) {
|
||||
data.page_->Save();
|
||||
}
|
||||
|
||||
QDialog::accept();
|
||||
|
||||
NetworkProxyFactory::Instance()->ReloadSettings();
|
||||
}
|
||||
|
||||
void SettingsDialog::showEvent(QShowEvent*) {
|
||||
QSettings s;
|
||||
void SettingsDialog::showEvent(QShowEvent* e) {
|
||||
loading_settings_ = true;
|
||||
|
||||
if (ui_->gst_plugin->count() <= 1 && gst_engine_) {
|
||||
GstEngine::PluginDetailsList list = gst_engine_->GetOutputsList();
|
||||
|
||||
ui_->gst_plugin->setItemData(0, GstEngine::kAutoSink);
|
||||
foreach (const GstEngine::PluginDetails& details, list) {
|
||||
if (details.name == "autoaudiosink")
|
||||
continue;
|
||||
|
||||
ui_->gst_plugin->addItem(details.long_name, details.name);
|
||||
}
|
||||
ui_->gst_group->setEnabled(true);
|
||||
ui_->replaygain_group->setEnabled(true);
|
||||
foreach (const PageData& data, pages_.values()) {
|
||||
data.page_->Load();
|
||||
}
|
||||
|
||||
// Behaviour
|
||||
s.beginGroup(MainWindow::kSettingsGroup);
|
||||
ui_->b_show_tray_icon_->setChecked(s.value("showtray", true).toBool());
|
||||
ui_->b_keep_running_->setChecked(s.value("keeprunning",
|
||||
ui_->b_show_tray_icon_->isChecked()).toBool());
|
||||
ui_->doubleclick_addmode->setCurrentIndex(ui_->doubleclick_addmode->findData(
|
||||
s.value("doubleclick_addmode", MainWindow::AddBehaviour_Append).toInt()));
|
||||
ui_->doubleclick_playmode->setCurrentIndex(ui_->doubleclick_playmode->findData(
|
||||
s.value("doubleclick_playmode", MainWindow::PlayBehaviour_IfStopped).toInt()));
|
||||
ui_->menu_playmode->setCurrentIndex(ui_->menu_playmode->findData(
|
||||
s.value("menu_playmode", MainWindow::PlayBehaviour_IfStopped).toInt()));
|
||||
|
||||
MainWindow::StartupBehaviour behaviour = MainWindow::StartupBehaviour(
|
||||
s.value("startupbehaviour", MainWindow::Startup_Remember).toInt());
|
||||
switch (behaviour) {
|
||||
case MainWindow::Startup_AlwaysHide: ui_->b_always_hide_->setChecked(true); break;
|
||||
case MainWindow::Startup_AlwaysShow: ui_->b_always_show_->setChecked(true); break;
|
||||
case MainWindow::Startup_Remember: ui_->b_remember_->setChecked(true); break;
|
||||
}
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup("General");
|
||||
QString name = language_map_.key(s.value("language").toString());
|
||||
if (name.isEmpty())
|
||||
ui_->language->setCurrentIndex(0);
|
||||
else
|
||||
ui_->language->setCurrentIndex(ui_->language->findText(name));
|
||||
s.endGroup();
|
||||
|
||||
// Song Info
|
||||
s.beginGroup(SongInfoTextView::kSettingsGroup);
|
||||
ui_->song_info_font_size->setValue(
|
||||
s.value("font_size", SongInfoTextView::kDefaultFontSize).toReal());
|
||||
ui_->song_info_timeout->setValue(
|
||||
s.value("timeout", SongInfoFetcher::kDefaultTimeoutDuration).toInt());
|
||||
s.endGroup();
|
||||
|
||||
ui_->lyric_settings->Load();
|
||||
|
||||
// Last.fm
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
lastfm_config_->Load();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REMOTE
|
||||
remote_config_->Load();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SPOTIFY
|
||||
spotify_config_->Load();
|
||||
#endif
|
||||
|
||||
// Magnatune
|
||||
ui_->magnatune->Load();
|
||||
|
||||
// Digitally Imported
|
||||
ui_->digitally_imported->Load();
|
||||
|
||||
// Global Shortcuts
|
||||
ui_->global_shortcuts->Load();
|
||||
|
||||
// Playback
|
||||
s.beginGroup(Playlist::kSettingsGroup);
|
||||
ui_->current_glow->setChecked(s.value("glow_effect", true).toBool());
|
||||
ui_->b_grey_out_deleted_->setChecked(s.value("greyoutdeleted", false).toBool());
|
||||
ui_->b_enable_background_img_->setChecked(s.value("bg_enabled", true).toBool());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(Engine::Base::kSettingsGroup);
|
||||
ui_->fading_out->setChecked(s.value("FadeoutEnabled", true).toBool());
|
||||
ui_->fading_cross->setChecked(s.value("CrossfadeEnabled", true).toBool());
|
||||
ui_->fading_auto->setChecked(s.value("AutoCrossfadeEnabled", false).toBool());
|
||||
ui_->fading_duration->setValue(s.value("FadeoutDuration", 2000).toInt());
|
||||
ui_->fading_samealbum->setChecked(s.value("NoCrossfadeSameAlbum", true).toBool());
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(GstEngine::kSettingsGroup);
|
||||
QString sink = s.value("sink", GstEngine::kAutoSink).toString();
|
||||
ui_->gst_plugin->setCurrentIndex(0);
|
||||
for (int i=0 ; i<ui_->gst_plugin->count() ; ++i) {
|
||||
if (ui_->gst_plugin->itemData(i).toString() == sink) {
|
||||
ui_->gst_plugin->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ui_->gst_device->setText(s.value("device").toString());
|
||||
ui_->replaygain->setChecked(s.value("rgenabled", false).toBool());
|
||||
ui_->replaygain_mode->setCurrentIndex(s.value("rgmode", 0).toInt());
|
||||
ui_->replaygain_preamp->setValue(s.value("rgpreamp", 0.0).toDouble() * 10 + 150);
|
||||
ui_->replaygain_compression->setChecked(s.value("rgcompression", true).toBool());
|
||||
ui_->buffer_duration->setValue(s.value("bufferduration", 4000).toInt());
|
||||
s.endGroup();
|
||||
|
||||
// Notifications
|
||||
s.beginGroup(OSD::kSettingsGroup);
|
||||
OSD::Behaviour osd_behaviour = OSD::Behaviour(s.value("Behaviour", OSD::Native).toInt());
|
||||
switch (osd_behaviour) {
|
||||
case OSD::Native:
|
||||
if (OSD::SupportsNativeNotifications()) {
|
||||
ui_->notifications_native->setChecked(true);
|
||||
break;
|
||||
}
|
||||
// Fallthrough
|
||||
|
||||
case OSD::Pretty:
|
||||
ui_->notifications_pretty->setChecked(true);
|
||||
break;
|
||||
|
||||
case OSD::TrayPopup:
|
||||
if (OSD::SupportsTrayPopups()) {
|
||||
ui_->notifications_tray->setChecked(true);
|
||||
break;
|
||||
}
|
||||
// Fallthrough
|
||||
|
||||
case OSD::Disabled:
|
||||
default:
|
||||
ui_->notifications_none->setChecked(true);
|
||||
break;
|
||||
}
|
||||
ui_->notifications_duration->setValue(s.value("Timeout", 5000).toInt() / 1000);
|
||||
ui_->notifications_volume->setChecked(s.value("ShowOnVolumeChange", false).toBool());
|
||||
ui_->notifications_play_mode->setChecked(s.value("ShowOnPlayModeChange", true).toBool());
|
||||
ui_->notifications_art->setChecked(s.value("ShowArt", true).toBool());
|
||||
ui_->notifications_custom_text_enabled->setChecked(s.value("CustomTextEnabled", false).toBool());
|
||||
ui_->notifications_custom_text1->setText(s.value("CustomText1").toString());
|
||||
ui_->notifications_custom_text2->setText(s.value("CustomText2").toString());
|
||||
s.endGroup();
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
ui_->notifications_options->setEnabled(ui_->notifications_pretty->isChecked());
|
||||
#endif
|
||||
|
||||
// Pretty OSD
|
||||
pretty_popup_->ReloadSettings();
|
||||
ui_->notifications_opacity->setValue(pretty_popup_->background_opacity() * 100);
|
||||
|
||||
QRgb color = pretty_popup_->background_color();
|
||||
if (color == OSDPretty::kPresetBlue)
|
||||
ui_->notifications_bg_preset->setCurrentIndex(0);
|
||||
else if (color == OSDPretty::kPresetOrange)
|
||||
ui_->notifications_bg_preset->setCurrentIndex(1);
|
||||
else
|
||||
ui_->notifications_bg_preset->setCurrentIndex(2);
|
||||
ui_->notifications_bg_preset->setItemData(2, QColor(color), Qt::DecorationRole);
|
||||
ui_->notifications_disable_duration->setChecked(pretty_popup_->disable_duration());
|
||||
UpdatePopupVisible();
|
||||
|
||||
ui_->library_config->Load();
|
||||
|
||||
// Network proxy
|
||||
s.beginGroup(NetworkProxyFactory::kSettingsGroup);
|
||||
NetworkProxyFactory::Mode mode = NetworkProxyFactory::Mode(
|
||||
s.value("mode", NetworkProxyFactory::Mode_System).toInt());
|
||||
switch (mode) {
|
||||
case NetworkProxyFactory::Mode_Manual:
|
||||
ui_->proxy_manual->setChecked(true);
|
||||
break;
|
||||
|
||||
case NetworkProxyFactory::Mode_Direct:
|
||||
ui_->proxy_direct->setChecked(true);
|
||||
break;
|
||||
|
||||
case NetworkProxyFactory::Mode_System:
|
||||
default:
|
||||
ui_->proxy_system->setChecked(true);
|
||||
break;
|
||||
}
|
||||
|
||||
ui_->proxy_type->setCurrentIndex(s.value("type", QNetworkProxy::HttpProxy)
|
||||
.toInt() == QNetworkProxy::HttpProxy ? 0 : 1);
|
||||
ui_->proxy_hostname->setText(s.value("hostname").toString());
|
||||
ui_->proxy_port->setValue(s.value("port").toInt());
|
||||
ui_->proxy_auth->setChecked(s.value("use_authentication", false).toBool());
|
||||
ui_->proxy_username->setText(s.value("username").toString());
|
||||
ui_->proxy_password->setText(s.value("password").toString());
|
||||
s.endGroup();
|
||||
|
||||
// Transcoding
|
||||
ui_->transcoding_aac->Load();
|
||||
ui_->transcoding_flac->Load();
|
||||
ui_->transcoding_mp3->Load();
|
||||
ui_->transcoding_speex->Load();
|
||||
ui_->transcoding_vorbis->Load();
|
||||
ui_->transcoding_wma->Load();
|
||||
|
||||
loading_settings_ = false;
|
||||
}
|
||||
|
||||
void SettingsDialog::hideEvent(QHideEvent *) {
|
||||
pretty_popup_->hide();
|
||||
}
|
||||
|
||||
void SettingsDialog::NotificationTypeChanged() {
|
||||
bool enabled = !ui_->notifications_none->isChecked();
|
||||
bool pretty = ui_->notifications_pretty->isChecked();
|
||||
|
||||
ui_->notifications_general->setEnabled(enabled);
|
||||
ui_->notifications_pretty_group->setEnabled(pretty);
|
||||
ui_->notifications_custom_text_group->setEnabled(enabled);
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
ui_->notifications_options->setEnabled(pretty);
|
||||
#endif
|
||||
ui_->notifications_duration->setEnabled(!pretty || (pretty && !ui_->notifications_disable_duration->isChecked()));
|
||||
ui_->notifications_disable_duration->setEnabled(pretty);
|
||||
}
|
||||
|
||||
void SettingsDialog::PrettyOpacityChanged(int value) {
|
||||
pretty_popup_->set_background_opacity(qreal(value) / 100.0);
|
||||
}
|
||||
|
||||
void SettingsDialog::UpdatePopupVisible() {
|
||||
pretty_popup_->setVisible(
|
||||
isVisible() &&
|
||||
ui_->notifications_pretty->isChecked() &&
|
||||
ui_->stacked_widget->currentWidget() == ui_->notifications_page);
|
||||
}
|
||||
|
||||
void SettingsDialog::PrettyColorPresetChanged(int index) {
|
||||
if (loading_settings_)
|
||||
return;
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
pretty_popup_->set_background_color(OSDPretty::kPresetBlue);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
pretty_popup_->set_background_color(OSDPretty::kPresetOrange);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
default:
|
||||
ChooseBgColor();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::ChooseBgColor() {
|
||||
QColor color = QColorDialog::getColor(pretty_popup_->background_color(), this);
|
||||
if (!color.isValid())
|
||||
return;
|
||||
|
||||
pretty_popup_->set_background_color(color.rgb());
|
||||
ui_->notifications_bg_preset->setItemData(2, color, Qt::DecorationRole);
|
||||
}
|
||||
|
||||
void SettingsDialog::ChooseFgColor() {
|
||||
QColor color = QColorDialog::getColor(pretty_popup_->foreground_color(), this);
|
||||
if (!color.isValid())
|
||||
return;
|
||||
|
||||
pretty_popup_->set_foreground_color(color.rgb());
|
||||
}
|
||||
|
||||
void SettingsDialog::ChooseFont() {
|
||||
bool ok;
|
||||
QFont font = QFontDialog::getFont(&ok, pretty_popup_->font(), this);
|
||||
if (ok)
|
||||
pretty_popup_->set_font(font);
|
||||
}
|
||||
|
||||
void SettingsDialog::ShowTrayIconToggled(bool on) {
|
||||
ui_->b_always_hide_->setEnabled(on);
|
||||
if (!on && ui_->b_always_hide_->isChecked())
|
||||
ui_->b_remember_->setChecked(true);
|
||||
}
|
||||
|
||||
void SettingsDialog::GstPluginChanged(int index) {
|
||||
QString name = ui_->gst_plugin->itemData(index).toString();
|
||||
|
||||
bool enabled = GstEngine::DoesThisSinkSupportChangingTheOutputDeviceToAUserEditableString(name);
|
||||
|
||||
ui_->gst_device->setEnabled(enabled);
|
||||
ui_->gst_device_label->setEnabled(enabled);
|
||||
}
|
||||
|
||||
void SettingsDialog::RgPreampChanged(int value) {
|
||||
float db = float(value) / 10 - 15;
|
||||
QString db_str;
|
||||
db_str.sprintf("%+.1f dB", db);
|
||||
ui_->replaygain_preamp_label->setText(db_str);
|
||||
}
|
||||
|
||||
void SettingsDialog::FadingOptionsChanged() {
|
||||
ui_->fading_options->setEnabled(
|
||||
ui_->fading_out->isChecked() || ui_->fading_cross->isChecked() ||
|
||||
ui_->fading_auto->isChecked());
|
||||
QDialog::showEvent(e);
|
||||
}
|
||||
|
||||
void SettingsDialog::OpenAtPage(Page page) {
|
||||
ui_->list->setCurrentRow(page);
|
||||
if (!pages_.contains(page)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ui_->list->setCurrentRow(pages_[page].index_);
|
||||
show();
|
||||
}
|
||||
|
||||
void SettingsDialog::SetSongInfoView(SongInfoView* view) {
|
||||
ui_->lyric_settings->SetSongInfoView(view);
|
||||
}
|
||||
|
||||
void SettingsDialog::SongInfoFontSizeChanged(double value) {
|
||||
QFont font;
|
||||
font.setPointSizeF(value);
|
||||
|
||||
ui_->song_info_font_preview->setFont(font);
|
||||
}
|
||||
|
||||
void SettingsDialog::NotificationCustomTextChanged(bool enabled) {
|
||||
ui_->notifications_custom_text1->setEnabled(enabled);
|
||||
ui_->notifications_custom_text2->setEnabled(enabled);
|
||||
ui_->notifications_exp_chooser1->setEnabled(enabled);
|
||||
ui_->notifications_exp_chooser2->setEnabled(enabled);
|
||||
ui_->notifications_preview->setEnabled(enabled);
|
||||
ui_->label_19->setEnabled(enabled);
|
||||
ui_->label_20->setEnabled(enabled);
|
||||
}
|
||||
|
||||
void SettingsDialog::PrepareNotificationPreview() {
|
||||
OSD::Behaviour notificationType = OSD::Disabled;
|
||||
if (ui_->notifications_native->isChecked()) {
|
||||
notificationType = OSD::Native;
|
||||
} else if (ui_->notifications_pretty->isChecked()) {
|
||||
notificationType = OSD::Pretty;
|
||||
} else if (ui_->notifications_tray->isChecked()) {
|
||||
notificationType = OSD::TrayPopup;
|
||||
}
|
||||
|
||||
// If user changes timeout or other options, that won't be reflected in the preview
|
||||
emit NotificationPreview(notificationType, ui_->notifications_custom_text1->text(), ui_->notifications_custom_text2->text());
|
||||
}
|
||||
|
||||
void SettingsDialog::InsertVariableFirstLine(QAction* action) {
|
||||
// We use action name, therefore those shouldn't be translatable
|
||||
ui_->notifications_custom_text1->insert(action->text());
|
||||
}
|
||||
|
||||
void SettingsDialog::InsertVariableSecondLine(QAction* action) {
|
||||
// We use action name, therefore those shouldn't be translatable
|
||||
ui_->notifications_custom_text2->insert(action->text());
|
||||
}
|
||||
|
||||
void SettingsDialog::ShowMenuTooltip(QAction *action) {
|
||||
QToolTip::showText(QCursor::pos(), action->toolTip());
|
||||
void SettingsDialog::CurrentTextChanged(const QString& text) {
|
||||
ui_->title->setText("<b>" + text + "</b>");
|
||||
}
|
||||
|
@ -19,75 +19,56 @@
|
||||
#define SETTINGSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMap>
|
||||
#include <QUrl>
|
||||
|
||||
#include "config.h"
|
||||
#include "widgets/osd.h"
|
||||
|
||||
class QBoxLayout;
|
||||
class QCheckBox;
|
||||
class QSlider;
|
||||
|
||||
class BackgroundStreams;
|
||||
class GlobalShortcuts;
|
||||
class LibraryDirectoryModel;
|
||||
class OSDPretty;
|
||||
class SettingsPage;
|
||||
class SongInfoView;
|
||||
class Ui_SettingsDialog;
|
||||
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
class LastFMConfig;
|
||||
#endif
|
||||
#ifdef HAVE_WIIMOTEDEV
|
||||
class WiimotedevShortcutsConfig;
|
||||
#endif
|
||||
#ifdef HAVE_REMOTE
|
||||
class RemoteConfig;
|
||||
#endif
|
||||
#ifdef HAVE_SPOTIFY
|
||||
class SpotifyConfig;
|
||||
#endif
|
||||
|
||||
class GstEngine;
|
||||
|
||||
class SettingsDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
SettingsDialog(BackgroundStreams* streams, QWidget* parent = 0);
|
||||
~SettingsDialog();
|
||||
|
||||
enum Page {
|
||||
Page_Playback = 0,
|
||||
Page_Playback,
|
||||
Page_Behaviour,
|
||||
Page_SongInformation,
|
||||
Page_GlobalShortcuts,
|
||||
Page_Notifications,
|
||||
Page_Library,
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
Page_Lastfm,
|
||||
#endif
|
||||
#ifdef HAVE_SPOTIFY
|
||||
Page_Spotify,
|
||||
#endif
|
||||
Page_Magnatune,
|
||||
Page_DigitallyImported,
|
||||
Page_BackgroundStreams,
|
||||
Page_Proxy,
|
||||
Page_Transcoding,
|
||||
#ifdef HAVE_REMOTE
|
||||
Page_Remote,
|
||||
#endif
|
||||
#ifdef HAVE_WIIMOTEDEV
|
||||
Page_Wiimotedev,
|
||||
#endif
|
||||
};
|
||||
|
||||
void SetLibraryDirectoryModel(LibraryDirectoryModel* model);
|
||||
void SetGlobalShortcutManager(GlobalShortcuts* manager);
|
||||
void SetLibraryDirectoryModel(LibraryDirectoryModel* model) { model_ = model; }
|
||||
void SetGlobalShortcutManager(GlobalShortcuts* manager) { manager_ = manager; }
|
||||
void SetGstEngine(const GstEngine* engine) { gst_engine_ = engine; }
|
||||
void SetSongInfoView(SongInfoView* view);
|
||||
void SetSongInfoView(SongInfoView* view) { song_info_view_ = view; }
|
||||
|
||||
bool is_loading_settings() const { return loading_settings_; }
|
||||
|
||||
LibraryDirectoryModel* library_directory_model() const { return model_; }
|
||||
GlobalShortcuts* global_shortcuts_manager() const { return manager_; }
|
||||
const GstEngine* gst_engine() const { return gst_engine_; }
|
||||
SongInfoView* song_info_view() const { return song_info_view_; }
|
||||
BackgroundStreams* background_streams() const { return streams_; }
|
||||
|
||||
void OpenAtPage(Page page);
|
||||
|
||||
@ -96,69 +77,33 @@ class SettingsDialog : public QDialog {
|
||||
|
||||
// QWidget
|
||||
void showEvent(QShowEvent* e);
|
||||
void hideEvent(QHideEvent *);
|
||||
|
||||
private:
|
||||
void AddStream(const QString& name);
|
||||
void AddStreams();
|
||||
void LoadStreams();
|
||||
signals:
|
||||
void NotificationPreview(OSD::Behaviour, QString, QString);
|
||||
void SetWiimotedevInterfaceActived(bool);
|
||||
|
||||
private slots:
|
||||
private slots:
|
||||
void CurrentTextChanged(const QString& text);
|
||||
void NotificationTypeChanged();
|
||||
void NotificationCustomTextChanged(bool enabled);
|
||||
void PrepareNotificationPreview();
|
||||
void InsertVariableFirstLine(QAction* action);
|
||||
void InsertVariableSecondLine(QAction* action);
|
||||
void ShowMenuTooltip(QAction* action);
|
||||
|
||||
void PrettyOpacityChanged(int value);
|
||||
void PrettyColorPresetChanged(int index);
|
||||
void ChooseBgColor();
|
||||
void ChooseFgColor();
|
||||
void ChooseFont();
|
||||
private:
|
||||
struct PageData {
|
||||
int index_;
|
||||
SettingsPage* page_;
|
||||
};
|
||||
|
||||
void UpdatePopupVisible();
|
||||
void ShowTrayIconToggled(bool on);
|
||||
void GstPluginChanged(int index);
|
||||
void FadingOptionsChanged();
|
||||
void RgPreampChanged(int value);
|
||||
void AddPage(Page id, SettingsPage* page);
|
||||
|
||||
void SongInfoFontSizeChanged(double value);
|
||||
|
||||
// Background streams.
|
||||
void EnableStream(bool enabled);
|
||||
void StreamVolumeChanged(int value);
|
||||
|
||||
private:
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
LastFMConfig* lastfm_config_;
|
||||
#endif
|
||||
#ifdef HAVE_WIIMOTEDEV
|
||||
WiimotedevShortcutsConfig* wiimotedev_config_;
|
||||
#endif
|
||||
#ifdef HAVE_REMOTE
|
||||
RemoteConfig* remote_config_;
|
||||
#endif
|
||||
#ifdef HAVE_SPOTIFY
|
||||
SpotifyConfig* spotify_config_;
|
||||
#endif
|
||||
private:
|
||||
LibraryDirectoryModel* model_;
|
||||
GlobalShortcuts* manager_;
|
||||
const GstEngine* gst_engine_;
|
||||
SongInfoView* song_info_view_;
|
||||
BackgroundStreams* streams_;
|
||||
|
||||
Ui_SettingsDialog* ui_;
|
||||
bool loading_settings_;
|
||||
|
||||
OSDPretty* pretty_popup_;
|
||||
|
||||
QMap<QString, QString> language_map_;
|
||||
|
||||
BackgroundStreams* streams_;
|
||||
|
||||
signals:
|
||||
void NotificationPreview(OSD::Behaviour,QString,QString);
|
||||
#ifdef HAVE_WIIMOTEDEV
|
||||
void SetWiimotedevInterfaceActived(bool);
|
||||
#endif
|
||||
QMap<Page, PageData> pages_;
|
||||
};
|
||||
|
||||
#endif // SETTINGSDIALOG_H
|
||||
|
File diff suppressed because it is too large
Load Diff
25
src/ui/settingspage.cpp
Normal file
25
src/ui/settingspage.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "settingsdialog.h"
|
||||
#include "settingspage.h"
|
||||
|
||||
SettingsPage::SettingsPage(SettingsDialog* dialog)
|
||||
: QWidget(dialog),
|
||||
dialog_(dialog)
|
||||
{
|
||||
}
|
48
src/ui/settingspage.h
Normal file
48
src/ui/settingspage.h
Normal file
@ -0,0 +1,48 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SETTINGSPAGE_H
|
||||
#define SETTINGSPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "widgets/osd.h"
|
||||
|
||||
class SettingsDialog;
|
||||
|
||||
class SettingsPage : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SettingsPage(SettingsDialog* dialog);
|
||||
|
||||
virtual bool IsEnabled() const { return true; }
|
||||
|
||||
virtual void Load() = 0;
|
||||
virtual void Save() = 0;
|
||||
|
||||
SettingsDialog* dialog() const { return dialog_; }
|
||||
|
||||
signals:
|
||||
void NotificationPreview(OSD::Behaviour, QString, QString);
|
||||
void SetWiimotedevInterfaceActived(bool);
|
||||
|
||||
private:
|
||||
SettingsDialog* dialog_;
|
||||
};
|
||||
|
||||
#endif // SETTINGSPAGE_H
|
@ -15,21 +15,22 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ui/wiimotedevshortcutsconfig.h"
|
||||
#include "ui_wiimotedevshortcutsconfig.h"
|
||||
#include "ui/wiimotedevshortcutgrabber.h"
|
||||
|
||||
#include "wiimotedev/shortcuts.h"
|
||||
#include "wiimotedev/consts.h"
|
||||
#include "consts.h"
|
||||
#include "shortcuts.h"
|
||||
#include "wiimotesettingspage.h"
|
||||
#include "wiimoteshortcutgrabber.h"
|
||||
#include "ui_wiimotesettingspage.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
WiimotedevShortcutsConfig::WiimotedevShortcutsConfig(QWidget* parent)
|
||||
: QWidget(parent),
|
||||
ui_(new Ui_WiimotedevShortcutsConfig)
|
||||
|
||||
WiimoteSettingsPage::WiimoteSettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog),
|
||||
ui_(new Ui_WiimoteSettingsPage)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
ui_->list->header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
setWindowIcon(QIcon(":/icons/32x32/wiimotedev.png"));
|
||||
|
||||
text_buttons_.insert(WIIMOTE_BTN_1, "Wiiremote 1");
|
||||
text_buttons_.insert(WIIMOTE_BTN_2, "Wiiremote 2");
|
||||
@ -109,17 +110,6 @@ WiimotedevShortcutsConfig::WiimotedevShortcutsConfig(QWidget* parent)
|
||||
text_actions_.insert(WiimotedevShortcuts::PlayerStopAfter, tr("Stop after"));
|
||||
text_actions_.insert(WiimotedevShortcuts::PlayerShowOSD, tr("Show OSD"));
|
||||
|
||||
|
||||
settings_.beginGroup(WiimotedevShortcuts::kSettingsGroup);
|
||||
ui_->wiimotedev_enable->setChecked(settings_.value("enabled", false).toBool());
|
||||
ui_->wiimotedev_active->setChecked(settings_.value("use_active_action", true).toBool());
|
||||
ui_->wiimotedev_focus->setChecked(settings_.value("only_when_focused", false).toBool());
|
||||
ui_->wiimotedev_notification->setChecked(settings_.value("use_notification", true).toBool());
|
||||
ui_->wiimotedev_device->setValue(settings_.value("device", 1).toUInt());
|
||||
settings_.endGroup();
|
||||
|
||||
LoadSettings();
|
||||
|
||||
connect(ui_->list, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), SLOT(ItemClicked(QTreeWidgetItem*)));
|
||||
|
||||
connect(ui_->wiimotedev_add_action, SIGNAL(clicked()), this, SLOT(AddAction()));
|
||||
@ -128,7 +118,7 @@ WiimotedevShortcutsConfig::WiimotedevShortcutsConfig(QWidget* parent)
|
||||
}
|
||||
|
||||
|
||||
void WiimotedevShortcutsConfig::AddShortcut(quint64 button, quint32 action) {
|
||||
void WiimoteSettingsPage::AddShortcut(quint64 button, quint32 action) {
|
||||
foreach (const Shortcut& shortcut, actions_) {
|
||||
if (shortcut.button == button) {
|
||||
QMessageBox::information(this, tr("Information"), QString(tr("Shortcut for %1 already exists")).arg(GetReadableWiiremoteSequence(button)), QMessageBox::Ok);
|
||||
@ -143,37 +133,60 @@ void WiimotedevShortcutsConfig::AddShortcut(quint64 button, quint32 action) {
|
||||
actions_ << s;
|
||||
}
|
||||
|
||||
void WiimotedevShortcutsConfig::LoadSettings(){
|
||||
settings_.beginGroup(WiimotedevShortcuts::kSettingsGroup);
|
||||
bool first_conf = settings_.value("first_conf", true).toBool();
|
||||
settings_.endGroup();
|
||||
void WiimoteSettingsPage::Load() {
|
||||
QSettings s;
|
||||
s.beginGroup(WiimotedevShortcuts::kSettingsGroup);
|
||||
ui_->wiimotedev_enable->setChecked(s.value("enabled", false).toBool());
|
||||
ui_->wiimotedev_active->setChecked(s.value("use_active_action", true).toBool());
|
||||
ui_->wiimotedev_focus->setChecked(s.value("only_when_focused", false).toBool());
|
||||
ui_->wiimotedev_notification->setChecked(s.value("use_notification", true).toBool());
|
||||
ui_->wiimotedev_device->setValue(s.value("device", 1).toUInt());
|
||||
bool first_conf = s.value("first_conf", true).toBool();
|
||||
s.endGroup();
|
||||
|
||||
if (first_conf) {
|
||||
DefaultSettings();
|
||||
return;
|
||||
}
|
||||
|
||||
settings_.beginGroup(WiimotedevShortcuts::kActionsGroup);
|
||||
settings_.sync();
|
||||
s.beginGroup(WiimotedevShortcuts::kActionsGroup);
|
||||
ui_->list->clear();
|
||||
actions_.clear();
|
||||
|
||||
quint64 fvalue, svalue;
|
||||
bool fvalid, svalid;
|
||||
|
||||
foreach (const QString& str, settings_.allKeys()) {
|
||||
foreach (const QString& str, s.allKeys()) {
|
||||
fvalue = str.toULongLong(&fvalid, 10);
|
||||
svalue = settings_.value(str, 0).toULongLong(&svalid);
|
||||
svalue = s.value(str, 0).toULongLong(&svalid);
|
||||
if (fvalid && svalid)
|
||||
AddShortcut(fvalue, svalue);
|
||||
}
|
||||
settings_.endGroup();
|
||||
s.endGroup();
|
||||
|
||||
ui_->list->sortItems(1, Qt::AscendingOrder);
|
||||
}
|
||||
|
||||
void WiimotedevShortcutsConfig::DefaultSettings()
|
||||
{
|
||||
void WiimoteSettingsPage::Save() {
|
||||
QSettings s;
|
||||
|
||||
s.beginGroup(WiimotedevShortcuts::kActionsGroup);
|
||||
s.remove("");
|
||||
foreach (const Shortcut& shortcut, actions_)
|
||||
s.setValue(QString::number(shortcut.button), shortcut.action);
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(WiimotedevShortcuts::kSettingsGroup);
|
||||
s.setValue("first_conf", false);
|
||||
s.setValue("enabled", ui_->wiimotedev_enable->isChecked());
|
||||
s.setValue("only_when_focused", ui_->wiimotedev_focus->isChecked());
|
||||
s.setValue("use_active_action", ui_->wiimotedev_active->isChecked());
|
||||
s.setValue("use_notification", ui_->wiimotedev_notification->isChecked());
|
||||
s.setValue("device", ui_->wiimotedev_device->value());
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
void WiimoteSettingsPage::DefaultSettings() {
|
||||
ui_->list->clear();
|
||||
actions_.clear();
|
||||
|
||||
@ -190,11 +203,11 @@ void WiimotedevShortcutsConfig::DefaultSettings()
|
||||
ui_->list->sortItems(1, Qt::AscendingOrder);
|
||||
}
|
||||
|
||||
void WiimotedevShortcutsConfig::ItemClicked(QTreeWidgetItem* selected_item) {
|
||||
void WiimoteSettingsPage::ItemClicked(QTreeWidgetItem* selected_item) {
|
||||
selected_item_ = selected_item;
|
||||
}
|
||||
|
||||
QString WiimotedevShortcutsConfig::GetReadableWiiremoteSequence(quint64 value) {
|
||||
QString WiimoteSettingsPage::GetReadableWiiremoteSequence(quint64 value) {
|
||||
QMapIterator<quint64, QString> text(text_buttons_);
|
||||
|
||||
QStringList list;
|
||||
@ -216,9 +229,9 @@ QString WiimotedevShortcutsConfig::GetReadableWiiremoteSequence(quint64 value) {
|
||||
return output;
|
||||
}
|
||||
|
||||
void WiimotedevShortcutsConfig::AddAction() {
|
||||
void WiimoteSettingsPage::AddAction() {
|
||||
emit SetWiimotedevInterfaceActived(false);
|
||||
WiimotedevShortcutGrabber grabber(0, ui_->wiimotedev_device->value(), this);
|
||||
WiimoteShortcutGrabber grabber(0, ui_->wiimotedev_device->value(), this);
|
||||
connect(&grabber, SIGNAL(AddShortcut(quint64,quint32)), this, SLOT(AddShortcut(quint64,quint32)), Qt::QueuedConnection);
|
||||
grabber.exec();
|
||||
emit SetWiimotedevInterfaceActived(true);
|
||||
@ -226,7 +239,7 @@ void WiimotedevShortcutsConfig::AddAction() {
|
||||
ui_->list->sortItems(1, Qt::AscendingOrder);
|
||||
}
|
||||
|
||||
void WiimotedevShortcutsConfig::DeleteAction() {
|
||||
void WiimoteSettingsPage::DeleteAction() {
|
||||
for (int i = 0; i < actions_.count(); ++i) {
|
||||
if (actions_.at(i).object == selected_item_) {
|
||||
delete selected_item_;
|
@ -15,39 +15,30 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef WIIMOTEDEVSHORTCUTSCONFIG_H
|
||||
#define WIIMOTEDEVSHORTCUTSCONFIG_H
|
||||
#ifndef WIIMOTESETTINGSPAGE_H
|
||||
#define WIIMOTESETTINGSPAGE_H
|
||||
|
||||
#include "ui/settingspage.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QWidget>
|
||||
|
||||
class QTreeWidgetItem;
|
||||
class Ui_WiimotedevShortcutsConfig;
|
||||
class WiimotedevShortcutGrabber;
|
||||
class Ui_WiimoteSettingsPage;
|
||||
|
||||
class WiimotedevShortcutsConfig : public QWidget {
|
||||
class WiimoteSettingsPage : public SettingsPage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WiimotedevShortcutsConfig(QWidget* parent = 0);
|
||||
Ui_WiimotedevShortcutsConfig* ui_;
|
||||
WiimoteSettingsPage(SettingsDialog* dialog);
|
||||
|
||||
struct Shortcut {
|
||||
QTreeWidgetItem* object;
|
||||
quint64 button;
|
||||
quint32 action;
|
||||
};
|
||||
|
||||
QList <struct Shortcut> actions_;
|
||||
QMap <quint64, QString> text_buttons_;
|
||||
QMap <quint32, QString> text_actions_;
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
QString GetReadableWiiremoteSequence(quint64 value);
|
||||
QStringList TextActions() const { return text_actions_.values(); }
|
||||
|
||||
private:
|
||||
QSettings settings_;
|
||||
QString current_id_;
|
||||
|
||||
QTreeWidgetItem* selected_item_;
|
||||
signals:
|
||||
void SetWiimotedevInterfaceActived(bool);
|
||||
|
||||
private slots:
|
||||
void AddAction();
|
||||
@ -55,12 +46,23 @@ private slots:
|
||||
void DefaultSettings();
|
||||
void DeleteAction();
|
||||
void ItemClicked(QTreeWidgetItem*);
|
||||
void LoadSettings();
|
||||
|
||||
private:
|
||||
struct Shortcut {
|
||||
QTreeWidgetItem* object;
|
||||
quint64 button;
|
||||
quint32 action;
|
||||
};
|
||||
|
||||
signals:
|
||||
void SetWiimotedevInterfaceActived(bool);
|
||||
Ui_WiimoteSettingsPage* ui_;
|
||||
|
||||
QString current_id_;
|
||||
|
||||
QList<Shortcut> actions_;
|
||||
QMap<quint64, QString> text_buttons_;
|
||||
QMap<quint32, QString> text_actions_;
|
||||
|
||||
QTreeWidgetItem* selected_item_;
|
||||
};
|
||||
|
||||
#endif // WIIMOTEDEVSHORTCUTSCONFIG_H
|
||||
#endif // WIIMOTESETTINGSPAGE_H
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WiimotedevShortcutsConfig</class>
|
||||
<widget class="QWidget" name="WiimotedevShortcutsConfig">
|
||||
<class>WiimoteSettingsPage</class>
|
||||
<widget class="QWidget" name="WiimoteSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -11,16 +11,13 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Configure Shortcuts</string>
|
||||
<string>Wiimotedev</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../../data/data.qrc">
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="wiimotedev_enable">
|
||||
<property name="text">
|
@ -15,15 +15,16 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ui/wiimotedevshortcutgrabber.h"
|
||||
#include "ui_wiimotedevshortcutgrabber.h"
|
||||
#include "wiimotedev/consts.h"
|
||||
#include "consts.h"
|
||||
#include "wiimoteshortcutgrabber.h"
|
||||
#include "ui_wiimoteshortcutgrabber.h"
|
||||
|
||||
WiimotedevShortcutGrabber::WiimotedevShortcutGrabber(quint32 action, quint32 device, QWidget *parent)
|
||||
WiimoteShortcutGrabber::WiimoteShortcutGrabber(quint32 action, quint32 device,
|
||||
WiimoteSettingsPage* parent)
|
||||
:QDialog(parent),
|
||||
pref_action_(action),
|
||||
ui_(new Ui_WiimotedevShortcutGrabber),
|
||||
config_(qobject_cast<WiimotedevShortcutsConfig*>(parent)),
|
||||
ui_(new Ui_WiimoteShortcutGrabber),
|
||||
config_(parent),
|
||||
wiimotedev_device_(device),
|
||||
wiimotedev_buttons_(0),
|
||||
remember_wiimote_shifts_(0),
|
||||
@ -42,7 +43,7 @@ WiimotedevShortcutGrabber::WiimotedevShortcutGrabber(quint32 action, quint32 dev
|
||||
this, SLOT(DbusWiimoteGeneralButtons(uint,qulonglong)));
|
||||
}
|
||||
|
||||
foreach (const QString& name, config_->text_actions_.values())
|
||||
foreach (const QString& name, config_->TextActions())
|
||||
ui_->comboBox->addItem(name);
|
||||
|
||||
ui_->comboBox->setCurrentIndex(pref_action_);
|
||||
@ -57,11 +58,11 @@ WiimotedevShortcutGrabber::WiimotedevShortcutGrabber(quint32 action, quint32 dev
|
||||
line_.setDuration(line_.startFrame()*1000);
|
||||
}
|
||||
|
||||
WiimotedevShortcutGrabber::~WiimotedevShortcutGrabber() {
|
||||
WiimoteShortcutGrabber::~WiimoteShortcutGrabber() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void WiimotedevShortcutGrabber::Timeout(int secs) {
|
||||
void WiimoteShortcutGrabber::Timeout(int secs) {
|
||||
if (!secs) {
|
||||
emit AddShortcut(wiimotedev_buttons_, ui_->comboBox->currentIndex());
|
||||
close();
|
||||
@ -72,7 +73,7 @@ void WiimotedevShortcutGrabber::Timeout(int secs) {
|
||||
ui_->keep_label->setText(QString(tr("Keep buttons for %1 seconds...")).arg(QString::number(secs)));
|
||||
}
|
||||
|
||||
void WiimotedevShortcutGrabber::RememberSwingChecked(bool checked) {
|
||||
void WiimoteShortcutGrabber::RememberSwingChecked(bool checked) {
|
||||
quint64 buttons = wiimotedev_buttons_;
|
||||
line_.stop();
|
||||
ui_->keep_label->setVisible(false);
|
||||
@ -90,7 +91,7 @@ void WiimotedevShortcutGrabber::RememberSwingChecked(bool checked) {
|
||||
}
|
||||
|
||||
|
||||
void WiimotedevShortcutGrabber::DbusWiimoteGeneralButtons(uint id, qulonglong value) {
|
||||
void WiimoteShortcutGrabber::DbusWiimoteGeneralButtons(uint id, qulonglong value) {
|
||||
if (wiimotedev_device_ != id) return;
|
||||
|
||||
quint64 buttons = value & ~(
|
@ -15,23 +15,26 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef WIIMOTEDEVSHORTCUTGRABBER_H
|
||||
#define WIIMOTEDEVSHORTCUTGRABBER_H
|
||||
#ifndef WIIMOTESHORTCUTGRABBER_H
|
||||
#define WIIMOTESHORTCUTGRABBER_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QTimeLine>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include "wiimotesettingspage.h"
|
||||
#include "dbus/wiimotedev.h"
|
||||
#include "ui/wiimotedevshortcutsconfig.h"
|
||||
|
||||
class Ui_WiimotedevShortcutGrabber;
|
||||
class Ui_WiimoteShortcutGrabber;
|
||||
|
||||
class WiimotedevShortcutGrabber : public QDialog {
|
||||
|
||||
class WiimoteShortcutGrabber : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
WiimotedevShortcutGrabber(quint32 action = 0, quint32 device = 1, QWidget* parent = 0);
|
||||
~WiimotedevShortcutGrabber();
|
||||
WiimoteShortcutGrabber(quint32 action, quint32 device,
|
||||
WiimoteSettingsPage* parent);
|
||||
~WiimoteShortcutGrabber();
|
||||
|
||||
private slots:
|
||||
void DbusWiimoteGeneralButtons(uint id, qulonglong value);
|
||||
@ -42,8 +45,8 @@ private:
|
||||
QTimeLine line_;
|
||||
quint32 pref_action_;
|
||||
|
||||
Ui_WiimotedevShortcutGrabber* ui_;
|
||||
WiimotedevShortcutsConfig* config_;
|
||||
Ui_WiimoteShortcutGrabber* ui_;
|
||||
WiimoteSettingsPage* config_;
|
||||
boost::scoped_ptr<OrgWiimotedevDeviceEventsInterface> wiimotedev_iface_;
|
||||
quint32 wiimotedev_device_;
|
||||
quint64 wiimotedev_buttons_;
|
||||
@ -56,4 +59,4 @@ signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // WIIMOTEDEVSHORTCUTGRABBER_H
|
||||
#endif // WIIMOTESHORTCUTGRABBER_H
|
@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WiimotedevShortcutGrabber</class>
|
||||
<widget class="QDialog" name="WiimotedevShortcutGrabber">
|
||||
<class>WiimoteShortcutGrabber</class>
|
||||
<widget class="QDialog" name="WiimoteShortcutGrabber">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>418</width>
|
||||
<height>132</height>
|
||||
<height>160</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
Loading…
x
Reference in New Issue
Block a user