[Compbench-devel] CompBenchmarks++/Qt-4/Plan PlanDefineBatch.cpp, 1.5, 1.6 PlanDefineBatch.h, 1.5,
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-05-21 19:42:20
|
Update of /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv32090 Modified Files: PlanDefineBatch.cpp PlanDefineBatch.h Log Message: OptionSet can be handled. Index: PlanDefineBatch.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan/PlanDefineBatch.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PlanDefineBatch.cpp 21 May 2007 17:17:08 -0000 1.5 --- PlanDefineBatch.cpp 21 May 2007 19:42:14 -0000 1.6 *************** *** 8,11 **** --- 8,12 ---- int new_plan_idx = 0; + int new_options_idx = 0; PlanDefineBatchContextMenuEvent::PlanDefineBatchContextMenuEvent(Reason reason, *************** *** 33,36 **** --- 34,47 ---- this, SLOT(doBatchUnregister())); + 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())); + + if (item->type()==PICompiler) { addAction(QIcon(":/icons/tip.png"), tr("Informations"), *************** *** 38,42 **** addAction(QIcon(":/icons/remove.png"), tr("Remove compiler"), ! this, SLOT(doCompilerRemove())); } } --- 49,53 ---- addAction(QIcon(":/icons/remove.png"), tr("Remove compiler"), ! this, SLOT(doOptionsRemove())); } } *************** *** 69,72 **** --- 80,100 ---- } + void PlanDefineBatchContextMenu::doOptionSetRegister(void) + { + CBM::PlanBatch *B = item->Parent(PIPlanBatch)->Batch(); + + if (B) + App->planOptionSetRegister(B); + } + + void PlanDefineBatchContextMenu::doOptionSetUnregister(void) + { + CBM::CompilerOptionSet *OS = item->OptionSet(); + CBM::PlanBatch *B = item->Parent(PIPlanBatch)->Batch(); + + if (B) + App->planOptionSetUnregister(B, OS); + } + PlanDefineBatchContextMenu::~PlanDefineBatchContextMenu() { *************** *** 76,79 **** --- 104,108 ---- : QTreeWidgetItem(_type), CompilerHolder(0), + OptionSetHolder(0), OptionHolder(0), BenchmarkHolder(0), *************** *** 86,90 **** txt="Compilers"; break; ! case PIOptionSet: txt="Options' set"; break; --- 115,119 ---- txt="Compilers"; break; ! case PIOptionSets: txt="Options' set"; break; *************** *** 104,107 **** --- 133,137 ---- PIPlanBatch), CompilerHolder(0), + OptionSetHolder(0), OptionHolder(0), BenchmarkHolder(0), *************** *** 110,114 **** setFlags(Qt::ItemIsEditable | flags()); addChild(new PlanDefineBatchListItem(PICompilers)); ! addChild(new PlanDefineBatchListItem(PIOptionSet)); addChild(new PlanDefineBatchListItem(PIBenchmarks)); --- 140,144 ---- setFlags(Qt::ItemIsEditable | flags()); addChild(new PlanDefineBatchListItem(PICompilers)); ! addChild(new PlanDefineBatchListItem(PIOptionSets)); addChild(new PlanDefineBatchListItem(PIBenchmarks)); *************** *** 123,130 **** --- 153,173 ---- PICompiler), CompilerHolder(_compiler), + OptionSetHolder(0), + OptionHolder(0), + BenchmarkHolder(0), + PlanBatchHolder(0) + { + } + + PlanDefineBatchListItem::PlanDefineBatchListItem(CBM::CompilerOptionSet *_options) + : QTreeWidgetItem(QStringList(_options->Id().c_str()), + PIOptionSet), + CompilerHolder(0), + OptionSetHolder(_options), OptionHolder(0), BenchmarkHolder(0), PlanBatchHolder(0) { + setFlags(Qt::ItemIsEditable | flags()); } *************** *** 200,204 **** this, SLOT(doCompilerRemove(CBM::PlanBatch*, CBM::Compiler*)), Qt::QueuedConnection); ! headerItem()->setHidden(true); --- 243,265 ---- this, SLOT(doCompilerRemove(CBM::PlanBatch*, CBM::Compiler*)), Qt::QueuedConnection); ! ! connect(this, SIGNAL(sigOptionSetRegister(CBM::PlanBatch*)), ! this, SLOT(doOptionSetRegister(CBM::PlanBatch*)), ! Qt::QueuedConnection); ! ! connect(this, SIGNAL(sigOptionSetUnregister(CBM::PlanBatch*, ! CBM::CompilerOptionSet*)), ! this, SLOT(doOptionSetUnregister(CBM::PlanBatch*, ! CBM::CompilerOptionSet*)), ! Qt::QueuedConnection); ! ! connect(this, SIGNAL(sigOptionSetRenamed(CBM::PlanBatch*, ! CBM::CompilerOptionSet*, ! QString)), ! this, SLOT(doOptionSetRenamed(CBM::PlanBatch*, ! CBM::CompilerOptionSet*, ! QString)), ! Qt::QueuedConnection); ! headerItem()->setHidden(true); *************** *** 224,227 **** --- 285,316 ---- } + PlanDefineBatchListItem *PlanDefineBatchList::Item(CBM::PlanBatch *_batch, + CBM::CompilerOptionSet *_options) + { + PlanDefineBatchListItem *B = Item(_batch); + + if (!B) + return(0); + + + PlanDefineBatchListItem *R = B->Nearest(PIOptionSets); + PlanDefineBatchListItem *C; + + if (!R) + return(0); + + int i, n = R->childCount(); + + for(i=0; i<n; i++) { + C=(PlanDefineBatchListItem*) R->child(i); + if (C->type()==PIOptionSet) { + if (C->OptionSet()==_options) { + return(C); + } + } + } + return(0); + } + void PlanDefineBatchList::dragUpdateSelection(int x, int y) { *************** *** 264,269 **** PlanDefineBatchListItem *I = Item(_batch); ! if (I) I->Batch()->setId(_newname.toStdString()); } --- 353,361 ---- PlanDefineBatchListItem *I = Item(_batch); ! printf("plan ren?\n"); ! if (I) { ! printf("plan ren!\n"); I->Batch()->setId(_newname.toStdString()); + } } *************** *** 274,277 **** --- 366,429 ---- } + void PlanDefineBatchList::doOptionSetRegister(CBM::PlanBatch *_batch) + { + PlanDefineBatchListItem *B = Item(_batch); + + if (!B) + return; + + + PlanDefineBatchListItem *R = B->Nearest(PIOptionSets); + + if (R) { + std::string n = "options "; + char c[16]; + + new_options_idx++; + sprintf(c, "%d", new_options_idx); + n+=c; + + CBM::CompilerOptionSet *OS = new CBM::CompilerOptionSet(n); + if (B->Batch()->add(OS)) { + PlanDefineBatchListItem *I = new PlanDefineBatchListItem(OS); + R->addChild(I); + } else + delete(OS); + } + } + + void PlanDefineBatchList::doOptionSetRenamed(CBM::PlanBatch *_batch, + CBM::CompilerOptionSet *_options, + QString _newname) + { + PlanDefineBatchListItem *I = Item(_batch, _options); + + printf("rename I=%x\n", (unsigned int) I); + if (I) { + printf("newid = %s\n", _newname.toStdString().c_str()); + I->Batch()->setId(_newname.toStdString()); + } + } + + + void PlanDefineBatchList::doOptionSetUnregister(CBM::PlanBatch *_batch, + CBM::CompilerOptionSet *_options) + { + PlanDefineBatchListItem *B = Item(_batch, _options); + + if (!B) + return; + + + PlanDefineBatchListItem *R = B->Nearest(PIOptionSets); + + if (R) { + R->takeChild(R->indexOfChild(B)); + delete(R->OptionSet()); + delete(B); + } + } + + void PlanDefineBatchList::planBatchRegister(CBM::PlanBatch *_batch) { *************** *** 302,305 **** --- 454,475 ---- } + void PlanDefineBatchList::optionSetRegister(CBM::PlanBatch *_batch) + { + emit sigOptionSetRegister(_batch); + } + + void PlanDefineBatchList::optionSetUnregister(CBM::PlanBatch *_batch, + CBM::CompilerOptionSet *_options) + { + emit sigOptionSetUnregister(_batch, _options); + } + + void PlanDefineBatchList::optionSetRenamed(CBM::PlanBatch *_batch, + CBM::CompilerOptionSet *_options, + QString _newname) + { + emit sigOptionSetRenamed(_batch, _options, + _newname); + } void PlanDefineBatchList::contextMenuEvent(QContextMenuEvent *event) Index: PlanDefineBatch.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan/PlanDefineBatch.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PlanDefineBatch.h 21 May 2007 17:17:08 -0000 1.5 --- PlanDefineBatch.h 21 May 2007 19:42:14 -0000 1.6 *************** *** 9,12 **** --- 9,13 ---- #include <Compiler/CompilerHolder.h> #include <Basic/OptionHolder.h> + #include <Basic/OptionSetHolder.h> #include <Basic/BenchmarkHolder.h> #include <Basic/PlanBatchHolder.h> *************** *** 15,19 **** typedef enum { ! PIPlanBatch, PICompilers, PIOptionSet, PIOptions, PIBenchmarks, PICompiler, PIOption, PIBenchmark } PlanItemType; --- 16,22 ---- typedef enum { ! PIPlanBatch, PICompilers, ! PIOptionSets, PIOptionSet, ! PIOptions, PIBenchmarks, PICompiler, PIOption, PIBenchmark } PlanItemType; *************** *** 39,42 **** --- 42,48 ---- void doCompilerRemove(void); + void doOptionSetRegister(void); + void doOptionSetUnregister(void); + public: PlanDefineBatchContextMenu(class PlanDefineBatchListItem *_item); *************** *** 47,50 **** --- 53,57 ---- class PlanDefineBatchListItem : public QTreeWidgetItem, public CompilerHolder, + public OptionSetHolder, public OptionHolder, public BenchmarkHolder, *************** *** 55,58 **** --- 62,66 ---- public: PlanDefineBatchListItem(PlanItemType _type); + PlanDefineBatchListItem(CBM::CompilerOptionSet *_options); PlanDefineBatchListItem(CBM::PlanBatch *_batch); PlanDefineBatchListItem(CBM::Compiler *_compiler); *************** *** 70,73 **** --- 78,84 ---- protected: virtual PlanDefineBatchListItem *Item(CBM::PlanBatch *_batch); + virtual PlanDefineBatchListItem *Item(CBM::PlanBatch *_batch, + CBM::CompilerOptionSet *_options); + virtual void dragUpdateSelection(int x, int y); *************** *** 81,84 **** --- 92,96 ---- QTreeWidgetItem *_from); + signals: void sigPlanBatchRegister(CBM::PlanBatch *_batch); *************** *** 92,95 **** --- 104,114 ---- CBM::Compiler *_compiler); + void sigOptionSetRegister(CBM::PlanBatch *_batch); + void sigOptionSetUnregister(CBM::PlanBatch *_batch, + CBM::CompilerOptionSet *_options); + void sigOptionSetRenamed(CBM::PlanBatch *_batch, + CBM::CompilerOptionSet *_options, + QString _newname); + protected slots: virtual void doPlanBatchRegister(CBM::PlanBatch *_batch); *************** *** 98,104 **** QString _newname); ! void doCompilerUnregister(CBM::Compiler *_compiler); ! void doCompilerRemove(CBM::PlanBatch *_batch, ! CBM::Compiler *_compiler); public: --- 117,130 ---- QString _newname); ! virtual void doCompilerUnregister(CBM::Compiler *_compiler); ! virtual void doCompilerRemove(CBM::PlanBatch *_batch, ! CBM::Compiler *_compiler); ! ! virtual void doOptionSetRegister(CBM::PlanBatch *_batch); ! virtual void doOptionSetUnregister(CBM::PlanBatch *_batch, ! CBM::CompilerOptionSet *_options); ! virtual void doOptionSetRenamed(CBM::PlanBatch *_batch, ! CBM::CompilerOptionSet *_options, ! QString _newname); public: *************** *** 115,118 **** --- 141,151 ---- CBM::Compiler *_compiler); + virtual void optionSetRegister(CBM::PlanBatch *_batch); + virtual void optionSetUnregister(CBM::PlanBatch *_batch, + CBM::CompilerOptionSet *_options); + virtual void optionSetRenamed(CBM::PlanBatch *_batch, + CBM::CompilerOptionSet *_options, + QString _newname); + virtual ~PlanDefineBatchList(); }; |