[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [skrooge/QML] /: New option to select if the dashboard must be in html or qml. Qml mode is still exp
From:       Stephane Mankowski <stephane () mankowski ! fr>
Date:       2016-04-20 21:17:58
Message-ID: E1aszVW-0006Xi-Ed () scm ! kde ! org
[Download RAW message or body]

Git commit 04d7a5176a2581b40e1f027abe290d9db03bcac5 by Stephane Mankowski.
Committed on 20/04/2016 at 21:16.
Pushed by smankowski into branch 'QML'.

New option to select if the dashboard must be in html or qml. Qml mode is still \
experimental

M  +1    -0    CHANGELOG
M  +4    -1    plugins/generic/skg_dashboard/skgdashboard_settings.kcfg
M  +13   -0    plugins/generic/skg_dashboard/skgdashboardplugin.cpp
M  +12   -0    plugins/generic/skg_dashboard/skgdashboardplugin.h
M  +7    -0    plugins/generic/skg_dashboard/skgdashboardpluginwidget_pref.ui
M  +8    -3    plugins/skrooge/skrooge_bank/skgbankplugin.cpp
M  +8    -3    plugins/skrooge/skrooge_categories/skgcategoriesplugin.cpp
M  +6    -1    plugins/skrooge/skrooge_report/skgreportplugin.cpp
M  +6    -1    plugins/skrooge/skrooge_scheduled/skgscheduledplugin.cpp
M  +6    -1    plugins/skrooge/skrooge_unit/skgunitplugin.cpp

http://commits.kde.org/skrooge/04d7a5176a2581b40e1f027abe290d9db03bcac5

diff --git a/CHANGELOG b/CHANGELOG
index 43526b5..71555d1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,7 @@ skrooge (2.4.0)
   *Correction: All advices are not displayed in dashboard
   *Correction: More setPlaceholderText for better GUI
   *New feature: New tutorial grantlee template to learn how to develop a new \
template  +  *New feature: New option to select if the dashboard must be in html or \
qml. Qml mode is still experimental    
  -- Stephane MANKOWSKI <stephane@mankowski.fr>  xxx
 
diff --git a/plugins/generic/skg_dashboard/skgdashboard_settings.kcfg \
b/plugins/generic/skg_dashboard/skgdashboard_settings.kcfg index 146caac..cca7ce0 \
                100644
--- a/plugins/generic/skg_dashboard/skgdashboard_settings.kcfg
+++ b/plugins/generic/skg_dashboard/skgdashboard_settings.kcfg
@@ -5,7 +5,10 @@
       http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
   <kcfgfile/>
   <group name="skg_dashboard">
-  <entry name="undefined" type="String" hidden="true">
+  <entry name="qmlmode" type="Bool" hidden="false">
+    <label>Dashboard in QML mode (Experimental)</label>
+    <default>false</default>
+        <whatsthis>If checked, the dashboard will be in QML mode.</whatsthis>      
   </entry>
   </group>
 </kcfg>
diff --git a/plugins/generic/skg_dashboard/skgdashboardplugin.cpp \
b/plugins/generic/skg_dashboard/skgdashboardplugin.cpp index 8178943..fa739dd 100644
--- a/plugins/generic/skg_dashboard/skgdashboardplugin.cpp
+++ b/plugins/generic/skg_dashboard/skgdashboardplugin.cpp
@@ -68,6 +68,19 @@ SKGTabPage* SKGDashboardPlugin::getWidget()
     return new SKGDashboardPluginWidget(m_currentDocument);
 }
 
+QWidget* SKGDashboardPlugin::getPreferenceWidget()
+{
+    SKGTRACEINFUNC(10);
+    auto w = new QWidget();
+    ui.setupUi(w);
+    return w;
+}
+
+KConfigSkeleton* SKGDashboardPlugin::getPreferenceSkeleton()
+{
+    return skgdashboard_settings::self();
+}
+
 QString SKGDashboardPlugin::title() const
 {
     return i18nc("Noun, a summary of your financial situation", "Dashboard");
diff --git a/plugins/generic/skg_dashboard/skgdashboardplugin.h \
b/plugins/generic/skg_dashboard/skgdashboardplugin.h index 11d78f7..873ae61 100644
--- a/plugins/generic/skg_dashboard/skgdashboardplugin.h
+++ b/plugins/generic/skg_dashboard/skgdashboardplugin.h
@@ -59,6 +59,18 @@ public:
     virtual SKGTabPage* getWidget() override;
 
     /**
+     * The preference widget of the plugin.
+     * @return The preference widget of the plugin
+     */
+    virtual QWidget* getPreferenceWidget() override;
+
+    /**
+     * The preference skeleton of the plugin.
+     * @return The preference skeleton of the plugin
+     */
+    virtual KConfigSkeleton* getPreferenceSkeleton() override;
+
+    /**
      * The title of the plugin.
      * @return The title of the plugin
      */
diff --git a/plugins/generic/skg_dashboard/skgdashboardpluginwidget_pref.ui \
b/plugins/generic/skg_dashboard/skgdashboardpluginwidget_pref.ui index \
                e671c9e..c5dda3c 100644
--- a/plugins/generic/skg_dashboard/skgdashboardpluginwidget_pref.ui
+++ b/plugins/generic/skg_dashboard/skgdashboardpluginwidget_pref.ui
@@ -12,6 +12,13 @@
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
+    <widget class="QCheckBox" name="kcfg_qmlmode">
+     <property name="text">
+      <string>Dashboard in QML mode (Experimental)</string>
+     </property>
+    </widget>
+   </item>
+   <item>
     <spacer name="verticalSpacer">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
diff --git a/plugins/skrooge/skrooge_bank/skgbankplugin.cpp \
b/plugins/skrooge/skrooge_bank/skgbankplugin.cpp index aefd9da..331730a 100644
--- a/plugins/skrooge/skrooge_bank/skgbankplugin.cpp
+++ b/plugins/skrooge/skrooge_bank/skgbankplugin.cpp
@@ -97,16 +97,21 @@ QString SKGBankPlugin::getDashboardWidgetTitle(int iIndex)
 
 SKGBoardWidget* SKGBankPlugin::getDashboardWidget(int iIndex)
 {
+    // Get QML mode for dashboard
+    KConfigSkeleton* skl = \
SKGMainPanel::getMainPanel()->getPluginByName(QStringLiteral("Dashboard \
plugin"))->getPreferenceSkeleton(); +    KConfigSkeletonItem* sklItem = \
skl->findItem(QStringLiteral("qmlmode")); +    bool qml = \
sklItem->property().toBool(); +
     if (iIndex == 0) {
         return new SKGAccountBoardWidget(m_currentBankDocument);
     } else if (iIndex == 1) return new SKGHtmlBoardWidget(m_currentBankDocument,
                                        getDashboardWidgetTitle(iIndex),
-                                       \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/account_table.qml")), +                          \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/account_table.") % (qml ?  QStringLiteral("qml") \
                :  QStringLiteral("html"))),
                                        QStringList() << \
QStringLiteral("v_account_display"), \
SKGSimplePeriodEdit::PREVIOUS_AND_CURRENT_PERIODS);  else if (iIndex == 2) {
         auto w = new SKGHtmlBoardWidget(m_currentBankDocument,
                                         getDashboardWidgetTitle(iIndex),
-                                        \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/bank_table_light.qml")), +                       \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/bank_table_light.") % (qml ?  \
                QStringLiteral("qml") :  QStringLiteral("html"))),
                                         QStringList() << \
QStringLiteral("v_account_display"));  
         QStringList overlayopen;
@@ -124,7 +129,7 @@ SKGBoardWidget* SKGBankPlugin::getDashboardWidget(int iIndex)
     }
     return new SKGHtmlBoardWidget(m_currentBankDocument,
                                   getDashboardWidgetTitle(iIndex),
-                                  \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/bank_table.qml")), +                             \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/bank_table.") % (qml ?  QStringLiteral("qml") :  \
                QStringLiteral("html"))),
                                   QStringList() << \
QStringLiteral("v_account_display"), \
SKGSimplePeriodEdit::PREVIOUS_AND_CURRENT_PERIODS);  }
 
diff --git a/plugins/skrooge/skrooge_categories/skgcategoriesplugin.cpp \
b/plugins/skrooge/skrooge_categories/skgcategoriesplugin.cpp index cfbd5e7..edc7a99 \
                100644
--- a/plugins/skrooge/skrooge_categories/skgcategoriesplugin.cpp
+++ b/plugins/skrooge/skrooge_categories/skgcategoriesplugin.cpp
@@ -150,15 +150,20 @@ QString SKGCategoriesPlugin::getDashboardWidgetTitle(int \
iIndex)  SKGBoardWidget* SKGCategoriesPlugin::getDashboardWidget(int iIndex)
 {
     SKGTRACEINFUNC(1);
+    // Get QML mode for dashboard
+    KConfigSkeleton* skl = \
SKGMainPanel::getMainPanel()->getPluginByName(QStringLiteral("Dashboard \
plugin"))->getPreferenceSkeleton(); +    KConfigSkeletonItem* sklItem = \
skl->findItem(QStringLiteral("qmlmode")); +    bool qml = \
sklItem->property().toBool(); +
     if (iIndex == 0)  {
         return new SKGHtmlBoardWidget(m_currentBankDocument,
                                       getDashboardWidgetTitle(iIndex),
-                                      \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/categories_period_table.qml")), +                \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/categories_period_table.") % (qml ?  \
                QStringLiteral("qml") :  QStringLiteral("html"))),
                                       QStringList() << \
QStringLiteral("v_suboperation_consolidated"), SKGSimplePeriodEdit::ALL_PERIODS);  } \
else if (iIndex == 1) {  return new SKGHtmlBoardWidget(m_currentBankDocument,
                                       getDashboardWidgetTitle(iIndex) % " - %1",
-                                      \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/categories_variations.qml")), +                  \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/categories_variations.") % (qml ?  \
                QStringLiteral("qml") :  QStringLiteral("html"))),
                                       QStringList() << \
QStringLiteral("v_suboperation_consolidated"), \
SKGSimplePeriodEdit::PREVIOUS_AND_CURRENT_PERIODS);  } else if (iIndex == 2) {
         return new SKGHtmlBoardWidget(m_currentBankDocument,
@@ -168,7 +173,7 @@ SKGBoardWidget* SKGCategoriesPlugin::getDashboardWidget(int \
iIndex)  }
     return new SKGHtmlBoardWidget(m_currentBankDocument,
                                   getDashboardWidgetTitle(iIndex) % " - %1",
-                                  \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/categories_variations_issues.qml")), +           \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/categories_variations_issues.") % (qml ?  \
                QStringLiteral("qml") :  QStringLiteral("html"))),
                                   QStringList() << \
QStringLiteral("v_suboperation_consolidated"), \
SKGSimplePeriodEdit::PREVIOUS_AND_CURRENT_PERIODS);  }
 
diff --git a/plugins/skrooge/skrooge_report/skgreportplugin.cpp \
b/plugins/skrooge/skrooge_report/skgreportplugin.cpp index 1eda5f8..9da3088 100644
--- a/plugins/skrooge/skrooge_report/skgreportplugin.cpp
+++ b/plugins/skrooge/skrooge_report/skgreportplugin.cpp
@@ -130,9 +130,14 @@ SKGBoardWidget* SKGReportPlugin::getDashboardWidget(int iIndex)
     if (iIndex == 0)  {
         return new SKGReportBoardWidget(m_currentBankDocument);
     }
