diff --git a/kmymoney/dialogs/kbalancechartdlg.cpp b/kmymoney/dialogs/kbalancechartdlg.cpp --- a/kmymoney/dialogs/kbalancechartdlg.cpp +++ b/kmymoney/dialogs/kbalancechartdlg.cpp @@ -83,7 +83,7 @@ reportCfg.setChartByDefault(true); reportCfg.setChartGridLines(false); reportCfg.setChartDataLabels(false); - reportCfg.setChartType(MyMoneyReport::eChartLine); + reportCfg.setChartType(MyMoneyReport::Chart::Line); reportCfg.setIncludingForecast(true); reportCfg.setIncludingBudgetActuals(true); if (account.accountType() == MyMoneyAccount::Investment) { diff --git a/kmymoney/dialogs/kreportconfigurationfilterdlg.cpp b/kmymoney/dialogs/kreportconfigurationfilterdlg.cpp --- a/kmymoney/dialogs/kreportconfigurationfilterdlg.cpp +++ b/kmymoney/dialogs/kreportconfigurationfilterdlg.cpp @@ -237,7 +237,7 @@ } if (m_tabChart) { - MyMoneyReport::EChartType ct[5] = { MyMoneyReport::eChartLine, MyMoneyReport::eChartBar, MyMoneyReport::eChartStackedBar, MyMoneyReport::eChartPie, MyMoneyReport::eChartRing }; + MyMoneyReport::Chart::Type ct[5] = { MyMoneyReport::Chart::Line, MyMoneyReport::Chart::Bar, MyMoneyReport::Chart::StackedBar, MyMoneyReport::Chart::Pie, MyMoneyReport::Chart::Ring }; m_currentState.setChartType(ct[m_tabChart->findChild("m_comboType")->currentIndex()]); m_currentState.setChartGridLines(m_tabChart->findChild("m_checkGridLines")->isChecked()); @@ -446,17 +446,17 @@ if (m_tabChart) { KMyMoneyGeneralCombo* combo = m_tabChart->findChild("m_comboType"); switch (m_initialState.chartType()) { - case MyMoneyReport::eChartNone: - combo->setCurrentItem(MyMoneyReport::eChartLine); + case MyMoneyReport::Chart::None: + combo->setCurrentItem(MyMoneyReport::Chart::Line); break; - case MyMoneyReport::eChartLine: - case MyMoneyReport::eChartBar: - case MyMoneyReport::eChartStackedBar: - case MyMoneyReport::eChartPie: - case MyMoneyReport::eChartRing: + case MyMoneyReport::Chart::Line: + case MyMoneyReport::Chart::Bar: + case MyMoneyReport::Chart::StackedBar: + case MyMoneyReport::Chart::Pie: + case MyMoneyReport::Chart::Ring: combo->setCurrentItem(m_initialState.chartType()); break; - case MyMoneyReport::eChartEnd: + case MyMoneyReport::Chart::End: throw MYMONEYEXCEPTION("KReportConfigurationFilterDlg::slotReset(): Report has invalid charttype"); } m_tabChart->findChild("m_checkGridLines")->setChecked(m_initialState.isChartGridLines()); diff --git a/kmymoney/mymoney/mymoneyreport.h b/kmymoney/mymoney/mymoneyreport.h --- a/kmymoney/mymoney/mymoneyreport.h +++ b/kmymoney/mymoney/mymoneyreport.h @@ -102,9 +102,11 @@ static const QStringList kText; }; - enum EChartType { eChartNone = 0, eChartLine, eChartBar, eChartPie, eChartRing, eChartStackedBar, eChartEnd }; - - static const QStringList kChartTypeText; + class Chart { + public: + enum Type { None = 0, Line, Bar, Pie, Ring, StackedBar, End }; + static const QStringList kText; + }; public: MyMoneyReport(); @@ -170,7 +172,7 @@ DetailLevel::Type detailLevel() const { return m_detailLevel; } - EChartType chartType() const { + Chart::Type chartType() const { return m_chartType; } bool isChartDataLabels() const { @@ -272,7 +274,7 @@ void setDetailLevel(DetailLevel::Type _detail) { m_detailLevel = _detail; } - void setChartType(EChartType _type) { + void setChartType(Chart::Type _type) { m_chartType = _type; } void setChartDataLabels(bool _f) { @@ -614,7 +616,7 @@ /** * What format should be used to draw this report as a chart */ - enum EChartType m_chartType; + Chart::Type m_chartType; /** * Whether the value of individual data points should be drawn on the chart */ diff --git a/kmymoney/mymoney/mymoneyreport.cpp b/kmymoney/mymoney/mymoneyreport.cpp --- a/kmymoney/mymoney/mymoneyreport.cpp +++ b/kmymoney/mymoney/mymoneyreport.cpp @@ -41,7 +41,7 @@ // and shift the bit for QueryColumns::end one position to the left const QStringList MyMoneyReport::QueryColumns::kText = QString("none,number,payee,category,tag,memo,account,reconcileflag,action,shares,price,performance,loan,balance").split(','); const QStringList MyMoneyReport::DetailLevel::kText = QString("none,all,top,group,total,invalid").split(','); -const QStringList MyMoneyReport::kChartTypeText = QString("none,line,bar,pie,ring,stackedbar,invalid").split(','); +const QStringList MyMoneyReport::Chart::kText = QString("none,line,bar,pie,ring,stackedbar,invalid").split(','); // This should live in mymoney/mymoneytransactionfilter.h const QStringList kTypeText = QString("all,payments,deposits,transfers,none").split(','); @@ -104,7 +104,7 @@ m_queryColumns(QueryColumns::None), m_dateLock(userDefined), m_accountGroupFilter(false), - m_chartType(eChartLine), + m_chartType(Chart::Line), m_chartDataLabels(true), m_chartGridLines(true), m_chartByDefault(false), @@ -150,7 +150,7 @@ m_queryColumns(QueryColumns::None), m_dateLock(_dl), m_accountGroupFilter(false), - m_chartType(eChartLine), + m_chartType(Chart::Line), m_chartDataLabels(true), m_chartGridLines(true), m_chartByDefault(false), @@ -423,11 +423,11 @@ if (m_includeMovingAverage) e.setAttribute("movingaveragedays", m_movingAverageDays); - if (m_chartType < 0 || m_chartType >= kChartTypeText.size()) { + if (m_chartType < 0 || m_chartType >= Chart::kText.size()) { qDebug("m_chartType out of bounds with %d on report of type %d. Default to none.", m_chartType, m_reportType); - e.setAttribute("charttype", kChartTypeText[0]); + e.setAttribute("charttype", Chart::kText[0]); } else { - e.setAttribute("charttype", kChartTypeText[m_chartType]); + e.setAttribute("charttype", Chart::kText[m_chartType]); } e.setAttribute("chartdatalabels", m_chartDataLabels); e.setAttribute("chartgridlines", m_chartGridLines); @@ -717,16 +717,16 @@ m_movingAverageDays = e.attribute("movingaveragedays", "1").toUInt(); //only load chart data if it is a pivot table - m_chartType = static_cast(0); + m_chartType = static_cast(0); if (m_reportType == Report::PivotTable) { - i = kChartTypeText.indexOf(e.attribute("charttype")); + i = Chart::kText.indexOf(e.attribute("charttype")); if (i >= 0) - m_chartType = static_cast(i); + m_chartType = static_cast(i); // if it is invalid, set to first type - if (m_chartType >= eChartEnd) - m_chartType = eChartLine; + if (m_chartType >= Chart::End) + m_chartType = Chart::Line; m_chartDataLabels = e.attribute("chartdatalabels", "1").toUInt(); m_chartGridLines = e.attribute("chartgridlines", "1").toUInt(); diff --git a/kmymoney/reports/kreportchartview.cpp b/kmymoney/reports/kreportchartview.cpp --- a/kmymoney/reports/kreportchartview.cpp +++ b/kmymoney/reports/kreportchartview.cpp @@ -116,9 +116,9 @@ setAccountSeries(true); switch (config.chartType()) { - case MyMoneyReport::eChartNone: - case MyMoneyReport::eChartEnd: - case MyMoneyReport::eChartLine: { + case MyMoneyReport::Chart::None: + case MyMoneyReport::Chart::End: + case MyMoneyReport::Chart::Line: { KDChart::LineDiagram* diagram = new KDChart::LineDiagram; if (config.isSkippingZero()) { @@ -132,31 +132,31 @@ coordinatePlane()->replaceDiagram(diagram); break; } - case MyMoneyReport::eChartBar: { + case MyMoneyReport::Chart::Bar: { KDChart::BarDiagram* diagram = new KDChart::BarDiagram; CartesianCoordinatePlane* cartesianPlane = new CartesianCoordinatePlane; replaceCoordinatePlane(cartesianPlane); coordinatePlane()->replaceDiagram(diagram); break; } - case MyMoneyReport::eChartStackedBar: { + case MyMoneyReport::Chart::StackedBar: { KDChart::BarDiagram* diagram = new KDChart::BarDiagram; CartesianCoordinatePlane* cartesianPlane = new CartesianCoordinatePlane; replaceCoordinatePlane(cartesianPlane); diagram->setType(BarDiagram::Stacked); coordinatePlane()->replaceDiagram(diagram); break; } - case MyMoneyReport::eChartPie: { + case MyMoneyReport::Chart::Pie: { KDChart::PieDiagram* diagram = new KDChart::PieDiagram; PolarCoordinatePlane* polarPlane = new PolarCoordinatePlane; replaceCoordinatePlane(polarPlane); coordinatePlane()->replaceDiagram(diagram); setAccountSeries(false); setSeriesTotals(true); break; } - case MyMoneyReport::eChartRing: { + case MyMoneyReport::Chart::Ring: { KDChart::RingDiagram* diagram = new KDChart::RingDiagram; PolarCoordinatePlane* polarPlane = new PolarCoordinatePlane; replaceCoordinatePlane(polarPlane); @@ -194,9 +194,9 @@ legend->setTitleText(i18nc("Chart legend title", "Legend")); //set up the axes for cartesian diagrams - if (config.chartType() == MyMoneyReport::eChartLine || - config.chartType() == MyMoneyReport::eChartBar || - config.chartType() == MyMoneyReport::eChartStackedBar) { + if (config.chartType() == MyMoneyReport::Chart::Line || + config.chartType() == MyMoneyReport::Chart::Bar || + config.chartType() == MyMoneyReport::Chart::StackedBar) { //set x axis CartesianAxis *xAxis = new CartesianAxis(); xAxis->setPosition(CartesianAxis::Bottom); @@ -241,12 +241,12 @@ yAxis->setRulerAttributes(yAxisRulerAttr); //add the axes to the corresponding diagram - if (config.chartType() == MyMoneyReport::eChartLine) { + if (config.chartType() == MyMoneyReport::Chart::Line) { KDChart::LineDiagram* lineDiagram = qobject_cast(planeDiagram); lineDiagram->addAxis(xAxis); lineDiagram->addAxis(yAxis); - } else if (config.chartType() == MyMoneyReport::eChartBar || - config.chartType() == MyMoneyReport::eChartStackedBar) { + } else if (config.chartType() == MyMoneyReport::Chart::Bar || + config.chartType() == MyMoneyReport::Chart::StackedBar) { KDChart::BarDiagram* barDiagram = qobject_cast(planeDiagram); barDiagram->addAxis(xAxis); barDiagram->addAxis(yAxis); diff --git a/kmymoney/views/kforecastview.cpp b/kmymoney/views/kforecastview.cpp --- a/kmymoney/views/kforecastview.cpp +++ b/kmymoney/views/kforecastview.cpp @@ -1017,7 +1017,7 @@ reportCfg.setChartByDefault(true); reportCfg.setChartGridLines(false); - reportCfg.setChartType(MyMoneyReport::eChartLine); + reportCfg.setChartType(MyMoneyReport::Chart::Line); reportCfg.setIncludingSchedules(false); // FIXME: this causes a crash //reportCfg.setColumnsAreDays( true ); diff --git a/kmymoney/views/khomeview.cpp b/kmymoney/views/khomeview.cpp --- a/kmymoney/views/khomeview.cpp +++ b/kmymoney/views/khomeview.cpp @@ -306,7 +306,7 @@ reportCfg.setChartByDefault(true); reportCfg.setChartGridLines(false); reportCfg.setChartDataLabels(false); - reportCfg.setChartType(MyMoneyReport::eChartLine); + reportCfg.setChartType(MyMoneyReport::Chart::Line); reportCfg.setIncludingSchedules(false); reportCfg.addAccountGroup(MyMoneyAccount::Asset); reportCfg.addAccountGroup(MyMoneyAccount::Liability); diff --git a/kmymoney/views/kreportsview.cpp b/kmymoney/views/kreportsview.cpp --- a/kmymoney/views/kreportsview.cpp +++ b/kmymoney/views/kreportsview.cpp @@ -1206,7 +1206,7 @@ i18n("Default Report") )); list.back().setChartByDefault(true); - list.back().setChartType(MyMoneyReport::eChartLine); + list.back().setChartType(MyMoneyReport::Chart::Line); list.back().setChartDataLabels(false); list.push_back(MyMoneyReport( @@ -1218,7 +1218,7 @@ i18n("Default Report") )); list.back().setChartByDefault(true); - list.back().setChartType(MyMoneyReport::eChartPie); + list.back().setChartType(MyMoneyReport::Chart::Pie); list.back().setShowingRowTotals(false); groups.push_back(list); @@ -1271,7 +1271,7 @@ )); list.back().setChartByDefault(true); list.back().setChartGridLines(false); - list.back().setChartType(MyMoneyReport::eChartLine); + list.back().setChartType(MyMoneyReport::Chart::Line); list.push_back(MyMoneyReport( MyMoneyReport::Row::Institution, @@ -1438,7 +1438,7 @@ )); list.back().setChartByDefault(true); list.back().setChartGridLines(false); - list.back().setChartType(MyMoneyReport::eChartPie); + list.back().setChartType(MyMoneyReport::Chart::Pie); list.back().setInvestmentsOnly(true); list.push_back(MyMoneyReport( @@ -1451,7 +1451,7 @@ )); list.back().setChartByDefault(true); list.back().setChartGridLines(false); - list.back().setChartType(MyMoneyReport::eChartLine); + list.back().setChartType(MyMoneyReport::Chart::Line); list.back().setColumnsAreDays(true); list.back().setInvestmentsOnly(true); @@ -1465,7 +1465,7 @@ )); list.back().setChartByDefault(true); list.back().setChartGridLines(false); - list.back().setChartType(MyMoneyReport::eChartLine); + list.back().setChartType(MyMoneyReport::Chart::Line); list.back().setColumnsAreDays(true); list.back().setInvestmentsOnly(true); list.back().setIncludingBudgetActuals(false); @@ -1484,7 +1484,7 @@ )); list.back().setChartByDefault(true); list.back().setChartGridLines(false); - list.back().setChartType(MyMoneyReport::eChartLine); + list.back().setChartType(MyMoneyReport::Chart::Line); list.back().setColumnsAreDays(true); list.back().setInvestmentsOnly(true); list.back().setIncludingBudgetActuals(false); @@ -1502,7 +1502,7 @@ i18n("Default Report") )); list.back().setChartGridLines(false); - list.back().setChartType(MyMoneyReport::eChartLine); + list.back().setChartType(MyMoneyReport::Chart::Line); list.back().setColumnsAreDays(true); list.back().setInvestmentsOnly(true); list.back().setIncludingBudgetActuals(false); @@ -1519,7 +1519,7 @@ )); list.back().setChartByDefault(true); list.back().setChartGridLines(false); - list.back().setChartType(MyMoneyReport::eChartLine); + list.back().setChartType(MyMoneyReport::Chart::Line); list.back().setColumnsAreDays(true); list.back().setInvestmentsOnly(true); list.back().setIncludingBudgetActuals(true); @@ -1649,7 +1649,7 @@ list.back().setChartByDefault(true); list.back().setChartGridLines(false); list.back().setBudget("Any", true); - list.back().setChartType(MyMoneyReport::eChartLine); + list.back().setChartType(MyMoneyReport::Chart::Line); groups.push_back(list); } @@ -1699,7 +1699,7 @@ list.back().setIncludingForecast(true); list.back().setChartByDefault(true); list.back().setChartGridLines(false); - list.back().setChartType(MyMoneyReport::eChartLine); + list.back().setChartType(MyMoneyReport::Chart::Line); groups.push_back(list); } { diff --git a/kmymoney/widgets/kmymoneyreportconfigtabimpl.cpp b/kmymoney/widgets/kmymoneyreportconfigtabimpl.cpp --- a/kmymoney/widgets/kmymoneyreportconfigtabimpl.cpp +++ b/kmymoney/widgets/kmymoneyreportconfigtabimpl.cpp @@ -79,11 +79,11 @@ ui = new Ui::kMyMoneyReportConfigTabChartDecl; ui->setupUi(this); - ui->m_comboType->addItem(i18nc("type of graphic chart", "Line"), MyMoneyReport::eChartLine); - ui->m_comboType->addItem(i18nc("type of graphic chart", "Bar"), MyMoneyReport::eChartBar); - ui->m_comboType->addItem(i18nc("type of graphic chart", "Stacked Bar"), MyMoneyReport::eChartStackedBar); - ui->m_comboType->addItem(i18nc("type of graphic chart", "Pie"), MyMoneyReport::eChartPie); - ui->m_comboType->addItem(i18nc("type of graphic chart", "Ring"), MyMoneyReport::eChartRing); + ui->m_comboType->addItem(i18nc("type of graphic chart", "Line"), MyMoneyReport::Chart::Line); + ui->m_comboType->addItem(i18nc("type of graphic chart", "Bar"), MyMoneyReport::Chart::Bar); + ui->m_comboType->addItem(i18nc("type of graphic chart", "Stacked Bar"), MyMoneyReport::Chart::StackedBar); + ui->m_comboType->addItem(i18nc("type of graphic chart", "Pie"), MyMoneyReport::Chart::Pie); + ui->m_comboType->addItem(i18nc("type of graphic chart", "Ring"), MyMoneyReport::Chart::Ring); } kMyMoneyReportConfigTabChartDecl::~kMyMoneyReportConfigTabChartDecl()