[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/multimedia/amarok/src/context/applets/photos
From: Simon Esneault <simon.esneault () gmail ! com>
Date: 2009-07-01 12:59:19
Message-ID: 1246453159.664815.4298.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 990015 by sesneault:
Customizable maximum numbers of download now works, and the settings are saved in \
amarokrc file The title name of the applet directly change on song change
M +25 -8 PhotosApplet.cpp
M +3 -0 PhotosApplet.h
M +72 -11 photosSettings.ui
--- trunk/extragear/multimedia/amarok/src/context/applets/photos/PhotosApplet.cpp \
#990014:990015 @@ -26,6 +26,7 @@
#include <KAction>
#include <KColorScheme>
#include <KConfigDialog>
+#include <KGlobalSettings>
#include <Plasma/BusyWidget>
#include <Plasma/IconWidget>
#include <Plasma/Theme>
@@ -79,6 +80,13 @@
connect( dataEngine( "amarok-photos" ), SIGNAL( sourceAdded( const QString & ) \
), this, SLOT( connectSource( const QString & ) ) );
+
+ // Read config and inform the engine.
+ KConfigGroup config = Amarok::config("Photos Applet");
+ m_nbPhotos = config.readEntry( "NbPhotos", "10" ).toInt();
+ m_Animation = config.readEntry( "Animation", "Interactive" );
+ dataEngine( "amarok-photos" )->query( QString( "photos:nbphotos:" ) + \
QString().setNum( m_nbPhotos ) ); +
}
PhotosApplet::~PhotosApplet()
@@ -135,10 +143,10 @@
if ( data.empty() )
return;
-
// if we get a message, show it
if ( data.contains( "message" ) && \
data["message"].toString().contains("Fetching")) {
+ m_headerText->setText( i18n( "Photos" ) + QString( " : " ) + data[ "artist" \
].toString() ); m_widget->hide();
setBusy( true );
}
@@ -150,7 +158,6 @@
else if ( data.contains( "data" ) )
{
// only photos to translate ^^
- m_headerText->setText( i18n( "Photos" ) + QString( " : " ) + data[ "artist" \
].toString() );
m_widget->setPixmapList( data[ "data" ].value< QList< QPixmap * > >() );
m_widget->show();
setBusy(false);
@@ -192,15 +199,25 @@
parent->addPage( settings, i18n( "Photos Settings" ), "preferences-system");
- /*
- // TODO bad, it's done manually ...
- if ( m_youtubeHQ == true )
- ui_Settings.comboBox->( true );
- */
- //connect( ui_Settings, SIGNAL( currentIndexChanged( QString ) ), this, SLOT( \
switchToLang( QString ) ) ); + ui_Settings.animationComboBox->setCurrentIndex( \
ui_Settings.animationComboBox->findText( m_Animation ) ); + \
ui_Settings.photosSpinBox->setValue( m_nbPhotos ); + connect( parent, SIGNAL( \
accepted() ), this, SLOT( saveSettings( ) ) ); }
+void
+PhotosApplet::saveSettings()
+{
+ DEBUG_BLOCK
+ KConfigGroup config = Amarok::config("Photos Applet");
+ m_nbPhotos = ui_Settings.photosSpinBox->value();
+ m_Animation = ui_Settings.animationComboBox->currentText();
+ config.writeEntry( "NbPhotos", m_nbPhotos );
+ config.writeEntry( "Animation", m_Animation );
+
+ dataEngine( "amarok-photos" )->query( QString( "photos:nbphotos:" ) + \
QString().setNum( m_nbPhotos ) ); +}
+
#include "PhotosApplet.moc"
--- trunk/extragear/multimedia/amarok/src/context/applets/photos/PhotosApplet.h \
#990014:990015 @@ -52,6 +52,7 @@
public slots:
void dataUpdated( const QString& name, const Plasma::DataEngine::Data& \
data ); void connectSource( const QString &source );
+ void saveSettings();
protected:
void createConfigurationInterface(KConfigDialog *parent);
@@ -63,6 +64,8 @@
PhotosScrollWidget *m_widget;
int m_height;
+ int m_nbPhotos;
+ QString m_Animation;
Ui::photosSettings ui_Settings;
Plasma::IconWidget *m_settingsIcon;
--- trunk/extragear/multimedia/amarok/src/context/applets/photos/photosSettings.ui \
#990014:990015 @@ -6,29 +6,90 @@
<rect>
<x>0</x>
<y>0</y>
- <width>101</width>
- <height>49</height>
+ <width>204</width>
+ <height>83</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
- <widget class="QComboBox" name="comboBox">
+ <widget class="QWidget" name="formLayoutWidget">
<property name="geometry">
<rect>
- <x>10</x>
- <y>10</y>
- <width>70</width>
- <height>25</height>
+ <x>0</x>
+ <y>0</y>
+ <width>201</width>
+ <height>80</height>
</rect>
</property>
- <item>
- <property name="text">
- <string>Sliding</string>
+ <layout class="QFormLayout" name="formLayout">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
- </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="animationLabel">
+ <property name="text">
+ <string>Animation</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="KComboBox" name="animationComboBox">
+ <item>
+ <property name="text">
+ <string>Interactive</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Scrolling</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Fading</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="numberofphotosLabel">
+ <property name="text">
+ <string>Number of photos</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="KIntSpinBox" name="photosSpinBox">
+ <property name="minimum">
+ <number>5</number>
+ </property>
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ <property name="singleStep">
+ <number>5</number>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>KComboBox</class>
+ <extends>QComboBox</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
+ <customwidget>
+ <class>KIntSpinBox</class>
+ <extends>QSpinBox</extends>
+ <header>knuminput.h</header>
+ </customwidget>
+ </customwidgets>
<resources/>
<connections/>
</ui>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic