1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-02-24 03:43:56 +01:00

make it a new config dialog

This commit is contained in:
Leo Franchi 2011-04-29 18:04:55 -04:00
parent bba33f0bf8
commit cfff4a91cb
10 changed files with 584 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -81,6 +81,11 @@
<file>./data/images/supercollection.png</file>
<file>./data/images/sipplugin-online.png</file>
<file>./data/images/sipplugin-offline.png</file>
<file>./data/images/advanced-settings.png</file>
<file>./data/images/account-settings.png</file>
<file>./data/images/music-settings.png</file>
<file>./data/images/resolvers-settings.png</file>
<file>./data/images/lastfm-settings.png</file>
<file>./data/topbar-radiobuttons.css</file>
<file>./data/icons/tomahawk-icon-16x16.png</file>
<file>./data/icons/tomahawk-icon-32x32.png</file>

View File

@ -117,6 +117,7 @@ SET( tomahawkHeadersGui ${tomahawkHeadersGui}
SET( tomahawkUI ${tomahawkUI}
tomahawkwindow.ui
settingsdialog.ui
stackedsettingsdialog.ui
proxydialog.ui
audiocontrols.ui

View File

@ -32,7 +32,6 @@
#endif
#include "settingsdialog.h"
#include "ui_settingsdialog.h"
#include "ui_proxydialog.h"
#include "tomahawk/tomahawkapp.h"
#include "musicscanner.h"
@ -46,6 +45,8 @@
#include "sip/SipModel.h"
#include "sipconfigdelegate.h"
#include "ui_stackedsettingsdialog.h"
static QString
md5( const QByteArray& src )
{
@ -55,7 +56,7 @@ md5( const QByteArray& src )
SettingsDialog::SettingsDialog( QWidget *parent )
: QDialog( parent )
, ui( new Ui::SettingsDialog )
, ui( new Ui_StackedSettingsDialog )
, m_proxySettings( this )
, m_rejected( false )
, m_testLastFmQuery( 0 )
@ -70,6 +71,8 @@ SettingsDialog::SettingsDialog( QWidget *parent )
ui->checkBoxUpnp->setChecked( s->externalAddressMode() == TomahawkSettings::Upnp );
ui->checkBoxUpnp->setEnabled( !s->preferStaticHostPort() );
createIcons();
// SIP PLUGINS
SipConfigDelegate* sipdel = new SipConfigDelegate( this );
ui->accountsView->setItemDelegate( sipdel );
@ -86,7 +89,7 @@ SettingsDialog::SettingsDialog( QWidget *parent )
// MUSIC SCANNER
//FIXME: MULTIPLECOLLECTIONDIRS
if ( s->scannerPaths().count() )
ui->lineEditMusicPath->setText( s->scannerPaths().first() );
ui->lineEditMusicPath_2->setText( s->scannerPaths().first() );
ui->checkBoxWatchForChanges->setChecked( s->watchForChanges() );
// LAST FM
@ -107,7 +110,7 @@ SettingsDialog::SettingsDialog( QWidget *parent )
connect( ui->addScript, SIGNAL( clicked( bool ) ), this, SLOT( addScriptResolver() ) );
connect( ui->removeScript, SIGNAL( clicked( bool ) ), this, SLOT( removeScriptResolver() ) );
connect( ui->buttonBrowse, SIGNAL( clicked() ), SLOT( showPathSelector() ) );
connect( ui->buttonBrowse_2, SIGNAL( clicked() ), SLOT( showPathSelector() ) );
connect( ui->proxyButton, SIGNAL( clicked() ), SLOT( showProxySettings() ) );
connect( ui->checkBoxStaticPreferred, SIGNAL( toggled(bool) ), SLOT( toggleUpnp(bool) ) );
connect( this, SIGNAL( rejected() ), SLOT( onRejected() ) );
@ -129,7 +132,7 @@ SettingsDialog::~SettingsDialog()
s->setExternalHostname( ui->staticHostName->text() );
s->setExternalPort( ui->staticPort->value() );
s->setScannerPaths( QStringList( ui->lineEditMusicPath->text() ) );
s->setScannerPaths( QStringList( ui->lineEditMusicPath_2->text() ) );
s->setWatchForChanges( ui->checkBoxWatchForChanges->isChecked() );
s->setScrobblingEnabled( ui->checkBoxEnableLastfm->isChecked() );
@ -147,6 +150,51 @@ SettingsDialog::~SettingsDialog()
delete ui;
}
void
SettingsDialog::createIcons()
{
QListWidgetItem *accountsButton = new QListWidgetItem( ui->listWidget );
accountsButton->setIcon( QIcon( RESPATH "images/account-settings.png" ) );
accountsButton->setText( tr( "Accounts" ) );
accountsButton->setTextAlignment( Qt::AlignHCenter );
accountsButton->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
QListWidgetItem *advancedButton = new QListWidgetItem( ui->listWidget );
advancedButton->setIcon( QIcon( RESPATH "images/advanced-settings.png" ) );
advancedButton->setText( tr( "Advanced" ) );
advancedButton->setTextAlignment( Qt::AlignHCenter );
advancedButton->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
QListWidgetItem *musicButton = new QListWidgetItem( ui->listWidget );
musicButton->setIcon( QIcon( RESPATH "images/music-settings.png" ) );
musicButton->setText( tr( "Music" ) );
musicButton->setTextAlignment( Qt::AlignHCenter );
musicButton->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
QListWidgetItem *lastfmButton = new QListWidgetItem( ui->listWidget );
lastfmButton->setIcon( QIcon( RESPATH "images/lastfm-settings.png" ) );
lastfmButton->setText( tr( "Last.fm" ) );
lastfmButton->setTextAlignment( Qt::AlignHCenter );
lastfmButton->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
QListWidgetItem *resolversButton = new QListWidgetItem( ui->listWidget );
resolversButton->setIcon( QIcon( RESPATH "images/resolvers-settings.png" ) );
resolversButton->setText( tr( "Resolvers" ) );
resolversButton->setTextAlignment( Qt::AlignHCenter );
resolversButton->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
connect( ui->listWidget, SIGNAL( currentItemChanged( QListWidgetItem* ,QListWidgetItem* ) ), this, SLOT( changePage( QListWidgetItem*, QListWidgetItem* ) ) );
}
void
SettingsDialog::changePage( QListWidgetItem* current, QListWidgetItem* previous )
{
if( !current )
current = previous;
ui->stackedWidget->setCurrentIndex( ui->listWidget->row(current) );
}
void
SettingsDialog::showPathSelector()
@ -160,7 +208,7 @@ SettingsDialog::showPathSelector()
if ( path.isEmpty() )
return;
ui->lineEditMusicPath->setText( path );
ui->lineEditMusicPath_2->setText( path );
}

View File

@ -22,6 +22,8 @@
#include <QDialog>
#include <QModelIndex>
class QListWidgetItem;
class Ui_StackedSettingsDialog;
class SipPluginFactory;
class SipPlugin;
class SipModel;
@ -80,9 +82,12 @@ private slots:
void sipItemClicked ( const QModelIndex& );
void openSipConfig( SipPlugin* );
void sipFactoryClicked( SipPluginFactory* );
void changePage( QListWidgetItem*, QListWidgetItem* );
private:
Ui::SettingsDialog* ui;
void createIcons();
Ui_StackedSettingsDialog* ui;
ProxyDialog m_proxySettings;
bool m_rejected;

View File

@ -0,0 +1,518 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>StackedSettingsDialog</class>
<widget class="QDialog" name="StackedSettingsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>561</width>
<height>362</height>
</rect>
</property>
<property name="windowTitle">
<string>Tomahawk Settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
<item>
<widget class="QListWidget" name="listWidget">
<property name="maximumSize">
<size>
<width>68</width>
<height>16777215</height>
</size>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="movement">
<enum>QListView::Static</enum>
</property>
<property name="spacing">
<number>4</number>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>3</number>
</property>
<widget class="QWidget" name="accountsPage">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QTreeView" name="accountsView">
<property name="indentation">
<number>0</number>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>false</bool>
</property>
<property name="animated">
<bool>true</bool>
</property>
<property name="headerHidden">
<bool>true</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="advancedPage">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBoxNetworkAdvanced">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Advanced Network Settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<layout class="QVBoxLayout" name="staticSettingsLayout">
<item>
<layout class="QHBoxLayout" name="staticPreferredLayout"/>
</item>
<item>
<widget class="QLabel" name="staticHostNamePortLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>If you're having difficulty connecting to peers, try setting this to your external IP address/host name and a port number (default 50210). Make sure to forward that port to this machine!</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="staticHostNamePortLayout">
<item>
<widget class="QLabel" name="staticHostNameLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Static Host Name:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="staticHostName"/>
</item>
<item>
<widget class="QLabel" name="staticPortLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Static Port:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="staticPort">
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>50210</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxStaticPreferred">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Always use static host name/port? (Overrides UPnP discovery/port forwarding)</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="proxySettingsHLayout">
<item>
<spacer name="proxySettingsLeftSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="proxyButton">
<property name="text">
<string>Proxy Settings...</string>
</property>
</widget>
</item>
<item>
<spacer name="proxySettingsRightSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="checkBoxHttp">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Playdar HTTP API</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUpnp">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Use UPnP to establish port forward</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="scannerPage">
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Local Music Information</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Path to scan for music files:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="lineEditMusicPath_2"/>
</item>
<item>
<widget class="QToolButton" name="buttonBrowse_2">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxWatchForChanges">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Watch for changes</string>
</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>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="lastfmPage">
<layout class="QVBoxLayout" name="verticalLayout_7">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Last.fm Login</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QCheckBox" name="checkBoxEnableLastfm">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Scrobble tracks to Last.fm</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Username:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditLastfmUsername"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Password:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditLastfmPassword">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPushButton" name="pushButtonTestLastfmLogin">
<property name="text">
<string>Test Login</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<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>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="resolversPage">
<layout class="QVBoxLayout" name="verticalLayout_9">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QTreeView" name="scriptList">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
<property name="animated">
<bool>true</bool>
</property>
<property name="headerHidden">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QToolButton" name="addScript">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/data/images/list-add.png</normaloff>:/data/images/list-add.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="removeScript">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/data/images/list-remove.png</normaloff>:/data/images/list-remove.png</iconset>
</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>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../resources.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>StackedSettingsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>222</x>
<y>347</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>StackedSettingsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>290</x>
<y>353</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>