Browse Source

more cleanups

Malte Veerman 9 years ago
parent
commit
85ba9381b8

+ 3 - 3
fancontrol-gui/src/main.cpp

@@ -77,9 +77,9 @@ int main(int argc, char *argv[])
     KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("KPackage/GenericQML"));
 
     QStringList possiblePackageLocations = QStringList() << QStringLiteral("/usr/share/kpackage/kcms")
-                                                            << QStringLiteral("/usr/local/share/kpackage/kcms")
-                                                            << QStringLiteral("kpackage/kcms")
-                                                            << QStringLiteral("/opt/share/kpackage/kcms");
+                                                         << QStringLiteral("/usr/local/share/kpackage/kcms")
+                                                         << QStringLiteral("kpackage/kcms")
+                                                         << QStringLiteral("/opt/share/kpackage/kcms");
 
     foreach (const QString location, possiblePackageLocations)
     {

+ 0 - 2
lib/src/pwmfanmodel.h

@@ -37,7 +37,6 @@ class PwmFanModel : public QStringListModel
 {
     Q_OBJECT
     Q_PROPERTY(QList<QObject *> fans READ fans NOTIFY fansChanged)
-    Q_PROPERTY(int count READ count NOTIFY fansChanged)
 
 public:
 
@@ -45,7 +44,6 @@ public:
     void setPwmFans(const QList<PwmFan *> &fans);
     void addPwmFans(const QList<PwmFan *> &fans);
     QList<QObject *> fans() const;
-    int count() const { return m_fans.size(); }
 
 
 public slots:

+ 1 - 1
lib/src/tempmodel.cpp

@@ -107,7 +107,7 @@ void TempModel::updateAll()
         Temp *temp = m_temps.at(i);
         setData(index(i, 0), composeText(temp));
     }
-    emit dataChanged(index(0, 0), index(count(), 0));
+    emit dataChanged(index(0, 0), index(m_temps.size(), 0));
 }
 
 QList<QObject *> TempModel::temps() const

+ 0 - 2
lib/src/tempmodel.h

@@ -38,7 +38,6 @@ class TempModel : public QStringListModel
 {
     Q_OBJECT
     Q_PROPERTY(QList<QObject *> temps READ temps NOTIFY tempsChanged)
-    Q_PROPERTY(int count READ count NOTIFY tempsChanged)
 
 public:
 
@@ -46,7 +45,6 @@ public:
     void setTemps(const QList<Temp *> &temps);
     void addTemps(const QList<Temp *> &temps);
     QList<QObject *> temps() const;
-    int count() const { return m_temps.size(); }
     void setUnit(int unit) { if (unit != m_unit) { m_unit = unit; updateAll(); } }
 
 

+ 3 - 3
package/contents/ui/PwmFansTab.qml

@@ -29,7 +29,7 @@ ColumnLayout {
     property QtObject systemdCom: baseObject && baseObject.hasSystemdCommunicator() ? baseObject.systemdCom : null
     property QtObject pwmFanModel: baseObject ? baseObject.pwmFanModel : null
     property QtObject tempModel: baseObject ? baseObject.tempModel : null
-    property var pwmFans: pwmFanModel ? pwmFanModel.fans : null
+    property var pwmFans: pwmFanModel ? pwmFanModel.fans : []
 
     id: root
     anchors.fill: parent
@@ -37,7 +37,7 @@ ColumnLayout {
 
     RowLayout {
         width: parent.width
-        visible: !!loader && !!pwmFanModel && pwmFanModel.count > 0
+        visible: !!pwmFanModel && pwmFans.length > 0
 
         Label {
             text: i18n("Fan:")
@@ -60,7 +60,7 @@ ColumnLayout {
     Loader {
         Layout.fillHeight: true
         Layout.fillWidth: true
-        active: !!loader && !!systemdCom && !!pwmFans && !!pwmFans[fanComboBox.currentIndex]
+        active: !!tempModel && !!systemdCom && pwmFans.length < fanComboBox.currentIndex
 
         sourceComponent: PwmFan {
             unit: !!baseObject ? baseObject.unit : 0