[Compbench-devel] CompBenchmarks++/Qt-4/Plan PlanAvailableOption.cpp, 1.3, 1.4 PlanAvailableOption.
Brought to you by:
xfred
|
From: Frederic T. <xf...@us...> - 2007-09-12 19:33:17
|
Update of /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3414 Modified Files: PlanAvailableOption.cpp PlanAvailableOption.h PlanDefineBatch.cpp PlanDefineBatch.h Log Message: Preparing for options and groups' handling. Index: PlanDefineBatch.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan/PlanDefineBatch.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PlanDefineBatch.cpp 12 Sep 2007 17:49:23 -0000 1.10 --- PlanDefineBatch.cpp 12 Sep 2007 19:33:12 -0000 1.11 *************** *** 38,46 **** if ((item->type()==PIOptionSets) || (item->type()==PIOptionSet)) ! addAction(QIcon(":/icons/add.png"), tr("Add options"), this, SLOT(doOptionSetRegister())); if (item->type()==PIOptionSet) ! addAction(QIcon(":/icons/remove.png"), tr("Remove options"), this, SLOT(doOptionSetUnregister())); --- 38,46 ---- if ((item->type()==PIOptionSets) || (item->type()==PIOptionSet)) ! addAction(QIcon(":/icons/add.png"), tr("Add option set"), this, SLOT(doOptionSetRegister())); if (item->type()==PIOptionSet) ! addAction(QIcon(":/icons/remove.png"), tr("Remove option set"), this, SLOT(doOptionSetUnregister())); *************** *** 176,179 **** --- 176,191 ---- } + PlanDefineBatchListItem::PlanDefineBatchListItem(CBM::CompilerOption *_option) + : QTreeWidgetItem(QStringList(_option->Option().c_str()), + PIOption), + CompilerHolder(0), + OptionSetHolder(0), + OptionHolder(_option), + BenchmarkHolder(0), + PlanBatchHolder(0) + { + // setFlags(Qt::ItemIsEditable | flags()); + } + PlanDefineBatchListItem *PlanDefineBatchListItem::Parent(PlanItemType _which) { *************** *** 398,402 **** if (R) { ! std::string n = "options "; char c[16]; --- 410,414 ---- if (R) { ! std::string n = "option set "; char c[16]; *************** *** 594,610 **** if (I) { ! PlanDefineBatchListItem *PlanItem = I->Parent(PIPlanBatch); ! event->setDropAction(Qt::MoveAction); ! CBM::Compiler *C = App->PlanCompilerSelected(); ! ! PlanDefineBatchListItem *P = I->Nearest(PICompilers); ! if (P) { ! P->setExpanded(true); ! if (PlanItem->Batch()->add(C)) { ! PlanDefineBatchListItem *CI = new PlanDefineBatchListItem(C); P->addChild(CI); ! } ! } else event->accept(); } else event->ignore(); --- 606,641 ---- if (I) { ! if (event->mimeData()->text()=="compiler") { ! PlanDefineBatchListItem *PlanItem = I->Parent(PIPlanBatch); ! event->setDropAction(Qt::MoveAction); ! CBM::Compiler *C = App->PlanCompilerSelected(); ! ! PlanDefineBatchListItem *P = I->Nearest(PICompilers); ! if (P) { ! P->setExpanded(true); ! if (PlanItem->Batch()->add(C)) { ! PlanDefineBatchListItem *CI = new PlanDefineBatchListItem(C); P->addChild(CI); ! } ! } else event->accept(); + } else + if (event->mimeData()->text()=="option") { + PlanDefineBatchListItem *PlanItem = I->Parent(PIPlanBatch); + event->setDropAction(Qt::MoveAction); + CBM::CompilerOption *O = App->PlanCompilerOptionSelected(); + + PlanDefineBatchListItem *P = I->Nearest(PIOptions); + if (P) { + P->setExpanded(true); + /* if (P->Options()->add(O)) { + PlanDefineBatchListItem *OI = new PlanDefineBatchListItem(O); + P->addChild(OI); + */ + printf("there!\n"); + } + } + else + event->accept(); } else event->ignore(); Index: PlanDefineBatch.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan/PlanDefineBatch.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PlanDefineBatch.h 31 Jul 2007 17:28:22 -0000 1.8 --- PlanDefineBatch.h 12 Sep 2007 19:33:12 -0000 1.9 *************** *** 65,68 **** --- 65,69 ---- PlanDefineBatchListItem(PlanItemType _type); PlanDefineBatchListItem(CBM::CompilerOptionSet *_options); + PlanDefineBatchListItem(CBM::CompilerOption *_option); PlanDefineBatchListItem(CBM::PlanBatch *_batch); PlanDefineBatchListItem(CBM::Compiler *_compiler); Index: PlanAvailableOption.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan/PlanAvailableOption.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PlanAvailableOption.h 22 May 2007 17:28:52 -0000 1.2 --- PlanAvailableOption.h 12 Sep 2007 19:33:12 -0000 1.3 *************** *** 47,50 **** --- 47,51 ---- private: protected: + virtual void mousePressEvent(QMouseEvent *event); virtual void contextMenuEvent(QContextMenuEvent *event); signals: *************** *** 53,56 **** --- 54,58 ---- public slots: void doOptionsRefresh(CBM::Compiler *_compiler); + void doSelectionChanged(void); public: *************** *** 58,61 **** --- 60,64 ---- virtual void optionsRefresh(CBM::Compiler *_compiler); + virtual CBM::CompilerOption *optionSelected(void); virtual ~PlanAvailableOptionList(); Index: PlanAvailableOption.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan/PlanAvailableOption.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PlanAvailableOption.cpp 31 Jul 2007 17:28:04 -0000 1.3 --- PlanAvailableOption.cpp 12 Sep 2007 19:33:12 -0000 1.4 *************** *** 66,73 **** --- 66,103 ---- this, SLOT(doOptionsRefresh(CBM::Compiler*)), Qt::QueuedConnection); + connect(this, SIGNAL(currentItemChanged(QListWidgetItem*, + QListWidgetItem*)), + this, SLOT(doSelectionChanged()), + Qt::QueuedConnection); setContextMenuPolicy(Qt::DefaultContextMenu); } + void PlanAvailableOptionList::mousePressEvent(QMouseEvent *event) + { + QListWidget::mousePressEvent(event); + + CBM::CompilerOption *O = optionSelected(); + + if (!O) + return; + + QString plainText = "option"; + + 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 PlanAvailableOptionList::contextMenuEvent(QContextMenuEvent *event) { *************** *** 81,84 **** --- 111,124 ---- } + CBM::CompilerOption *PlanAvailableOptionList::optionSelected(void) + { + PlanAvailableOptionListItem *I = (PlanAvailableOptionListItem*) currentItem(); + + if (!I) + return(0); + + return(I->Option()); + } + void PlanAvailableOptionList::doOptionsRefresh(CBM::Compiler *_compiler) { *************** *** 113,116 **** --- 153,161 ---- } + void PlanAvailableOptionList::doSelectionChanged(void) + { + emit App->planOptionSelect(optionSelected()); + } + PlanAvailableOptionList::~PlanAvailableOptionList() { |