[Compbench-devel] CompBenchmarks++/Qt-4/Plan PlanAvailableBenchmark.cpp, 1.1, 1.2 PlanAvailableBenc
Brought to you by:
xfred
|
From: Frederic T. <xf...@us...> - 2007-09-17 19:38:51
|
Update of /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv14597/Plan Modified Files: PlanAvailableBenchmark.cpp PlanAvailableBenchmark.h PlanDefineBatch.cpp PlanDefineBatch.h Log Message: Benchmark(s) can be registered within a plan. Index: PlanDefineBatch.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan/PlanDefineBatch.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** PlanDefineBatch.cpp 16 Sep 2007 19:22:27 -0000 1.19 --- PlanDefineBatch.cpp 17 Sep 2007 19:38:47 -0000 1.20 *************** *** 146,150 **** CBM::CompilerOption *O = item->Option(); - printf("here %x %x %x %x\n", B, OS, OG, O); if ((B) && (OS) && (OG) && (O)) PL->doOptionUnregister(B, OS, OG, O); --- 146,149 ---- *************** *** 218,221 **** --- 217,232 ---- } + PlanDefineBatchListItem::PlanDefineBatchListItem(CBM::Benchmark *_benchmark) + : QTreeWidgetItem(QStringList(_benchmark->Name().c_str()), + PIBenchmark), + CompilerHolder(0), + OptionSetHolder(0), + OptionsHolder(0), + OptionHolder(0), + BenchmarkHolder(_benchmark), + PlanBatchHolder(0) + { + } + PlanDefineBatchListItem::PlanDefineBatchListItem(CBM::CompilerOptionSet *_options) : QTreeWidgetItem(QStringList(_options->Id().c_str()), *************** *** 785,795 **** } else if (event->mimeData()->text()=="option") { - printf("yeah\n"); - PlanDefineBatchListItem *PlanItem = I->Parent(PIPlanBatch); event->setDropAction(Qt::MoveAction); CBM::CompilerOption *O = App->PlanCompilerOptionSelected(); PlanDefineBatchListItem *P = I->Parent(PIOptions); - printf("P=%x\n", P); if (P) { P->setExpanded(true); --- 796,803 ---- *************** *** 798,807 **** PlanDefineBatchListItem *OI = new PlanDefineBatchListItem(O); P->addChild(OI); - printf("there!\n"); } } ! } ! else ! event->accept(); } else event->ignore(); --- 806,828 ---- PlanDefineBatchListItem *OI = new PlanDefineBatchListItem(O); P->addChild(OI); } } ! } else ! if (event->mimeData()->text()=="benchmark") { ! PlanDefineBatchListItem *PlanItem = I->Parent(PIPlanBatch); ! event->setDropAction(Qt::MoveAction); ! CBM::Benchmark *B = App->PlanBenchmarkSelected(); ! ! PlanDefineBatchListItem *P = I->Parent(PIBenchmarks); ! if (P) { ! P->setExpanded(true); ! if (PlanItem->Batch()->add(B)) { ! PlanDefineBatchListItem *OI = new PlanDefineBatchListItem(B); ! P->addChild(OI); ! } ! } ! } ! else ! event->accept(); } else event->ignore(); Index: PlanDefineBatch.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan/PlanDefineBatch.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PlanDefineBatch.h 16 Sep 2007 19:22:27 -0000 1.14 --- PlanDefineBatch.h 17 Sep 2007 19:38:47 -0000 1.15 *************** *** 75,78 **** --- 75,79 ---- PlanDefineBatchListItem(CBM::PlanBatch *_batch); PlanDefineBatchListItem(CBM::Compiler *_compiler); + PlanDefineBatchListItem(CBM::Benchmark *_benchmark); virtual PlanDefineBatchListItem *Parent(PlanItemType _which); Index: PlanAvailableBenchmark.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan/PlanAvailableBenchmark.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PlanAvailableBenchmark.cpp 17 May 2007 22:36:11 -0000 1.1 --- PlanAvailableBenchmark.cpp 17 Sep 2007 19:38:47 -0000 1.2 *************** *** 1,2 **** --- 1,8 ---- + #include <QMimeData> + #include <QDrag> + #include <QMouseEvent> + + #include <main.h> + #include <Plan/PlanAvailableBenchmark.h> *************** *** 25,28 **** --- 31,39 ---- this, SLOT(doRefreshBenchmarks())); + connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*, + QTreeWidgetItem*)), + this, SLOT(doSelectionChanged()), + Qt::QueuedConnection); + headerItem()->setHidden(true); doRefreshBenchmarks(); *************** *** 30,33 **** --- 41,70 ---- + void PlanAvailableBenchmarkList::mousePressEvent(QMouseEvent *event) + { + QTreeWidget::mousePressEvent(event); + + CBM::Benchmark *C = benchmarkSelected(); + + if (!C) + return; + + QString plainText = "benchmark"; + + QMimeData *mimeData = new QMimeData; + mimeData->setText(plainText); + + QDrag *drag = new QDrag(this); + drag->setMimeData(mimeData); + drag->setHotSpot(event->pos() - rect().topLeft()); + + Qt::DropAction dropAction = drag->start(Qt::CopyAction | Qt::MoveAction); + + if (dropAction == Qt::MoveAction) { + close(); + update(); + } + } + void PlanAvailableBenchmarkList::doRefreshBenchmarks(void) { *************** *** 66,69 **** --- 103,121 ---- } + void PlanAvailableBenchmarkList::doSelectionChanged(void) + { + emit App->planBenchmarkSelect(benchmarkSelected()); + } + + CBM::Benchmark *PlanAvailableBenchmarkList::benchmarkSelected(void) + { + PlanAvailableBenchmarkListItem *I = dynamic_cast<PlanAvailableBenchmarkListItem*>(currentItem()); + + if (!I) + return(0); + + return(I->Benchmark()); + } + PlanAvailableBenchmarkList::~PlanAvailableBenchmarkList() { Index: PlanAvailableBenchmark.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan/PlanAvailableBenchmark.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PlanAvailableBenchmark.h 17 May 2007 22:36:11 -0000 1.1 --- PlanAvailableBenchmark.h 17 Sep 2007 19:38:47 -0000 1.2 *************** *** 21,33 **** private: protected slots: virtual void doRefreshBenchmarks(void); signals: virtual void sigRefreshBenchmarks(void); ! public: PlanAvailableBenchmarkList(QWidget *parent = 0); virtual void refreshBenchmarks(void); virtual ~PlanAvailableBenchmarkList(); --- 21,36 ---- private: protected slots: + virtual void mousePressEvent(QMouseEvent *event); virtual void doRefreshBenchmarks(void); signals: virtual void sigRefreshBenchmarks(void); ! public slots: ! void doSelectionChanged(void); public: PlanAvailableBenchmarkList(QWidget *parent = 0); virtual void refreshBenchmarks(void); + virtual CBM::Benchmark *benchmarkSelected(void); virtual ~PlanAvailableBenchmarkList(); |