[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/office/skrooge
From: Stephane Mankowski <stephane () mankowski ! fr>
Date: 2011-02-12 12:15:38
Message-ID: 20110212121538.4B92FAC8BE () svn ! kde ! org
[Download RAW message or body]
SVN commit 1220004 by smankowski:
feature: Timeline in reports
M +1 -0 CHANGELOG
M +50 -7 skrooge_report/skgreportpluginwidget.cpp
M +33 -42 skrooge_report/skgreportpluginwidget_base.ui
--- trunk/extragear/office/skrooge/CHANGELOG #1220003:1220004
@@ -36,6 +36,7 @@
*New feature: Possibility to merge payees by using massive update on name of \
payees
*New feature: Possibility to merge units by using massive update on name of units
*New feature: Possibility to merge categories by using massive update on name of \
categories + *New feature: Timeline in reports
-- maintainer Stephane MANKOWSKI <stephane@mankowski.fr> xxx
--- trunk/extragear/office/skrooge/skrooge_report/skgreportpluginwidget.cpp \
#1220003:1220004 @@ -125,6 +125,7 @@
connect(ui.kLines, SIGNAL(currentIndexChanged(int)), this, SLOT(refresh()), \
Qt::QueuedConnection);
connect(ui.kMode, SIGNAL(currentIndexChanged(int)), this, SLOT(refresh()), \
Qt::QueuedConnection);
connect(ui.kPeriod, SIGNAL(currentIndexChanged(int)), this, SLOT(refresh()), \
Qt::QueuedConnection); + connect(ui.kTimeline, SIGNAL(valueChanged(int)), this, \
SLOT(refresh()), Qt::QueuedConnection);
connect(ui.kInterval, SIGNAL(currentIndexChanged(int)), this, SLOT(refresh()), \
Qt::QueuedConnection);
connect(ui.kDateBegin, SIGNAL(dateChanged(QDate)), this, SLOT(refresh()), \
Qt::QueuedConnection);
connect(ui.kDateEnd, SIGNAL(dateChanged(QDate)), this, SLOT(refresh()), \
Qt::QueuedConnection); @@ -228,6 +229,7 @@
}
root.setAttribute("interval", \
SKGServices::intToString(ui.kInterval->currentIndex()));
root.setAttribute("nb_intervals", \
SKGServices::intToString(ui.kNbIntervals->value())); + \
root.setAttribute("timeline", SKGServices::intToString(ui.kTimeline->value())); \
root.setAttribute("incomes", ui.kIncomes->isChecked() ? "Y" : "N"); \
root.setAttribute("expenses", ui.kExpenses->isChecked() ? "Y" : "N");
root.setAttribute("transfers", ui.kTransfers->isChecked() ? "Y" : "N");
@@ -258,6 +260,7 @@
QString period = root.attribute("period");
QString interval = root.attribute("interval");
QString nb_interval = root.attribute("nb_intervals");
+ QString timeline = root.attribute("timeline");
QString date_begin = root.attribute("date_begin");
QString date_end = root.attribute("date_end");
QString incomes = root.attribute("incomes");
@@ -282,6 +285,7 @@
if(period.isEmpty()) period = '1';
if(interval.isEmpty()) interval = '2';
if(nb_interval.isEmpty()) nb_interval = '1';
+ if(timeline.isEmpty()) timeline = '1';
if(incomes.isEmpty()) incomes = 'Y';
if(expenses.isEmpty()) expenses = 'Y';
if(transfers.isEmpty()) transfers = 'Y';
@@ -310,6 +314,7 @@
ui.kMode->setCurrentIndex(SKGServices::stringToInt(mode));
ui.kPeriod->setCurrentIndex(SKGServices::stringToInt(period));
ui.kInterval->setCurrentIndex(SKGServices::stringToInt(interval));
+ ui.kTimeline->setValue(SKGServices::stringToInt(timeline));
ui.kNbIntervals->setValue(SKGServices::stringToInt(nb_interval));
if(!date_begin.isEmpty()) \
ui.kDateBegin->setDate(QDate::fromJulianDay(SKGServices::stringToInt(date_begin)));
if(!date_end.isEmpty()) \
ui.kDateEnd->setDate(QDate::fromJulianDay(SKGServices::stringToInt(date_end))); @@ \
-438,7 +443,7 @@ if(ui.kPeriod->currentIndex() == 4) {
during += SKGServices::dateToSqlString(QDateTime(ui.kDateBegin->date())) + ' \
' + SKGServices::dateToSqlString(QDateTime(ui.kDateEnd->date())); } else \
if(ui.kPeriod->currentIndex() > 0) {
- during += ' ' + SKGServices::intToString(ui.kNbIntervals->value()) + ' ' + \
ui.kInterval->text(); + during += ' ' + \
SKGServices::intToString(ui.kNbIntervals->value()) + ' ' + ui.kInterval->text(); \
//TODO ui.kNbIntervals hidden }
QStringList types;
@@ -683,6 +688,38 @@
if(oWhereClausForPreviousData) *oWhereClausForPreviousData = "d_date<'" + \
SKGServices::dateToSqlString(QDateTime(ui.kDateBegin->date())) + \
'\'';
if(oWhereClausForForecastData) *oWhereClausForForecastData = "d_date>'" + \
SKGServices::dateToSqlString(QDateTime(ui.kDateEnd->date())) + '\''; break;
+ case 5:
+ // Timeline
+ val=13-ui.kTimeline->value();
+ switch(ui.kInterval->currentIndex()) {
+ case 0:
+ // Interval is in days
+ a = a.addDays(1-val);
+ b = a.addDays(1);
+ break;
+ case 1:
+ // Interval is in weeks
+ a = a.addDays(8-7*val-a.dayOfWeek());
+ b = a.addDays(6);
+ break;
+ case 2:
+ // Interval is in months
+ a = a.addDays(1-a.day()).addMonths(1-val);
+ b = a.addMonths(1).addDays(-1);
+ break;
+ case 3:
+ // Interval is in years
+ a = a.addDays(1-a.day()).addMonths(1-a.month()).addYears(1-val);
+ b = a.addYears(1).addDays(-1);
+ break;
+ }
+ ui.kDateBegin->setDate(a);
+ ui.kDateEnd->setDate(b);
+ wc = "d_date>='" + \
SKGServices::dateToSqlString(QDateTime(ui.kDateBegin->date())) + '\''; + \
if(ui.kForecastCmb->currentIndex() != 1) wc += "AND d_date<='" + \
SKGServices::dateToSqlString(QDateTime(ui.kDateEnd->date())) + '\''; //For forecast \
based on scheduled operations + if(oWhereClausForPreviousData) \
*oWhereClausForPreviousData = "d_date<'" + \
SKGServices::dateToSqlString(QDateTime(ui.kDateBegin->date())) + '\''; + \
if(oWhereClausForForecastData) *oWhereClausForForecastData = "d_date>'" + \
SKGServices::dateToSqlString(QDateTime(ui.kDateEnd->date())) + '\''; + break;
default:
// Take all dates
a = a.addYears(-1);
@@ -731,12 +768,15 @@
void SKGReportPluginWidget::refresh()
{
+ int p=ui.kPeriod->currentIndex();
+
ui.kForecastValue->setEnabled(ui.kForecastCmb->currentIndex() > 0);
ui.kLineRemove->setEnabled(m_attsForLinesAdded.count());
//Check dates
- ui.kDateSelect->setVisible(ui.kPeriod->currentIndex() > 0);
- ui.kDateSelect->setEnabled(ui.kPeriod->currentIndex() == 4);
+ ui.kDateSelect->setVisible(p > 0);
+ ui.kDateSelect->setEnabled(p == 4);
+ ui.kTimeline->setVisible(p == 5);
QDate d1 = ui.kDateBegin->date();
QDate d2 = ui.kDateEnd->date();
@@ -751,12 +791,15 @@
else ui.kIncomes->setChecked(true);
}
- bool current = (ui.kPeriod->currentIndex() == 1);
- bool previous = (ui.kPeriod->currentIndex() == 2);
- bool last = (ui.kPeriod->currentIndex() == 3);
+ bool current = (p == 1);
+ bool previous = (p == 2);
+ bool last = (p == 3);
+ bool timeline = (p == 5);
- ui.kInterval->setVisible(current || previous || last);
+ ui.kInterval->setVisible(current || previous || last || timeline);
ui.kNbIntervals->setVisible(last || previous);
+ ui.kForecastFrm->setEnabled(!timeline);
+ if(timeline) ui.kForecastCmb->setCurrentIndex(0);
m_timer.start(300);
}
--- trunk/extragear/office/skrooge/skrooge_report/skgreportpluginwidget_base.ui \
#1220003:1220004 @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>873</width>
- <height>475</height>
+ <height>476</height>
</rect>
</property>
<property name="sizePolicy">
@@ -430,6 +430,11 @@
<string>Custom...</string>
</property>
</item>
+ <item>
+ <property name="text">
+ <string>Timeline...</string>
+ </property>
+ </item>
</widget>
</item>
<item>
@@ -476,20 +481,23 @@
</widget>
</item>
<item>
- <spacer name="horizontalSpacer_2">
+ <widget class="QSlider" name="kTimeline">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>12</number>
+ </property>
+ <property name="value">
+ <number>12</number>
+ </property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
+ <property name="invertedAppearance">
+ <bool>false</bool>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>0</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
+ </widget>
</item>
</layout>
</item>
@@ -609,6 +617,7 @@
</widget>
</item>
<item>
+ <widget class="QFrame" name="kForecastFrm">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>2</number>
@@ -621,9 +630,6 @@
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
- <property name="buddy">
- <cstring>kForecastCmb</cstring>
- </property>
</widget>
</item>
<item>
@@ -670,22 +676,6 @@
</widget>
</item>
<item>
- <spacer name="horizontalSpacer_5">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Maximum</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>0</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -702,6 +692,7 @@
</spacer>
</item>
</layout>
+ </widget>
</item>
</layout>
</widget>
@@ -898,8 +889,8 @@
<slot>onOneLevelLess()</slot>
<hints>
<hint type="sourcelabel">
- <x>351</x>
- <y>363</y>
+ <x>353</x>
+ <y>344</y>
</hint>
<hint type="destinationlabel">
<x>330</x>
@@ -914,8 +905,8 @@
<slot>onOneLevelMore()</slot>
<hints>
<hint type="sourcelabel">
- <x>375</x>
- <y>363</y>
+ <x>377</x>
+ <y>344</y>
</hint>
<hint type="destinationlabel">
<x>446</x>
@@ -930,8 +921,8 @@
<slot>onOneLevelLess()</slot>
<hints>
<hint type="sourcelabel">
- <x>351</x>
- <y>397</y>
+ <x>353</x>
+ <y>384</y>
</hint>
<hint type="destinationlabel">
<x>574</x>
@@ -946,8 +937,8 @@
<slot>onOneLevelMore()</slot>
<hints>
<hint type="sourcelabel">
- <x>375</x>
- <y>397</y>
+ <x>377</x>
+ <y>384</y>
</hint>
<hint type="destinationlabel">
<x>696</x>
@@ -962,8 +953,8 @@
<slot>onAddLine()</slot>
<hints>
<hint type="sourcelabel">
- <x>327</x>
- <y>363</y>
+ <x>329</x>
+ <y>344</y>
</hint>
<hint type="destinationlabel">
<x>327</x>
@@ -978,8 +969,8 @@
<slot>onRemoveLine()</slot>
<hints>
<hint type="sourcelabel">
- <x>290</x>
- <y>349</y>
+ <x>305</x>
+ <y>344</y>
</hint>
<hint type="destinationlabel">
<x>362</x>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic