[kde-doc-english] playground/base/plasma/kcontrol/desktoptheme
Davide Bettio
davide.bettio at kdemail.net
Wed Aug 26 16:30:00 CEST 2009
SVN commit 1015889 by bettio:
GUI: theme combobox has been replaced with a listview.
M +8 -8 desktopthememodule.cpp
M +16 -46 theme.ui
--- trunk/playground/base/plasma/kcontrol/desktoptheme/desktopthememodule.cpp #1015888:1015889
@@ -58,7 +58,7 @@
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- int indexOf(const QString &path) const;
+ QModelIndex indexOf(const QString &path) const;
void reload();
private:
QMap<QString, ThemeInfo> m_themes;
@@ -141,18 +141,18 @@
}
}
-int ThemeModel::indexOf(const QString &name) const
+QModelIndex ThemeModel::indexOf(const QString &name) const
{
QMapIterator<QString, ThemeInfo> it(m_themes);
int i = -1;
while (it.hasNext()) {
++i;
if (it.next().value().package == name) {
- return i;
+ return index(i, 0);
}
}
- return -1;
+ return index(-1, 0);
}
@@ -236,10 +236,10 @@
m_themeModel = new ThemeModel(this);
ui.m_theme->setModel(m_themeModel);
- ui.m_theme->setItemDelegate(new ThemeDelegate(ui.m_theme->view()));
- ui.m_theme->view()->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
+ ui.m_theme->setItemDelegate(new ThemeDelegate(ui.m_theme));
+ ui.m_theme->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
- connect(ui.m_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
+ connect(ui.m_theme, SIGNAL(activated(const QModelIndex &)), this, SLOT(changed()));
connect(ui.m_newThemeButton, SIGNAL(clicked()), this, SLOT(getNewThemes()));
setButtons(Help|Apply);
@@ -247,7 +247,7 @@
void DesktopThemeModule::save()
{
- QString theme = ui.m_theme->itemData(ui.m_theme->currentIndex(), ThemeModel::PackageNameRole).toString();
+ QString theme = m_themeModel->data(ui.m_theme->currentIndex(), ThemeModel::PackageNameRole).toString();
Plasma::Theme::defaultTheme()->setThemeName(theme);
}
--- trunk/playground/base/plasma/kcontrol/desktoptheme/theme.ui #1015888:1015889
@@ -6,55 +6,25 @@
<rect>
<x>0</x>
<y>0</y>
- <width>504</width>
- <height>300</height>
+ <width>691</width>
+ <height>365</height>
</rect>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label_3">
- <property name="minimumSize">
- <size>
- <width>129</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>Theme:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- <property name="buddy">
- <cstring>m_theme</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="m_theme">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="m_newThemeButton">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>New Theme...</string>
- </property>
- </widget>
- </item>
- </layout>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0" rowspan="2">
+ <widget class="QListView" name="m_theme"/>
</item>
- <item>
+ <item row="0" column="1">
+ <widget class="QPushButton" name="m_newThemeButton">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>New Theme...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
More information about the kde-doc-english
mailing list