[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeutils/kdelirc/kcmlirc
From: Frank Scheffold <fscheffold () googlemail ! com>
Date: 2009-10-31 20:58:44
Message-ID: 1257022724.330115.20712.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1043136 by frasche:
Fixed header in kcmlirc remote tab, fixed model parents
M +2 -8 addaction.cpp
M +2 -2 editaction.cpp
M +4 -15 kcmlirc.cpp
M +7 -19 kcmlircbase.ui
M +18 -1 model.cpp
M +9 -1 model.h
--- trunk/KDE/kdeutils/kdelirc/kcmlirc/addaction.cpp #1043135:1043136
@@ -184,14 +184,8 @@
kDebug() << "Mode:" << theMode.name() << "remote:" << theMode.remote();
theButtonText->setText(i18n("You are attempting to configure an action for a \
button on %1 (in mode %2).")
.arg(theMode.remote()).arg(theMode.name().isEmpty() \
? i18n("Master") : theMode.name()));
- remoteButtonModel = new \
RemoteButtonModel(Solid::Control::RemoteControl(theMode.remote()).buttons()); + \
remoteButtonModel = new \
RemoteButtonModel(Solid::Control::RemoteControl(theMode.remote()).buttons(), \
theButtons); theButtons->setModel(remoteButtonModel);
- /* theButtons->clear();
- foreach(const QString &buttonName, \
DBusInterface::getInstance()->getButtons(theMode.remote())) {
- QListWidgetItem *tItem = new QListWidgetItem(buttonName,theButtons);
- tItem->setData(Qt::UserRole,buttonName);
-
- }*/
}
void AddAction::initializePage(int id)
@@ -301,7 +295,7 @@
return;
}
const Profile *p = \
theServer->getProfileById(theProfiles->currentItem()->data(Qt::UserRole).toString());
- profileModel = new ProfileModel(p, this);
+ profileModel = new ProfileModel(p, theProfileFunctions);
theProfileFunctions->setModel(profileModel);
theProfileFunctions->setColumnHidden(3, true);
--- trunk/KDE/kdeutils/kdelirc/kcmlirc/editaction.cpp #1043135:1043136
@@ -58,7 +58,7 @@
foreach(const QString &mode, modeList) {
editActionBaseWidget->theModes->addItem(mode);
}
- editActionBaseWidget->theButtons->setModel(new \
RemoteButtonModel(Solid::Control::RemoteControl(theAction->remote()).buttons(), \
this)); + editActionBaseWidget->theButtons->setModel(new \
RemoteButtonModel(Solid::Control::RemoteControl(theAction->remote()).buttons(), \
editActionBaseWidget->theButtons));
editActionBaseWidget->theButtons->setCurrentIndex(editActionBaseWidget->theButtons->findData(theAction->button(), \
Qt::DisplayRole));
updateApplications();
@@ -336,7 +336,7 @@
const QString application = \
editActionBaseWidget->theApplications->itemData(editActionBaseWidget->theApplications->currentIndex()).toString();
Profile *tProfile =const_cast<Profile*> \
(ProfileServer::getInstance()->getProfileById(application));
- editActionBaseWidget->theFunctions->setModel(new ProfileModel(tProfile, this));
+ editActionBaseWidget->theFunctions->setModel(new ProfileModel(tProfile, \
editActionBaseWidget->theFunctions));
const ProfileAction *action = \
ProfileServer::getInstance()->getAction(theAction->program(), theAction->object(), \
theAction->method().prototype());
if (action && (action->profile()->name() == \
editActionBaseWidget->theApplications->currentText())) {
--- trunk/KDE/kdeutils/kdelirc/kcmlirc/kcmlirc.cpp #1043135:1043136
@@ -492,9 +492,8 @@
void KCMLirc::updateProfileInfo()
{
- QStandardItemModel *tModel = new QStandardItemModel();
+ QStandardItemModel *tModel = new QStandardItemModel( \
theKCMLircBase->theAvailableProfiles); foreach(Profile *tmp, \
ProfileServer::getInstance()->profiles()) {
- kDebug()<< "name "<< tmp->name();
QStandardItem *tItem = new QStandardItem();
tItem->setData(tmp->name(), Qt::DisplayRole);
tItem->setData(tmp->id(), Qt::UserRole);
@@ -526,7 +525,7 @@
infoList.clear();
infoList << i18n("Number of Actions") << \
QString().setNum(tProfile->actions().count()); new \
QTreeWidgetItem(theKCMLircBase->theProfileInformation, infoList);
- theKCMLircBase->theProfileActions->setModel(new ProfileModel(tProfile, this));
+ theKCMLircBase->theProfileActions->setModel(new ProfileModel(tProfile, \
theKCMLircBase->theProfileActions)); }
@@ -534,20 +533,13 @@
void KCMLirc::updateRemoteDetails(QModelIndex index)
{
QString tSelectedRemote = \
theKCMLircBase->theRemotes->model()->data(index).toString();
- theKCMLircBase->theRemoteButtons->setModel(new \
RemoteButtonModel(Solid::Control::RemoteControl(tSelectedRemote).buttons(), this)); + \
theKCMLircBase->theRemoteButtons->setModel(new \
RemoteButtonModel(Solid::Control::RemoteControl(tSelectedRemote).buttons(), \
theKCMLircBase->theRemoteButtons)); }
void KCMLirc::updateRemoteInfo()
{
- QStringListModel *tModel = new \
QStringListModel(Solid::Control::RemoteControl::allRemoteNames(), \
this);
- tModel->sort(0, Qt::AscendingOrder);
- bool t = tModel->setHeaderData(0,Qt::Horizontal, i18n("Remote"), Qt::DisplayRole);
- kDebug()<< "boolean ada sad " << t;
- theKCMLircBase->theRemotes->setModel(tModel);
- t = theKCMLircBase->theRemotes->model()->setHeaderData(0,Qt::Horizontal, \
i18n("Remote"), Qt::DisplayRole);
- kDebug()<< "boolean ........... " << t;
- theKCMLircBase->theRemoteButtons->setModel(new RemoteButtonModel( this));
+ theKCMLircBase->theRemotes->setModel(new \
RemoteModel(Solid::Control::RemoteControl::allRemoteNames(), \
theKCMLircBase->theRemoteButtons)); }
@@ -564,13 +556,10 @@
updateModes();
updateActions();
updateRemoteInfo();
- theKCMLircBase->theProfileActions->setModel(new ProfileModel( this));
- theKCMLircBase->theRemoteButtons->setModel(new RemoteButtonModel(this));
}
void KCMLirc::defaults()
{
- // insert your default settings code here...
emit changed(true);
}
--- trunk/KDE/kdeutils/kdelirc/kcmlirc/kcmlircbase.ui #1043135:1043136
@@ -53,7 +53,7 @@
<item>
<widget class="KTabWidget" name="tabWidget">
<property name="currentIndex">
- <number>0</number>
+ <number>2</number>
</property>
<widget class="QWidget" name="tab_0">
<attribute name="title">
@@ -188,9 +188,6 @@
<attribute name="headerShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
- <attribute name="headerShowSortIndicator" stdset="0">
- <bool>false</bool>
- </attribute>
<column>
<property name="text">
<string notr="true">Button</string>
@@ -305,9 +302,6 @@
<attribute name="headerShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
- <attribute name="headerShowSortIndicator" stdset="0">
- <bool>false</bool>
- </attribute>
</widget>
<widget class="QGroupBox" name="theInformationBox">
<property name="title">
@@ -332,9 +326,6 @@
<attribute name="headerShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
- <attribute name="headerShowSortIndicator" stdset="0">
- <bool>false</bool>
- </attribute>
<column>
<property name="text">
<string>Information</string>
@@ -381,9 +372,6 @@
<attribute name="headerShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
- <attribute name="headerShowSortIndicator" stdset="0">
- <bool>false</bool>
- </attribute>
</widget>
</item>
</layout>
@@ -407,15 +395,18 @@
<enum>Qt::Horizontal</enum>
</property>
<widget class="QTreeView" name="theRemotes">
+ <property name="rootIsDecorated">
+ <bool>false</bool>
+ </property>
+ <property name="itemsExpandable">
+ <bool>false</bool>
+ </property>
<property name="sortingEnabled">
<bool>false</bool>
</property>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
- <attribute name="headerShowSortIndicator" stdset="0">
- <bool>false</bool>
- </attribute>
</widget>
<widget class="QTreeView" name="theRemoteButtons">
<property name="rootIsDecorated">
@@ -430,9 +421,6 @@
<attribute name="headerShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
- <attribute name="headerShowSortIndicator" stdset="0">
- <bool>false</bool>
- </attribute>
</widget>
</widget>
</item>
--- trunk/KDE/kdeutils/kdelirc/kcmlirc/model.cpp #1043135:1043136
@@ -400,7 +400,7 @@
QStandardItem *item = new QStandardItem(button->name());
item->setData(qVariantFromValue(button), Qt::UserRole);
row.append(item);
- if(button->id() == RemoteControlButton::Unknown){
+ if(button->id() != RemoteControlButton::Unknown){
row.append(new QStandardItem(button->description()));
}
QStandardItemModel::appendRow(row);
@@ -436,3 +436,20 @@
}
+
+RemoteModel::RemoteModel(QObject* parent): QStringListModel(parent)
+{
+}
+
+RemoteModel::RemoteModel(const QStringList &strings, QObject *parent) : \
QStringListModel(strings, parent) +{
+ QStringListModel::sort(0, Qt::AscendingOrder);
+}
+
+QVariant RemoteModel::headerData(int section, Qt::Orientation o, int role) const
+{
+ if (role == Qt::DisplayRole){
+ return i18n("Remote");
+ }
+ return QAbstractListModel::headerData(section,o,role);
+}
\ No newline at end of file
--- trunk/KDE/kdeutils/kdelirc/kcmlirc/model.h #1043135:1043136
@@ -34,8 +34,8 @@
#include <QItemDelegate>
#include <QStandardItem>
#include <solid/control/remotecontrol.h>
+#include <QStringListModel>
-
using namespace Solid::Control;
Q_DECLARE_METATYPE(Prototype)
Q_DECLARE_METATYPE(IRAction*)
@@ -125,5 +125,13 @@
Qt::ItemFlags flags(const QModelIndex& index) const;
};
+
+class RemoteModel : public QStringListModel
+{
+ public:
+ RemoteModel(const QStringList &strings, QObject *parent = 0);
+ RemoteModel(QObject *parent=0);
+ QVariant headerData(int section, Qt::Orientation o, int role) const;
+};
#endif /* MODEL_H_ */
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic