[Compbench-devel] CompBenchmarks++/Qt-4/Plan PlanAvailableCompiler.cpp, 1.2, 1.3 PlanAvailableCompi
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-05-21 17:05:49
|
Update of /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv710 Modified Files: PlanAvailableCompiler.cpp PlanAvailableCompiler.h Log Message: Windows displaying informations for available compilers. Index: PlanAvailableCompiler.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan/PlanAvailableCompiler.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PlanAvailableCompiler.h 17 May 2007 22:36:11 -0000 1.1 --- PlanAvailableCompiler.h 21 May 2007 17:05:45 -0000 1.2 *************** *** 3,10 **** --- 3,37 ---- #include <QListWidget> + #include <QContextMenuEvent> + #include <QMenu> #include <Compiler/CompilerHolder.h> namespace CQT { + + class PlanAvailableCompilerContextMenuEvent : public QContextMenuEvent + { + public: + PlanAvailableCompilerContextMenuEvent(Reason reason, + const QPoint &globalPos); + + virtual ~PlanAvailableCompilerContextMenuEvent(); + }; + + class PlanAvailableCompilerContextMenu : public QMenu + { + Q_OBJECT + private: + CBM::Compiler *compiler; + protected slots: + void doCompilerInfo(void); + + public: + PlanAvailableCompilerContextMenu(class PlanAvailableCompilerListItem *_item); + + virtual ~PlanAvailableCompilerContextMenu(); + }; + + class PlanAvailableCompilerListItem : public QListWidgetItem, public CompilerHolder *************** *** 22,26 **** protected: virtual void mousePressEvent(QMouseEvent *event); ! signals: void sigCompilerRegister(CBM::Compiler *_compiler); --- 49,53 ---- protected: virtual void mousePressEvent(QMouseEvent *event); ! virtual void contextMenuEvent(QContextMenuEvent *event); signals: void sigCompilerRegister(CBM::Compiler *_compiler); Index: PlanAvailableCompiler.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan/PlanAvailableCompiler.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PlanAvailableCompiler.cpp 21 May 2007 16:37:04 -0000 1.2 --- PlanAvailableCompiler.cpp 21 May 2007 17:05:45 -0000 1.3 *************** *** 1,3 **** --- 1,5 ---- + #include <Compiler/CompilerInfo.h> #include <main.h> + #include <Plan/PlanAvailableCompiler.h> #include <System/System.h> *************** *** 5,8 **** --- 7,46 ---- using namespace CQT; + PlanAvailableCompilerContextMenuEvent::PlanAvailableCompilerContextMenuEvent(Reason reason, + const QPoint &globalPos) + : QContextMenuEvent(reason, globalPos) + { + } + + PlanAvailableCompilerContextMenuEvent::~PlanAvailableCompilerContextMenuEvent() + { + } + + PlanAvailableCompilerContextMenu::PlanAvailableCompilerContextMenu(PlanAvailableCompilerListItem *_item) + : QMenu("Compiler") + { + if (_item) { + compiler=_item->Compiler(); + addAction(QIcon(":/icons/tip.png"), tr("Informations"), + this, SLOT(doCompilerInfo())); + } + } + + void PlanAvailableCompilerContextMenu::doCompilerInfo(void) + { + QWidget *W = new CompilerInfo(compiler); + std::string title; + + title="Informations about "; + title+=compiler->Binary(); + W->setWindowTitle(title.c_str()); + W->setWindowIcon(QIcon(":/icons/tip.png")); + W->show(); + } + + PlanAvailableCompilerContextMenu::~PlanAvailableCompilerContextMenu() + { + } + PlanAvailableCompilerListItem::PlanAvailableCompilerListItem(CBM::Compiler *_compiler) : QListWidgetItem(_compiler->Name().c_str()), *************** *** 34,37 **** --- 72,76 ---- setToolTip(tr("Drag compilers in Benchmark definition to use them")); + setContextMenuPolicy(Qt::DefaultContextMenu); } *************** *** 62,65 **** --- 101,110 ---- } + void PlanAvailableCompilerList::contextMenuEvent(QContextMenuEvent *event) + { + PlanAvailableCompilerContextMenu m((PlanAvailableCompilerListItem*)currentItem()); + m.exec(event->globalPos()); + } + void PlanAvailableCompilerList::doCompilerRegister(CBM::Compiler *_compiler) { |