+    // Get QML mode for dashboard
+    KConfigSkeleton* skl = \
SKGMainPanel::getMainPanel()->getPluginByName(QStringLiteral("Dashboard \
plugin"))->getPreferenceSkeleton(); +    KConfigSkeletonItem* sklItem = \
skl->findItem(QStringLiteral("qmlmode")); +    bool qml = \
sklItem->property().toBool(); +
     return new SKGHtmlBoardWidget(m_currentBankDocument,
                                   getDashboardWidgetTitle(iIndex) % " - %1",
-                                  \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/personal_finance_score.qml")), +                 \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/personal_finance_score.") % (qml ?  \
                QStringLiteral("qml") :  QStringLiteral("html"))),
                                   QStringList() << \
QStringLiteral("v_suboperation_consolidated"), \
SKGSimplePeriodEdit::PREVIOUS_AND_CURRENT_PERIODS);  }
 
diff --git a/plugins/skrooge/skrooge_scheduled/skgscheduledplugin.cpp \
b/plugins/skrooge/skrooge_scheduled/skgscheduledplugin.cpp index 0c0514f..204e4d2 \
                100644
--- a/plugins/skrooge/skrooge_scheduled/skgscheduledplugin.cpp
+++ b/plugins/skrooge/skrooge_scheduled/skgscheduledplugin.cpp
@@ -112,9 +112,14 @@ QString SKGScheduledPlugin::getDashboardWidgetTitle(int iIndex)
 
 SKGBoardWidget* SKGScheduledPlugin::getDashboardWidget(int iIndex)
 {
+    // Get QML mode for dashboard
+    KConfigSkeleton* skl = \
SKGMainPanel::getMainPanel()->getPluginByName(QStringLiteral("Dashboard \
plugin"))->getPreferenceSkeleton(); +    KConfigSkeletonItem* sklItem = \
skl->findItem(QStringLiteral("qmlmode")); +    bool qml = \
sklItem->property().toBool(); +
     return new SKGHtmlBoardWidget(m_currentBankDocument,
                                   getDashboardWidgetTitle(iIndex) ,
-                                  \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/scheduled_operations.qml")), +                   \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/scheduled_operations.") % (qml ?  \
                QStringLiteral("qml") :  QStringLiteral("html"))),
                                   QStringList() << \
QStringLiteral("v_recurrentoperation_display"));  }
 
diff --git a/plugins/skrooge/skrooge_unit/skgunitplugin.cpp \
b/plugins/skrooge/skrooge_unit/skgunitplugin.cpp index 5a21e93..538810c 100644
--- a/plugins/skrooge/skrooge_unit/skgunitplugin.cpp
+++ b/plugins/skrooge/skrooge_unit/skgunitplugin.cpp
@@ -103,9 +103,14 @@ SKGBoardWidget* SKGUnitPlugin::getDashboardWidget(int iIndex)
     if (iIndex == 0) {
         return new SKGUnitBoardWidget(m_currentBankDocument);
     } else {
+        // Get QML mode for dashboard
+        KConfigSkeleton* skl = \
SKGMainPanel::getMainPanel()->getPluginByName(QStringLiteral("Dashboard \
plugin"))->getPreferenceSkeleton(); +        KConfigSkeletonItem* sklItem = \
skl->findItem(QStringLiteral("qmlmode")); +        bool qml = \
sklItem->property().toBool(); +
         return new SKGHtmlBoardWidget(m_currentBankDocument,
                                       getDashboardWidgetTitle(iIndex),
-                                      \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/portfolio.qml")), +                              \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("skrooge/html/default/portfolio.") % (qml ?  QStringLiteral("qml") :  \
                QStringLiteral("html"))),
                                       QStringList() << \
QStringLiteral("v_operation_display"));  }
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic