[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/kplato
From: Frédéric Lambert <konkistadorr () gmail ! com>
Date: 2007-01-29 17:40:06
Message-ID: 1170092406.973107.31343.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 628289 by flambert:
API for the Chart
M +5 -0 kptchartdialog.cc
M +2 -1 kptchartdialog.h
M +19 -12 kptchartpanel.cc
M +4 -4 kptchartpanel.h
M +68 -41 kptchartwidget.cc
M +15 -4 kptchartwidget.h
--- trunk/koffice/kplato/kptchartdialog.cc #628288:628289
@@ -40,6 +40,11 @@
// connect(this,SIGNAL(CloseClicked()),this,SLOT(slotClose()));
}
+ChartDialog::~ChartDialog()
+{
+ delete m_panel;
+}
+
KCommand *ChartDialog::buildCommand(Part *part) {
kDebug()<< "Chart Dialog : buildCommand";
//return m_panel->buildCommand(part);
--- trunk/koffice/kplato/kptchartdialog.h #628288:628289
@@ -36,7 +36,7 @@
Q_OBJECT
public:
explicit ChartDialog(QWidget *parent=0, const char *name=0);
-
+ ~ChartDialog();
KCommand *buildCommand(Part *part);
ChartPanel * m_panel;
@@ -45,6 +45,7 @@
void slotCurve2();
void slotCurve3();*/
void slotClose();
+
};
--- trunk/koffice/kplato/kptchartpanel.cc #628288:628289
@@ -25,6 +25,9 @@
namespace KPlato
{
+
+
+
ChartPanel::ChartPanel(QWidget *p) : ChartPanelBase(p)
{
@@ -39,49 +42,53 @@
connect(curve2,SIGNAL(clicked()),SLOT(slotBCPW()));
connect(curve1,SIGNAL(clicked()),SLOT(slotBCPS()));
connect(curve3,SIGNAL(clicked()),SLOT(slotACPW()));
-bcwp=false;
-bcws=false;
-acwp=false;
+is_bcwp_draw=false;
+is_bcws_draw=false;
+is_acwp_draw=false;
}
+ChartPanel::~ChartPanel()
+{
+ delete chart;
+}
void ChartPanel::slotBCPW()
{
- if(bcwp==false)
+ if(is_bcwp_draw==false)
{
chart->drawBCWP();
- bcwp=true;
+ is_bcwp_draw=true;
}
else
{
chart->undrawBCWP();
- bcwp=false;
+ is_bcwp_draw=false;
}
}
void ChartPanel::slotBCPS()
{
- if(bcws==false)
+ if(is_bcws_draw==false)
{
chart->drawBCWS();
- bcws=true;
+ is_bcws_draw=true;
}
else
{
chart->undrawBCWS();
- bcws=false;
+ is_bcws_draw=false;
}
}
void ChartPanel::slotACPW()
{
- if(acwp==false){
+ if(is_acwp_draw==false){
chart->drawACWP();
- acwp=true;
+ is_acwp_draw=true;
}
else
{
chart->undrawACWP();
- acwp=false;
+ is_acwp_draw=false;
}
}
--- trunk/koffice/kplato/kptchartpanel.h #628288:628289
@@ -55,13 +55,13 @@
private:
ChartWidget * chart;
-bool bcwp;
-bool bcws;
-bool acwp;
+bool is_bcwp_draw;
+bool is_bcws_draw;
+bool is_acwp_draw;
public:
ChartPanel(QWidget *parent=0);
-
+ ~ChartPanel();
public slots:
void slotBCPW();
void slotBCPS();
--- trunk/koffice/kplato/kptchartwidget.cc #628288:628289
@@ -30,90 +30,117 @@
kDebug() << "ChartWidget :: Constructor";
setMaximumSize(600,350);
//setFont(new QFont(blue));
-curve_draw=0;
-bcwp=false;
-bcws=false;
-acwp=false;
+
+is_bcwp_draw=false;
+is_bcws_draw=false;
+is_acwp_draw=false;
+
+/* TEST */
+bcwpPoints.push_back(QPointF(10,maximumHeight()-15));
+bcwpPoints.push_back(QPointF(125,250));
+bcwpPoints.push_back(QPointF(200,200));
+bcwpPoints.push_back(QPointF(400,175));
+bcwpPoints.push_back(QPointF(600,40));
}
void ChartWidget::paintEvent(QPaintEvent * ev)
{
-painter=new QPainter(this);
+QPainter painter(this);
kDebug() << "Print it PLease :D";
/* CHANGE COLORS !! */
-painter->setPen(QColor(Qt::blue));
+painter.setPen(QColor(Qt::blue));
//painter.fillRect(QRectF(-1000, -1000, 1000, 1000),QBrush(QColor(Qt::red)));
-painter->drawText(200,150,"I am a Chart!");
+painter.drawText(200,150,"I am a Chart!");
/* attributes : 1er : par rapport au coté, 2eme : par rapport au haut !
*/
-painter->drawText(2, 10,"Budget");
+painter.drawText(2, 10,"Budget");
//painter.drawText(maximumWidth()-15, maximumHeight()-20,"Time");
-painter->drawText(maximumWidth()-70,maximumHeight() ,"Time");
-painter->drawLine(QLine(10,15,10,maximumHeight()-15));
-painter->drawLine(QLine(10,maximumHeight()-15,maximumWidth()-10,maximumHeight()-15));
+painter.drawText(maximumWidth()-70,maximumHeight() ,"Time");
+painter.drawLine(QLine(10,15,10,maximumHeight()-15));
+painter.drawLine(QLine(10,maximumHeight()-15,maximumWidth()-10,maximumHeight()-15));
-if(bcwp==true)
+if(is_bcwp_draw==true)
{
- painter->setPen(QColor(Qt::red));
- // DRAW BCWP FUNCTION
- painter->drawLine(QLine(10,maximumHeight()-15,maximumWidth()-10,32));
- bcwp=true;
+ painter.setPen(QColor(Qt::red));
+ painter.drawPolyline(QPolygonF(bcwpPoints));
+ // painter.drawLine(QLine(10,maximumHeight()-15,maximumWidth()-10,32));
+ is_bcwp_draw=true;
}
-else{
+if(is_bcws_draw==true){
+ painter.setPen(QColor(Qt::yellow));
+ //painter.drawPolyline(QPolygonF(bcwsPoints));
+ painter.drawLine(QLine(10,maximumHeight()-15,maximumWidth()-10,150));
+ is_bcws_draw=true;
}
-if(bcws==true){
- painter->setPen(QColor(Qt::yellow));
- // DRAW BCWP FUNCTION
- painter->drawLine(QLine(10,maximumHeight()-15,maximumWidth()-10,150));
- bcws=true;
-}
-else
-{
-}
-if(acwp==true)
+if(is_acwp_draw==true)
{
- painter->setPen(QColor(Qt::green));
- // DRAW BCWP FUNCTION
- painter->drawLine(QLine(10,maximumHeight()-15,maximumWidth()-10,100));
- acwp=true;
+ painter.setPen(QColor(Qt::green));
+ //painter.drawPolyline(QPolygonF(acwpPoints));
+ painter.drawLine(QLine(10,maximumHeight()-15,maximumWidth()-10,100));
+ is_acwp_draw=true;
}
-else{
+
-}
-painter->end();
-}
+}// end PaintEvent();
void ChartWidget::drawBCWP(){
- bcwp=true;
+ is_bcwp_draw=true;
this->update();
}
void ChartWidget::undrawBCWP(){
- bcwp=false;
+ is_bcwp_draw=false;
this->update();
}
void ChartWidget::drawBCWS(){
- bcws=true;
+ is_bcws_draw=true;
this->update();
}
void ChartWidget::undrawBCWS(){
- bcws=false;
+ is_bcws_draw=false;
this->update();
}
void ChartWidget::drawACWP(){
- acwp=true;
+ is_acwp_draw=true;
this->update();
}
void ChartWidget::undrawACWP(){
- acwp=false;
+ is_acwp_draw=false;
this->update();
}
+/* API CURVES TO GET POINTS*/
+
+/* GETTERS AND SETTERS */
+
+void ChartWidget::setPointsBCPW(QVector<QPointF> vec)
+{
+ this->bcwpPoints = vec;
+}
+void ChartWidget::setPointsBCPS(QVector<QPointF> vec)
+{
+ this->bcwsPoints = vec;
+}
+void ChartWidget::setPointsACPW(QVector<QPointF> vec)
+{
+ this->acwpPoints = vec;
+}
+
+const int ChartWidget::getMaximumWidth()
+{
+ return(this->maximumWidth());
+}
+const int ChartWidget::getMaximumHeight()
+{
+ return(this->maximumHeight());
+}
+
+
} // namespace Kplato
--- trunk/koffice/kplato/kptchartwidget.h #628288:628289
@@ -27,15 +27,21 @@
namespace KPlato
{
+
+
class ChartWidget : public QWidget{
private:
int curve_draw;
-QPainter* painter;
-bool bcwp;
-bool bcws;
-bool acwp;
+QPainter painter;
+bool is_bcwp_draw;
+bool is_bcws_draw;
+bool is_acwp_draw;
+QVector<QPointF> bcwpPoints;
+QVector<QPointF> bcwsPoints;
+QVector<QPointF> acwpPoints;
+
public:
ChartWidget(QWidget *parent=0, const char *name=0);
@@ -46,6 +52,11 @@
void undrawBCWS();
void drawACWP();
void undrawACWP();
+ void setPointsBCPW(QVector<QPointF> );
+ void setPointsBCPS(QVector<QPointF> );
+ void setPointsACPW(QVector<QPointF> );
+ const int getMaximumWidth();
+ const int getMaximumHeight();
};
} //namespace KPlato
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic