Removing easyChams and runPharos since they are now in goodies directory of CHAMS svn tree
This commit is contained in:
parent
d51c8820d5
commit
23770a1d47
|
@ -1,22 +0,0 @@
|
|||
PROJECT(EASYCHAMS)
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0)
|
||||
|
||||
SET(CMAKE_BUILD_TYPE release)
|
||||
|
||||
FIND_PACKAGE(Qt4 REQUIRED)
|
||||
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
|
||||
SET(CPP_FILES main.cpp MainWindow.cpp CompilationWidget.cpp CompileHighlighter.cpp ConfigDialog.cpp)
|
||||
|
||||
QT4_WRAP_CPP(MOC_EASYCHAMS MainWindow.h CompilationWidget.h CompileHighlighter.h ConfigDialog.h)
|
||||
|
||||
IF(APPLE)
|
||||
ADD_EXECUTABLE(easyChams MACOSX_BUNDLE ${MOC_EASYCHAMS} ${CPP_FILES})
|
||||
ELSE(APPLE)
|
||||
ADD_EXECUTABLE(easyChams ${MOC_EASYCHAMS} ${CPP_FILES})
|
||||
ENDIF(APPLE)
|
||||
|
||||
TARGET_LINK_LIBRARIES(easyChams ${QT_LIBRARIES})
|
||||
INSTALL(TARGETS easyChams DESTINATION /)
|
|
@ -1,266 +0,0 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPushButton>
|
||||
#include <QGroupBox>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QProgressBar>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QByteArray>
|
||||
#include <QTextEdit>
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
#include <QStringList>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "CompilationWidget.h"
|
||||
#include "CompileHighlighter.h"
|
||||
#include "ConfigDialog.h"
|
||||
|
||||
CompilationWidget::CompilationWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, _cProgram ("")
|
||||
, _sourceRD ("")
|
||||
, _hasHurricane (false)
|
||||
, _hasIo (false)
|
||||
, _hasTest (false)
|
||||
, _hasCrlcore (false)
|
||||
, _hasChams (false)
|
||||
, _hasHurricaneAMS (false) {
|
||||
|
||||
setStyleSheet("font-weight: normal;");
|
||||
|
||||
_hurricane = new QCheckBox ( "hurricane" , this );
|
||||
_io = new QCheckBox ( "io" , this );
|
||||
_test = new QCheckBox ( "test" , this );
|
||||
_crlcore = new QCheckBox ( "crlcore" , this );
|
||||
_chams = new QCheckBox ( "chams" , this );
|
||||
_hurricaneAMS = new QCheckBox ( "hurricaneAMS", this );
|
||||
|
||||
readSettings();
|
||||
|
||||
QVBoxLayout* vBoxOutilsGroup = new QVBoxLayout();
|
||||
vBoxOutilsGroup->addWidget(_hurricane);
|
||||
vBoxOutilsGroup->addWidget(_io);
|
||||
vBoxOutilsGroup->addWidget(_test);
|
||||
vBoxOutilsGroup->addWidget(_crlcore);
|
||||
vBoxOutilsGroup->addWidget(_chams);
|
||||
vBoxOutilsGroup->addWidget(_hurricaneAMS);
|
||||
if (!_hasHurricane) _hurricane->setVisible(false);
|
||||
if (!_hasIo) _io->setVisible(false);
|
||||
if (!_hasTest) _test->setVisible(false);
|
||||
if (!_hasCrlcore) _crlcore->setVisible(false);
|
||||
if (!_hasChams) _chams->setVisible(false);
|
||||
if (!_hasHurricaneAMS) _hurricaneAMS->setVisible(false);
|
||||
|
||||
QGroupBox* outilsGroup = new QGroupBox ( "Outils", this );
|
||||
outilsGroup->setLayout(vBoxOutilsGroup);
|
||||
|
||||
_mode = new QComboBox (this);
|
||||
QStringList modes;
|
||||
modes << "Release" << "Debug";
|
||||
_mode->addItems(modes);
|
||||
_static = new QCheckBox ("static", this);
|
||||
_svnUp = new QCheckBox ("svn update", this);
|
||||
_doc = new QCheckBox ("build doc", this);
|
||||
_clean = new QCheckBox ("clean build", this);
|
||||
|
||||
QVBoxLayout* vBoxOptionsGroup = new QVBoxLayout();
|
||||
vBoxOptionsGroup->addWidget(_mode);
|
||||
vBoxOptionsGroup->addWidget(_static);
|
||||
vBoxOptionsGroup->addWidget(_doc);
|
||||
vBoxOptionsGroup->addWidget(_svnUp);
|
||||
vBoxOptionsGroup->addWidget(_clean);
|
||||
|
||||
QGroupBox* optionsGroup = new QGroupBox ( "Options", this );
|
||||
optionsGroup->setLayout(vBoxOptionsGroup);
|
||||
|
||||
_compile = new QPushButton ( "Compile !", this );
|
||||
connect ( _compile, SIGNAL(clicked()), this, SLOT(compile()) );
|
||||
|
||||
_progressBar = new QProgressBar ( this );
|
||||
_progressBar->setRange(0,100);
|
||||
_progressBar->setTextVisible(true);
|
||||
connect ( this, SIGNAL(progress(int)), _progressBar, SLOT(setValue(int)) );
|
||||
|
||||
QVBoxLayout* vBoxLayout = new QVBoxLayout();
|
||||
vBoxLayout->addWidget(outilsGroup);
|
||||
vBoxLayout->addWidget(optionsGroup);
|
||||
vBoxLayout->addWidget(_compile);
|
||||
vBoxLayout->addWidget(_progressBar);
|
||||
|
||||
QWidget* menu = new QWidget ( this );
|
||||
menu->setLayout(vBoxLayout);
|
||||
|
||||
_console = new QTextEdit(this);
|
||||
_console->setFixedSize(800,400);
|
||||
CompileHighlighter* highlight = new CompileHighlighter(_console->document());
|
||||
|
||||
QHBoxLayout* hBoxLayout = new QHBoxLayout();
|
||||
hBoxLayout->addWidget(menu);
|
||||
hBoxLayout->addWidget(_console);
|
||||
setLayout(hBoxLayout);
|
||||
setWindowTitle("Easy compile for chams");
|
||||
|
||||
}
|
||||
|
||||
void CompilationWidget::compile() {
|
||||
QStringList arguments;
|
||||
|
||||
_progressBar->reset();
|
||||
_console->clear();
|
||||
|
||||
_myProcess = new QProcess(this);
|
||||
QStringList env = QProcess::systemEnvironment();
|
||||
//QString currentInstallRD = _installRD;
|
||||
//if (_static->isChecked()) currentInstallRD += "/"+_mode->currentText()+".Static";
|
||||
//else currentInstallRD += "/"+_mode->currentText()+".Shared";
|
||||
//cerr << _installRD.toStdString() << endl;
|
||||
//env << "HURRICANE_TOP=" + currentInstallRD;
|
||||
//env << "CHAMS_TOP=" + currentInstallRD;
|
||||
//env << "IO_TOP=" + currentInstallRD;
|
||||
//env << "DYLD_LIBRARY_PATH=" + currentInstallRD + "/lib";
|
||||
//_myProcess->setEnvironment(env);
|
||||
connect(_myProcess, SIGNAL(readyReadStandardError()) , this, SLOT(updateError()));
|
||||
connect(_myProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(updateText()));
|
||||
connect(_myProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(updateExit(int, QProcess::ExitStatus)));
|
||||
//arguments << "-s " + _sourceRD;
|
||||
//arguments << "-i " + currentInstallRD;
|
||||
//arguments << "-b " + _buildRD;
|
||||
arguments << "-p" + _sourceRD;
|
||||
arguments << "-m" + _mode->currentText();
|
||||
if (_static->isChecked()) arguments << "-s";
|
||||
if (_svnUp->isChecked()) arguments << "-u";
|
||||
if (_doc->isChecked()) arguments << "-d";
|
||||
if (_clean->isChecked()) arguments << "-c";
|
||||
if (_hurricane->isChecked()) arguments << "-t hurricane";
|
||||
if (_io->isChecked()) arguments << "-t io";
|
||||
if (_test->isChecked()) arguments << "-t test";
|
||||
if (_crlcore->isChecked()) arguments << "-t crlcore";
|
||||
if (_chams->isChecked()) arguments << "-t chams";
|
||||
if (_hurricaneAMS->isChecked()) arguments << "-t hurricaneAMS";
|
||||
|
||||
//for (int i = 0; i < arguments.size(); ++i)
|
||||
// cout << arguments.at(i).toLocal8Bit().constData() << endl;
|
||||
|
||||
_myProcess->start(_cProgram, arguments);
|
||||
}
|
||||
|
||||
void CompilationWidget::readSettings() {
|
||||
_settings = new QSettings ( "chams", "easyChams" );
|
||||
|
||||
if ( !_settings->contains("Compilation program") ) {
|
||||
QMessageBox::warning(this, tr("easyChams"), tr("It seems you do not have configured the application. Let's configure it now."), QMessageBox::Ok, QMessageBox::Ok);
|
||||
runConfigDialog(true);
|
||||
}
|
||||
else {
|
||||
_cProgram = _settings->value("Compilation program").toString();
|
||||
_sourceRD = _settings->value("Source root").toString();
|
||||
_hasHurricane = _settings->value("Hurricane").toBool();
|
||||
_hasIo = _settings->value("Io").toBool();
|
||||
_hasTest = _settings->value("Test").toBool();
|
||||
_hasCrlcore = _settings->value("Crlcore").toBool();
|
||||
_hasChams = _settings->value("Chams").toBool();
|
||||
_hasHurricaneAMS = _settings->value("HurricaneAMS").toBool();
|
||||
}
|
||||
}
|
||||
|
||||
void CompilationWidget::runConfigDialog(bool first) {
|
||||
ConfigDialog* cfg = new ConfigDialog;
|
||||
connect ( cfg, SIGNAL(configDone(QStringList)), this, SLOT(updateConfig(QStringList)) );
|
||||
if (!first) {
|
||||
cfg->setCompileProgram(_cProgram);
|
||||
cfg->setSourceRootDirectory(_sourceRD);
|
||||
cfg->setHasHurricane(_hasHurricane);
|
||||
cfg->setHasIo(_hasIo);
|
||||
cfg->setHasTest(_hasTest);
|
||||
cfg->setHasCrlcore(_hasCrlcore);
|
||||
cfg->setHasChams(_hasChams);
|
||||
cfg->setHasHurricaneAMS(_hasHurricaneAMS);
|
||||
}
|
||||
cfg->exec();
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
void CompilationWidget::reconfig() {
|
||||
runConfigDialog(false);
|
||||
}
|
||||
|
||||
void CompilationWidget::writeSettings() {
|
||||
_settings->setValue("Compilation program", _cProgram);
|
||||
_settings->setValue("Source root" , _sourceRD);
|
||||
_settings->setValue("Hurricane" , _hasHurricane);
|
||||
_settings->setValue("Io" , _hasIo);
|
||||
_settings->setValue("Test" , _hasTest);
|
||||
_settings->setValue("Crlcore" , _hasCrlcore);
|
||||
_settings->setValue("Chams" , _hasChams);
|
||||
_settings->setValue("HurricaneAMS" , _hasHurricaneAMS);
|
||||
}
|
||||
|
||||
void CompilationWidget::updateConfig(QStringList list) {
|
||||
_cProgram = list.value(0); // First value is compilation program
|
||||
_sourceRD = list.value(1); // Second value is source root directory
|
||||
_hasHurricane = (list.value(2) == "ON") ? true : false; // Third value is hasHurricane
|
||||
_hasIo = (list.value(3) == "ON") ? true : false; // Forth value is hasIo
|
||||
_hasTest = (list.value(4) == "ON") ? true : false; // Fifth value is hasTest
|
||||
_hasCrlcore = (list.value(5) == "ON") ? true : false; // Sixth value is hasCrlcore
|
||||
_hasChams = (list.value(6) == "ON") ? true : false; // Seventh value is hasChams
|
||||
_hasHurricaneAMS = (list.value(7) == "ON") ? true : false; // Eight value is hasHurricaneAMS
|
||||
// updates Tools visibility :
|
||||
if (_hasHurricane) { _hurricane->setVisible(true); }
|
||||
else { _hurricane->setVisible(false); _hurricane->setCheckState(Qt::Unchecked); }
|
||||
if (_hasIo) { _io->setVisible(true); }
|
||||
else { _io->setVisible(false); _io->setCheckState(Qt::Unchecked); }
|
||||
if (_hasTest) { _test->setVisible(true); }
|
||||
else { _test->setVisible(false); _test->setCheckState(Qt::Unchecked); }
|
||||
if (_hasCrlcore) { _crlcore->setVisible(true); }
|
||||
else { _crlcore->setVisible(false); _crlcore->setCheckState(Qt::Unchecked); }
|
||||
if (_hasChams) { _chams->setVisible(true); }
|
||||
else { _chams->setVisible(false); _chams->setCheckState(Qt::Unchecked); }
|
||||
if (_hasHurricaneAMS) { _hurricaneAMS->setVisible(true); }
|
||||
else { _hurricaneAMS->setVisible(false); _hurricaneAMS->setCheckState(Qt::Unchecked); }
|
||||
}
|
||||
|
||||
|
||||
void CompilationWidget::updateError() {
|
||||
QByteArray data = _myProcess->readAllStandardError();
|
||||
_console->insertPlainText(QString::fromUtf8(data.constData()));
|
||||
int end = _console->verticalScrollBar()->maximum();
|
||||
_console->verticalScrollBar()->setValue(end);
|
||||
}
|
||||
|
||||
void CompilationWidget::updateText() {
|
||||
QByteArray data = _myProcess->readAllStandardOutput();
|
||||
QString str = QString::fromUtf8(data.constData());
|
||||
QRegExp rx = QRegExp ( "([0-9]+)%" );
|
||||
if ( str.contains(rx) ) {
|
||||
bool ok;
|
||||
int value = rx.cap(1).toInt ( &ok, 10 );
|
||||
emit(progress(value));
|
||||
}
|
||||
_console->insertPlainText(QString(data));
|
||||
int end = _console->verticalScrollBar()->maximum();
|
||||
_console->verticalScrollBar()->setValue(end);
|
||||
}
|
||||
|
||||
void CompilationWidget::updateExit(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
if (exitStatus == QProcess::NormalExit) {
|
||||
_console->append("Completed Successfully");
|
||||
}
|
||||
else {
|
||||
_console->append("Error");
|
||||
}
|
||||
}
|
||||
|
||||
void CompilationWidget::about()
|
||||
{
|
||||
QMessageBox::about(this, tr("About easyChams"), tr("<p><h1 align=\"center\">easyChams</h1></p>"
|
||||
"<p>This tool allows every one to easily update and compile chams project's sources.</p>"
|
||||
"<p align=\"center\">Version 0.6<br>29/01/2010<br>by <b>D.Dupuis</b></p>"));
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
#ifndef __COMPILATION_WIDGET_H
|
||||
#define __COMPILATION_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QProcess>
|
||||
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class QTextEdit;
|
||||
class QPushButton;
|
||||
class QProgressBar;
|
||||
class QSettings;
|
||||
class QStringList;
|
||||
class QAction;
|
||||
|
||||
class CompilationWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CompilationWidget (QWidget *parent =0);
|
||||
~CompilationWidget () {};
|
||||
|
||||
private:
|
||||
QCheckBox* _hurricane;
|
||||
QCheckBox* _io;
|
||||
QCheckBox* _test;
|
||||
QCheckBox* _crlcore;
|
||||
QCheckBox* _chams;
|
||||
QCheckBox* _hurricaneAMS;
|
||||
QComboBox* _mode;
|
||||
QCheckBox* _static;
|
||||
QCheckBox* _svnUp;
|
||||
QCheckBox* _doc;
|
||||
QCheckBox* _clean;
|
||||
QPushButton* _compile;
|
||||
QProgressBar* _progressBar;
|
||||
|
||||
QTextEdit* _console;
|
||||
QProcess* _myProcess;
|
||||
|
||||
QSettings* _settings;
|
||||
QString _cProgram;
|
||||
QString _sourceRD;
|
||||
bool _hasHurricane;
|
||||
bool _hasIo;
|
||||
bool _hasTest;
|
||||
bool _hasCrlcore;
|
||||
bool _hasChams;
|
||||
bool _hasHurricaneAMS;
|
||||
|
||||
private:
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
void runConfigDialog(bool first);
|
||||
|
||||
public slots:
|
||||
void compile();
|
||||
void updateError();
|
||||
void updateText();
|
||||
void updateExit(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void updateConfig(QStringList list);
|
||||
void reconfig();
|
||||
void about();
|
||||
|
||||
signals:
|
||||
void progress(int value);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,70 +0,0 @@
|
|||
// File : CompileHighlighter.cpp
|
||||
// Date : 01.10.2009
|
||||
// Author : Dupuis Damien
|
||||
//
|
||||
|
||||
#include "CompileHighlighter.h"
|
||||
|
||||
CompileHighlighter::CompileHighlighter(QTextDocument *parent) : QSyntaxHighlighter(parent) {
|
||||
// defines rules
|
||||
CompileHighlighterRule rule;
|
||||
|
||||
//building/linking/scanning rule : blue Bold
|
||||
_doingFormat.setForeground(Qt::blue);
|
||||
_doingFormat.setFontWeight(QFont::Bold);
|
||||
rule.format = _doingFormat;
|
||||
rule.pattern = QRegExp("(^Building.*$|^Linking.*$|^Scanning.*$|^Built target.*$)");
|
||||
_rules.append(rule);
|
||||
|
||||
//compile rule : darkBlue Normal
|
||||
_compileFormat.setForeground(Qt::darkBlue);
|
||||
rule.format = _compileFormat;
|
||||
rule.pattern = QRegExp("(^\\[.*$)");
|
||||
_rules.append(rule);
|
||||
|
||||
//install rule : cyan Bold
|
||||
_installFormat.setForeground(Qt::cyan);
|
||||
_installFormat.setFontWeight(QFont::Bold);
|
||||
rule.format = _installFormat;
|
||||
rule.pattern = QRegExp("(^Install the project.*$)");
|
||||
_rules.append(rule);
|
||||
|
||||
//--install rule : darkCyan
|
||||
_installingFormat.setForeground(Qt::darkCyan);
|
||||
rule.format = _installingFormat;
|
||||
rule.pattern = QRegExp("(^-- Install.*$)");
|
||||
_rules.append(rule);
|
||||
|
||||
//--uptodate : darkCyan Italic
|
||||
_uptodateFormat.setForeground(Qt::darkCyan);
|
||||
_uptodateFormat.setFontItalic(true);
|
||||
rule.format = _uptodateFormat;
|
||||
rule.pattern = QRegExp("(^-- Up-to-date.*$)");
|
||||
_rules.append(rule);
|
||||
|
||||
//warning rule
|
||||
_warningFormat.setForeground(QColor("orange"));
|
||||
rule.format = _warningFormat;
|
||||
rule.pattern = QRegExp("(^/.*In function.*$|^/.*warning:.*$)");
|
||||
_rules.append(rule);
|
||||
|
||||
//error rule
|
||||
_errorFormat.setForeground(Qt::red);
|
||||
rule.format = _errorFormat;
|
||||
rule.pattern = QRegExp("(^/.*error:.*$|^make\\[.*$)");
|
||||
_rules.append(rule);
|
||||
}
|
||||
|
||||
void CompileHighlighter::highlightBlock(const QString &text) {
|
||||
foreach (const CompileHighlighterRule &rule, _rules) {
|
||||
QRegExp expression (rule.pattern);
|
||||
int index = expression.indexIn(text);
|
||||
while (index >= 0) {
|
||||
int length = expression.matchedLength();
|
||||
setFormat(index, length, rule.format);
|
||||
index = expression.indexIn(text, index + length);
|
||||
}
|
||||
}
|
||||
setCurrentBlockState(0);
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
// File : CompileHighlighter.h
|
||||
// Date : 01.10.2009
|
||||
// Author : Dupuis Damien
|
||||
//
|
||||
#ifndef COMPILEHIGHLIGHTER_H
|
||||
#define COMPILEHIGHLIGHTER_H
|
||||
|
||||
#include <QSyntaxHighlighter>
|
||||
#include <QTextCharFormat>
|
||||
#include <QTextDocument>
|
||||
|
||||
class CompileHighlighter : public QSyntaxHighlighter {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CompileHighlighter ( QTextDocument *parent = 0 );
|
||||
|
||||
protected:
|
||||
void highlightBlock ( const QString &text );
|
||||
|
||||
private:
|
||||
struct CompileHighlighterRule {
|
||||
QTextCharFormat format;
|
||||
QRegExp pattern;
|
||||
};
|
||||
QVector<CompileHighlighterRule> _rules;
|
||||
|
||||
QTextCharFormat _compileFormat;
|
||||
QTextCharFormat _warningFormat;
|
||||
QTextCharFormat _errorFormat;
|
||||
QTextCharFormat _installFormat;
|
||||
QTextCharFormat _installingFormat;
|
||||
QTextCharFormat _uptodateFormat;
|
||||
QTextCharFormat _doingFormat;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -1,83 +0,0 @@
|
|||
#include <QGridLayout>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QFileDialog>
|
||||
#include <QGroupBox>
|
||||
|
||||
#include "ConfigDialog.h"
|
||||
|
||||
#define LINEEDITWIDTH 300
|
||||
|
||||
ConfigDialog::ConfigDialog() {
|
||||
// First GroupBox : Directories
|
||||
// Create Widgets
|
||||
QLabel* compileL = new QLabel(tr("Compilation script:"), this);
|
||||
QLabel* sourceL = new QLabel(tr("Chams source root directory:"), this);
|
||||
_compileE = new QLineEdit ("", this);
|
||||
_sourceE = new QLineEdit ("", this);
|
||||
_compileE->setFixedWidth(LINEEDITWIDTH);
|
||||
_sourceE->setFixedWidth (LINEEDITWIDTH);
|
||||
QPushButton* compileB = new QPushButton(tr("&Browse"));
|
||||
QPushButton* sourceB = new QPushButton(tr("&Browse"));
|
||||
QDialogButtonBox* bBox = new QDialogButtonBox(QDialogButtonBox::Ok);
|
||||
// Connect SIGNAL/SLOTS
|
||||
connect(compileB, SIGNAL(clicked()) , this, SLOT(chooseCProgram()));
|
||||
connect(sourceB , SIGNAL(clicked()) , this, SLOT(chooseSourceRD()));
|
||||
connect(bBox , SIGNAL(accepted()), this, SLOT(doConfig()));
|
||||
// Create GroupBox
|
||||
QGroupBox* directories = new QGroupBox("Directories", this);
|
||||
QGridLayout* gLayout = new QGridLayout(this);
|
||||
gLayout->addWidget( compileL, 0, 0, 1, 1);
|
||||
gLayout->addWidget(_compileE, 0, 1, 1, 2);
|
||||
gLayout->addWidget( compileB, 0, 3, 1, 1);
|
||||
gLayout->addWidget( sourceL , 1, 0, 1, 1);
|
||||
gLayout->addWidget(_sourceE , 1, 1, 1, 2);
|
||||
gLayout->addWidget( sourceB , 1, 3, 1, 1);
|
||||
directories->setLayout(gLayout);
|
||||
// Second GroupBox : Tools
|
||||
// Create Widgets
|
||||
_hurCB = new QCheckBox("Hurricane" , this);
|
||||
_ioCB = new QCheckBox("Io" , this);
|
||||
_testCB = new QCheckBox("Test (not in svn)", this);
|
||||
_crlCB = new QCheckBox("Crlcore" , this);
|
||||
_chamsCB = new QCheckBox("Chams" , this);
|
||||
_hurAMSCB = new QCheckBox("HurricaneAMS" , this);
|
||||
// Create GroupBox
|
||||
QGroupBox* tools = new QGroupBox("Available Tools", this);
|
||||
QGridLayout* grLayout = new QGridLayout(this);
|
||||
grLayout->addWidget(_hurCB , 0, 0, 1, 1);
|
||||
grLayout->addWidget(_ioCB , 1, 0, 1, 1);
|
||||
grLayout->addWidget(_testCB , 2, 0, 1, 1);
|
||||
grLayout->addWidget(_crlCB , 0, 1, 1, 1);
|
||||
grLayout->addWidget(_chamsCB , 1, 1, 1, 1);
|
||||
grLayout->addWidget(_hurAMSCB, 2, 1, 1, 1);
|
||||
tools->setLayout(grLayout);
|
||||
// ConfigDialog Layout
|
||||
QVBoxLayout* vLayout = new QVBoxLayout;
|
||||
vLayout->addWidget(directories);
|
||||
vLayout->addWidget(tools);
|
||||
vLayout->addWidget(bBox);
|
||||
setLayout(vLayout);
|
||||
}
|
||||
|
||||
void ConfigDialog::chooseCProgram() {
|
||||
_compileE->setText(QFileDialog::getOpenFileName(this, tr("Select chams.sh"), "", tr("Shell script (*.sh)")));
|
||||
}
|
||||
|
||||
void ConfigDialog::chooseSourceRD() {
|
||||
_sourceE->setText(QFileDialog::getExistingDirectory(this, tr("Select the chams source root directory")));
|
||||
}
|
||||
|
||||
void ConfigDialog::doConfig() {
|
||||
QStringList list;
|
||||
QString hur = (_hurCB->isChecked()) ? "ON" : "OFF";
|
||||
QString io = (_ioCB->isChecked()) ? "ON" : "OFF";
|
||||
QString test = (_testCB->isChecked()) ? "ON" : "OFF";
|
||||
QString crl = (_crlCB->isChecked()) ? "ON" : "OFF";
|
||||
QString chams = (_chamsCB->isChecked()) ? "ON" : "OFF";
|
||||
QString hurAMS = (_hurAMSCB->isChecked()) ? "ON" : "OFF";
|
||||
list << _compileE->text() << _sourceE->text() << hur << io << test << crl << chams << hurAMS;
|
||||
emit configDone(list);
|
||||
accept();
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
#ifndef CONFIGDIALOG_H
|
||||
#define CONFIGDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLineEdit>
|
||||
#include <QCheckBox>
|
||||
|
||||
class QLabel;
|
||||
class QStringList;
|
||||
|
||||
class ConfigDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConfigDialog();
|
||||
inline void setCompileProgram(QString);
|
||||
inline void setSourceRootDirectory(QString);
|
||||
inline void setHasHurricane(bool);
|
||||
inline void setHasIo(bool);
|
||||
inline void setHasTest(bool);
|
||||
inline void setHasCrlcore(bool);
|
||||
inline void setHasChams(bool);
|
||||
inline void setHasHurricaneAMS(bool);
|
||||
|
||||
public slots:
|
||||
void chooseCProgram();
|
||||
void chooseSourceRD();
|
||||
void doConfig();
|
||||
|
||||
signals:
|
||||
void configDone (QStringList list);
|
||||
|
||||
private:
|
||||
QLineEdit* _compileE;
|
||||
QLineEdit* _sourceE;
|
||||
QCheckBox* _hurCB;
|
||||
QCheckBox* _ioCB;
|
||||
QCheckBox* _testCB;
|
||||
QCheckBox* _crlCB;
|
||||
QCheckBox* _chamsCB;
|
||||
QCheckBox* _hurAMSCB;
|
||||
};
|
||||
|
||||
inline void ConfigDialog::setCompileProgram (QString cProgram ) { _compileE->setText(cProgram); };
|
||||
inline void ConfigDialog::setSourceRootDirectory (QString rDirectory) { _sourceE->setText(rDirectory); };
|
||||
|
||||
inline void ConfigDialog::setHasHurricane(bool state) {
|
||||
if (state)
|
||||
_hurCB->setCheckState(Qt::Checked);
|
||||
else
|
||||
_hurCB->setCheckState(Qt::Unchecked);
|
||||
};
|
||||
|
||||
inline void ConfigDialog::setHasIo(bool state) {
|
||||
if (state)
|
||||
_ioCB->setCheckState(Qt::Checked);
|
||||
else
|
||||
_ioCB->setCheckState(Qt::Unchecked);
|
||||
};
|
||||
|
||||
inline void ConfigDialog::setHasTest(bool state) {
|
||||
if (state)
|
||||
_testCB->setCheckState(Qt::Checked);
|
||||
else
|
||||
_testCB->setCheckState(Qt::Unchecked);
|
||||
};
|
||||
|
||||
inline void ConfigDialog::setHasCrlcore(bool state) {
|
||||
if (state)
|
||||
_crlCB->setCheckState(Qt::Checked);
|
||||
else
|
||||
_crlCB->setCheckState(Qt::Unchecked);
|
||||
};
|
||||
|
||||
inline void ConfigDialog::setHasChams(bool state) {
|
||||
if (state)
|
||||
_chamsCB->setCheckState(Qt::Checked);
|
||||
else
|
||||
_chamsCB->setCheckState(Qt::Unchecked);
|
||||
};
|
||||
|
||||
inline void ConfigDialog::setHasHurricaneAMS(bool state) {
|
||||
if (state)
|
||||
_hurAMSCB->setCheckState(Qt::Checked);
|
||||
else
|
||||
_hurAMSCB->setCheckState(Qt::Unchecked);
|
||||
};
|
||||
#endif
|
|
@ -1,22 +0,0 @@
|
|||
#include<QMenu>
|
||||
#include<QMenuBar>
|
||||
#include<QAction>
|
||||
|
||||
#include "MainWindow.h"
|
||||
|
||||
MainWindow::MainWindow()
|
||||
{
|
||||
CompilationWidget* cWidget = new CompilationWidget(this);
|
||||
setCentralWidget(cWidget);
|
||||
|
||||
QAction* configAct = new QAction(tr("&Configure"), this);
|
||||
configAct->setStatusTip(tr("Configure the application"));
|
||||
connect(configAct, SIGNAL(triggered()), cWidget, SLOT(reconfig()));
|
||||
QAction* aboutAct = new QAction(tr("&About"), this);
|
||||
aboutAct->setStatusTip(tr("Show the about dialog box"));
|
||||
connect(aboutAct, SIGNAL(triggered()), cWidget, SLOT(about()));
|
||||
QMenu* editMenu = menuBar()->addMenu(tr("&Edit"));
|
||||
editMenu->addAction(configAct);
|
||||
QMenu* helpMenu = menuBar()->addMenu(tr("&Help"));
|
||||
helpMenu->addAction(aboutAct);
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef __MAINWINDOW_H
|
||||
#define __MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "CompilationWidget.h"
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow ();
|
||||
~MainWindow () {};
|
||||
};
|
||||
#endif
|
|
@ -1,5 +0,0 @@
|
|||
easyChams readme
|
||||
|
||||
This tool allows every one to easily compile & install chams project's sources.
|
||||
|
||||
To compile this tool use ./compile.sh which is platform independant.
|
|
@ -1,14 +0,0 @@
|
|||
#!/bin/bash
|
||||
ARCH=`uname -m`
|
||||
|
||||
if [ ! -e "./compile.sh" ]; then
|
||||
echo "You must run compile.sh in its own direcotry : ./compile.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$ARCH/build" ]; then
|
||||
echo "Creating build directory"
|
||||
mkdir -p $ARCH/build
|
||||
fi
|
||||
|
||||
cd $ARCH/build && cmake ../.. && make DESTDIR=.. -j2 install
|
Binary file not shown.
Before Width: | Height: | Size: 29 KiB |
Binary file not shown.
|
@ -1,16 +0,0 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include <QApplication>
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
#include "MainWindow.h"
|
||||
|
||||
int main ( int argc, char **argv ) {
|
||||
QApplication app ( argc, argv );
|
||||
|
||||
MainWindow mWindow;
|
||||
mWindow.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
#!/bin/sh
|
||||
VERSION="0.5"
|
||||
DATE="25/01/2010"
|
||||
version() {
|
||||
echo "$O version $VERSION - $DATE - by D.Dupuis"
|
||||
echo ""
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "Usage $0 -s sourceRD -i installRD -b buildRD -t tool [-druc]"
|
||||
echo ""
|
||||
echo " Mandatory arguments:"
|
||||
echo " -p path : path to chams root directory"
|
||||
echo " -t tool : specify which tool to compile (there may be several -t arguments"
|
||||
echo " -m mode : specify build mode (Release or Debug)"
|
||||
echo ""
|
||||
echo " Optionnal arguments:"
|
||||
echo " -s : enable static build"
|
||||
echo " -d : generate documentation (if available)"
|
||||
echo " -u : run svn update before compilation"
|
||||
echo " -c : clean build before compilation"
|
||||
echo ""
|
||||
exit 1
|
||||
}
|
||||
|
||||
resume() {
|
||||
echo ""
|
||||
echo "Source directory : $SOURCE"
|
||||
echo "Install directory : $INSTALL"
|
||||
echo "Builb directory : $BUILD"
|
||||
echo "Tools : $TOOLS"
|
||||
echo "Generate doc : $DOC"
|
||||
echo "Svn update : $SVNUP"
|
||||
echo ""
|
||||
}
|
||||
|
||||
guessOs ()
|
||||
{
|
||||
case "`uname -srm`" in
|
||||
Linux*el5*x86_64) OSTYPE="Linux.SLSoC5x_64";;
|
||||
Linux*el5*) OSTYPE="Linux.SLSoC5x";;
|
||||
Linux*2.6.23.13*SoC*) OSTYPE="Linux.SLSoC5x";;
|
||||
Linux*EL*x86_64*) OSTYPE="Linux.SLA4x_64";;
|
||||
Linux*SLA*) OSTYPE="Linux.SLA4x";;
|
||||
Linux*EL*i686*) OSTYPE="Linux.SLA4x";;
|
||||
Linux*FC2*) OSTYPE="Linux.FC2";;
|
||||
Linux*i686*) OSTYPE="Linux.i686";;
|
||||
SunOS\ 5*) OSTYPE="Solaris";;
|
||||
Darwin*) OSTYPE="Darwin";;
|
||||
*) OSTYPE="`uname -sr`";;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
prepareEnv() {
|
||||
guessOs
|
||||
if [ ! -d "$SOURCE" ]
|
||||
then
|
||||
echo "Specified root path does not exist"
|
||||
exit 1
|
||||
fi
|
||||
ROOT="$SOURCE/$OSTYPE/$MODE.$LIBMODE"
|
||||
INSTALL="$ROOT/install"
|
||||
BUILD="$ROOT/build"
|
||||
export HURRICANE_TOP="$INSTALL"
|
||||
export IO_TOP="$INSTALL"
|
||||
export CHAMS_TOP="$INSTALL"
|
||||
export DYLD_LIBRARY_PATH="$INSTALL/lib"
|
||||
}
|
||||
|
||||
compile() {
|
||||
prepareEnv
|
||||
for TOOL in $TOOLS
|
||||
do
|
||||
if [ $SVNUP -eq 1 ]
|
||||
then
|
||||
cd "$SOURCE/$TOOL"
|
||||
if [ `svn status -u | grep "^M.*\*" | wc -l` -gt 0 ]
|
||||
then
|
||||
echo "THERE MIGHT BE CONFLICTS WHILE SVN UPDATING"
|
||||
echo " -> Please update manually"
|
||||
exit 1
|
||||
fi
|
||||
#svn update --accept postpone # par defaut on prendra la decision en cas de conflits plus tard (au cas ou le status n'est pas suffisant)
|
||||
svn update # par defaut on prendra la decision en cas de conflits plus tard (au cas ou le status n'est pas suffisant)
|
||||
fi
|
||||
if [ ! -d "$BUILD/$TOOL" ]
|
||||
then
|
||||
echo "$BUILD/$TOOL does not exist: create it now !"
|
||||
mkdir -p "$BUILD/$TOOL"
|
||||
fi
|
||||
cd "$BUILD/$TOOL"
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "Cannot find build directory"
|
||||
exit 1
|
||||
fi
|
||||
if [ $CLEAN -eq 1 ]
|
||||
then
|
||||
make clean
|
||||
rm -rf CMakeCache.txt CMakeFiles Makefile cmake_install.cmake install_manifest.txt
|
||||
fi
|
||||
echo "#### Now compiling $TOOL ####"
|
||||
echo ""
|
||||
cmake -D "CMAKE_BUILD_TYPE:STRING=$MODE" -D "BUILD_DOC:STRING=$DOC" -D "BUILD_SHARED_LIBS:STRING=$SHARED" $SOURCE/$TOOL
|
||||
make "DESTDIR=$INSTALL" -j8 install
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
done
|
||||
}
|
||||
|
||||
SOURCE=""
|
||||
INSTALL=""
|
||||
BUILD=""
|
||||
TOOLS=""
|
||||
OSTYPE=""
|
||||
MODE=""
|
||||
LIBMODE="Shared"
|
||||
SHARED="ON"
|
||||
DOC="OFF"
|
||||
SVNUP=0
|
||||
CLEAN=0
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while getopts :p:t:m:sduc option
|
||||
do
|
||||
case "${option}"
|
||||
in
|
||||
p) SOURCE=${OPTARG};;
|
||||
t) TOOL=${OPTARG}
|
||||
TOOLS="$TOOLS $TOOL";;
|
||||
m) MODE=${OPTARG};;
|
||||
s) SHARED="OFF"
|
||||
LIBMODE="Static";;
|
||||
d) DOC="ON";;
|
||||
u) SVNUP=1;;
|
||||
c) CLEAN=1;;
|
||||
*) version
|
||||
usage;;
|
||||
esac
|
||||
done
|
||||
shift "$(( $OPTIND - 1 ))"
|
||||
|
||||
#resume
|
||||
version
|
||||
compile
|
|
@ -1,21 +0,0 @@
|
|||
## VERSION 1.0 --- 19 février 2010
|
||||
- First releasable version tested on Mac Os and Linux
|
||||
|
||||
## VERSION 0.6 --- 19 février 2010
|
||||
- Adds settings support to configure the application.
|
||||
|
||||
## VERSION 0.5 --- 16 février 2010
|
||||
- Adds compile.sh script to easily compile the application.
|
||||
The script uses cmake and can be run under Mac / Linux.
|
||||
|
||||
## VERSION 0.4
|
||||
- Adds support for several technologies.
|
||||
|
||||
## VERSION 0.3 --- novembre 2010
|
||||
- Can Show / Hide console.
|
||||
|
||||
## VERSION 0.2
|
||||
- Adds a text console to catch all output from Pharos.
|
||||
|
||||
## VERSION 0.1
|
||||
- First version : can run Pharos.
|
|
@ -1,22 +0,0 @@
|
|||
PROJECT(RUNPHAROS)
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0)
|
||||
|
||||
SET(CMAKE_BUILD_TYPE release)
|
||||
|
||||
FIND_PACKAGE(Qt4 REQUIRED)
|
||||
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
|
||||
SET(CPP_FILES main.cpp MainWindow.cpp MyWidget.cpp ConfigDialog.cpp TechnoRow.cpp)
|
||||
|
||||
QT4_WRAP_CPP(MOC_RUNPHAROS MainWindow.h MyWidget.h ConfigDialog.h TechnoRow.h)
|
||||
|
||||
IF(APPLE)
|
||||
ADD_EXECUTABLE(runPharos MACOSX_BUNDLE ${MOC_RUNPHAROS} ${CPP_FILES})
|
||||
ELSE(APPLE)
|
||||
ADD_EXECUTABLE(runPharos ${MOC_RUNPHAROS} ${CPP_FILES})
|
||||
ENDIF(APPLE)
|
||||
|
||||
TARGET_LINK_LIBRARIES(runPharos ${QT_LIBRARIES})
|
||||
INSTALL(TARGETS runPharos DESTINATION /)
|
|
@ -1,152 +0,0 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QFileDialog>
|
||||
#include <QGroupBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "ConfigDialog.h"
|
||||
#include "TechnoRow.h"
|
||||
|
||||
#define LINEEDITWIDTH 300
|
||||
|
||||
int ConfigDialog::_rowID = 0;
|
||||
|
||||
ConfigDialog::ConfigDialog() {
|
||||
setStyleSheet("font-weight: normal;");
|
||||
// First GroupBox : Directories
|
||||
// Create widgets
|
||||
QLabel* programL = new QLabel(tr("Pharos binary") , this);
|
||||
QLabel* libraryL = new QLabel(tr("LD_LIBRARY_PATH") , this);
|
||||
_programE = new QLineEdit ("", this);
|
||||
_libraryE = new QLineEdit ("", this);
|
||||
_programE->setFixedWidth(LINEEDITWIDTH);
|
||||
_libraryE->setFixedWidth(LINEEDITWIDTH);
|
||||
_programE->setToolTip(tr("Select <b>Pharos</b> binary file."));
|
||||
_libraryE->setToolTip(tr("Select the directory containing c++ dynamic libraries used by <b>Pharos</b>."));
|
||||
QPushButton* programB = new QPushButton(tr("&Browse"));
|
||||
QPushButton* libraryB = new QPushButton(tr("&Browse"));
|
||||
// Connect SIGNAL/SLOTS
|
||||
connect(programB , SIGNAL(clicked()), this, SLOT(chooseProgram()));
|
||||
connect(libraryB , SIGNAL(clicked()), this, SLOT(chooseLibrary()));
|
||||
// Create GroupBox
|
||||
QGroupBox* directories = new QGroupBox("Directories", this);
|
||||
QGridLayout* gLayout = new QGridLayout(this);
|
||||
gLayout->addWidget( programL , 0, 0, 1, 1);
|
||||
gLayout->addWidget(_programE , 0, 1, 1, 1);
|
||||
gLayout->addWidget( programB , 0, 2, 1, 1);
|
||||
gLayout->addWidget( libraryL , 1, 0, 1, 1);
|
||||
gLayout->addWidget(_libraryE , 1, 1, 1, 1);
|
||||
gLayout->addWidget( libraryB , 1, 2, 1, 1);
|
||||
directories->setLayout(gLayout);
|
||||
// Second GroupBox : Technos
|
||||
// Create Widgets / Layout
|
||||
QLabel* name = new QLabel(tr("Name"));
|
||||
QLabel* file = new QLabel(tr("XML Config File"));
|
||||
name->setFixedWidth(80);
|
||||
file->setFixedWidth(LINEEDITWIDTH);
|
||||
_rowLayout = new QVBoxLayout();
|
||||
_rowLayout->setContentsMargins(0,0,0,0);
|
||||
_rowLayout->setSpacing(0);
|
||||
addRow();
|
||||
// Create GroupBox
|
||||
QGroupBox* technos = new QGroupBox("Technologies", this);
|
||||
QHBoxLayout* headerLayout = new QHBoxLayout();
|
||||
headerLayout->addSpacing(20);
|
||||
headerLayout->addWidget(name);
|
||||
headerLayout->addWidget(file);
|
||||
QVBoxLayout* techLayout = new QVBoxLayout();
|
||||
techLayout->addLayout(headerLayout);
|
||||
techLayout->addLayout(_rowLayout);
|
||||
technos->setLayout(techLayout);
|
||||
|
||||
QDialogButtonBox* dbBox = new QDialogButtonBox(QDialogButtonBox::Ok);
|
||||
_add = new QPushButton("&Add technology", this);
|
||||
dbBox->addButton(_add, QDialogButtonBox::ActionRole);
|
||||
connect(_add , SIGNAL(clicked()) , this, SLOT(addRow()));
|
||||
connect(dbBox, SIGNAL(accepted()), this, SLOT(doConfig()));
|
||||
|
||||
QVBoxLayout* tLayout = new QVBoxLayout();
|
||||
tLayout->setContentsMargins(0,0,0,0);
|
||||
tLayout->addWidget(directories);
|
||||
tLayout->addWidget(technos);
|
||||
tLayout->addWidget(dbBox);
|
||||
setLayout(tLayout);
|
||||
setWindowTitle(tr("Configure runPharos"));
|
||||
layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||
}
|
||||
|
||||
|
||||
void ConfigDialog::addRow() {
|
||||
TechnoRow* row = new TechnoRow(_rowID++, this);
|
||||
connect(row, SIGNAL(suppressed(int)), this, SLOT(removeRow(int)));
|
||||
row->setContentsMargins(0,0,0,0);
|
||||
_rows.push_back(row);
|
||||
_rowLayout->addWidget(row);
|
||||
}
|
||||
|
||||
void ConfigDialog::addRow(QString& name, QString& file) {
|
||||
TechnoRow* row = new TechnoRow(_rowID++, this);
|
||||
row->setName(name);
|
||||
row->setFile(file);
|
||||
connect(row, SIGNAL(suppressed(int)), this, SLOT(removeRow(int)));
|
||||
row->setContentsMargins(0,0,0,0);
|
||||
_rows.push_back(row);
|
||||
_rowLayout->addWidget(row);
|
||||
}
|
||||
|
||||
void ConfigDialog::removeRow(int id) {
|
||||
TechnoRow* row = _rows[id];
|
||||
_rowLayout->removeWidget(row);
|
||||
row->hide();
|
||||
}
|
||||
|
||||
void ConfigDialog::doConfig() {
|
||||
QStringList list;
|
||||
if ( _programE->text().isEmpty() || _libraryE->text().isEmpty() ) {
|
||||
QMessageBox::warning(this, tr("runPharos warning"), tr("You must set all directories."));
|
||||
return;
|
||||
}
|
||||
list << _programE->text() << _libraryE->text();
|
||||
vector<pair<QString, QString> > technos;
|
||||
for ( size_t i = 0 ; i < _rows.size() ; i++ ) {
|
||||
TechnoRow* row = _rows[i];
|
||||
if (row->isVisible()) {
|
||||
if((row->getName() != "") && (row->getFile() != "")) {
|
||||
technos.push_back(pair<QString, QString>(row->getName(), row->getFile()));
|
||||
} else {
|
||||
QMessageBox::warning(this, tr("runPharos warning"), tr("You must set a valid name and file for each technology."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (technos.size() > 0) {
|
||||
emit(configDone(list, technos));
|
||||
accept();
|
||||
} else {
|
||||
QMessageBox::warning(this, tr("runPharos warning"), tr("You must set at least one valid technology."));
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigDialog::chooseProgram() {
|
||||
_programE->setText(QFileDialog::getOpenFileName(this, tr("Select Pharos binary file"), "", tr("Executable file (*)")));
|
||||
}
|
||||
|
||||
void ConfigDialog::chooseLibrary() {
|
||||
_libraryE->setText(QFileDialog::getExistingDirectory(this, tr("Select directory containing c++ dynamic libraries")));
|
||||
}
|
||||
|
||||
void ConfigDialog::setProgram(QString program) {
|
||||
_programE->setText(program);
|
||||
}
|
||||
|
||||
void ConfigDialog::setLibrary(QString library) {
|
||||
_libraryE->setText(library);
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
#ifndef CONFIGDIALOG_H
|
||||
#define CONFIGDIALOG_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QVBoxLayout;
|
||||
class QPushButton;
|
||||
class QLineEdit;
|
||||
class QStringList;
|
||||
class TechnoRow;
|
||||
|
||||
class ConfigDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConfigDialog();
|
||||
void setProgram(QString);
|
||||
void setLibrary(QString);
|
||||
|
||||
signals:
|
||||
void configDone(QStringList&, std::vector<std::pair<QString, QString> >&);
|
||||
|
||||
public slots:
|
||||
void addRow();
|
||||
void addRow(QString&, QString&);
|
||||
void removeRow(int);
|
||||
void doConfig();
|
||||
void chooseProgram();
|
||||
void chooseLibrary();
|
||||
|
||||
|
||||
private:
|
||||
QLineEdit* _programE;
|
||||
QLineEdit* _libraryE;
|
||||
static int _rowID;
|
||||
QPushButton* _add;
|
||||
QVBoxLayout* _rowLayout;
|
||||
std::vector<TechnoRow*> _rows;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,23 +0,0 @@
|
|||
#include<QMenu>
|
||||
#include<QMenuBar>
|
||||
#include<QAction>
|
||||
|
||||
#include "MainWindow.h"
|
||||
#include "MyWidget.h"
|
||||
|
||||
MainWindow::MainWindow()
|
||||
{
|
||||
MyWidget* mWidget = new MyWidget(this);
|
||||
setCentralWidget(mWidget);
|
||||
|
||||
QAction* configAct = new QAction(tr("&Configure"), this);
|
||||
configAct->setStatusTip(tr("Configure the application"));
|
||||
connect(configAct, SIGNAL(triggered()), mWidget, SLOT(reconfig()));
|
||||
QAction* aboutAct = new QAction(tr("&About"), this);
|
||||
aboutAct->setStatusTip(tr("Show the about dialog box"));
|
||||
connect(aboutAct, SIGNAL(triggered()), mWidget, SLOT(about()));
|
||||
QMenu* editMenu = menuBar()->addMenu(tr("&Edit"));
|
||||
editMenu->addAction(configAct);
|
||||
QMenu* helpMenu = menuBar()->addMenu(tr("&Help"));
|
||||
helpMenu->addAction(aboutAct);
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
#ifndef __MAINWINDOW_H
|
||||
#define __MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow ();
|
||||
~MainWindow () {};
|
||||
};
|
||||
#endif
|
|
@ -1,204 +0,0 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPushButton>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QTextEdit>
|
||||
#include <QByteArray>
|
||||
#include <QComboBox>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
#include <QStringList>
|
||||
|
||||
#include "MyWidget.h"
|
||||
#include "ConfigDialog.h"
|
||||
|
||||
MyWidget::MyWidget(QWidget *parent) : QWidget(parent) {
|
||||
|
||||
setStyleSheet("font-weight: normal;");
|
||||
|
||||
_technoCB = new QComboBox(this);
|
||||
_technoCB->setFixedWidth(120);
|
||||
readSettings();
|
||||
updateComboBox();
|
||||
|
||||
_console = new QTextEdit(this);
|
||||
_console->setFixedSize(600,350);
|
||||
_console->setFontPointSize(10);
|
||||
|
||||
_execute = new QPushButton ( "&Execute", this );
|
||||
_execute->setDefault(true);
|
||||
_stop = new QPushButton ( "&Stop", this );
|
||||
_stop->setEnabled(false);
|
||||
_show = new QPushButton ( "&Show console", this );
|
||||
_clear = new QPushButton ( "&Clear", this );
|
||||
|
||||
QDialogButtonBox* buttons = new QDialogButtonBox();
|
||||
buttons->addButton ( _execute, QDialogButtonBox::RejectRole );
|
||||
buttons->addButton ( _stop , QDialogButtonBox::AcceptRole );
|
||||
buttons->addButton ( _show , QDialogButtonBox::ResetRole );
|
||||
buttons->addButton ( _clear , QDialogButtonBox::ResetRole );
|
||||
|
||||
connect ( _execute, SIGNAL(clicked()), this , SLOT(execute()) );
|
||||
connect ( _stop , SIGNAL(clicked()), this , SLOT(stop()) );
|
||||
connect ( _show , SIGNAL(clicked()), this , SLOT(showOrHide()) );
|
||||
connect ( _clear , SIGNAL(clicked()), _console, SLOT(clear()) );
|
||||
|
||||
QHBoxLayout* hLayout = new QHBoxLayout();
|
||||
hLayout->addWidget(buttons, Qt::AlignRight);
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->addWidget(_technoCB);
|
||||
layout->addWidget(_console);
|
||||
layout->addLayout(hLayout);
|
||||
setLayout(layout);
|
||||
_clear->hide();
|
||||
_console->hide();
|
||||
setWindowTitle("Run Pharos");
|
||||
setFixedSize(400,110);
|
||||
}
|
||||
|
||||
void MyWidget::readSettings() {
|
||||
_settings = new QSettings("chams", "runPharos");
|
||||
|
||||
if ( !_settings->contains("Program") ) {
|
||||
QMessageBox::warning(this, tr("runPharos"), tr("It seems you do not have configured the application. Let's configure it now."), QMessageBox::Ok, QMessageBox::Ok);
|
||||
runConfigDialog(true);
|
||||
} else {
|
||||
_program = _settings->value("Program").toString();
|
||||
_library = _settings->value("Library").toString();
|
||||
_nbTechno = _settings->value("NbTechno").toInt();
|
||||
_technos.clear();
|
||||
for ( int i = 0 ; i < _nbTechno ; i++ ) {
|
||||
QString name = QString("name_%1").arg(i);
|
||||
QString file = QString("file_%1").arg(i);
|
||||
_technos.push_back(pair<QString, QString>(_settings->value(name).toString(), _settings->value(file).toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MyWidget::runConfigDialog(bool first) {
|
||||
ConfigDialog* cfg = new ConfigDialog;
|
||||
connect(cfg, SIGNAL(configDone(QStringList&, std::vector<std::pair<QString, QString> >&)), this, SLOT(updateConfig(QStringList&, std::vector<std::pair<QString, QString> >&)));
|
||||
if(!first) {
|
||||
cfg->setProgram(_program);
|
||||
cfg->setLibrary(_library);
|
||||
// on enleve la row par defaut vide
|
||||
cfg->removeRow(0);
|
||||
// on rajoute toutes les technos lues dans les settings:
|
||||
for ( size_t i = 0 ; i < _technos.size() ; i++ ) {
|
||||
cfg->addRow(_technos[i].first, _technos[i].second);
|
||||
}
|
||||
}
|
||||
cfg->exec();
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
void MyWidget::reconfig() {
|
||||
runConfigDialog(false);
|
||||
}
|
||||
|
||||
void MyWidget::writeSettings() {
|
||||
_settings->setValue("Program" , _program);
|
||||
_settings->setValue("Library" , _library);
|
||||
_settings->setValue("NbTechno" , _nbTechno);
|
||||
for ( size_t i = 0 ; i < _technos.size() ; i++ ) {
|
||||
QString name = QString("name_%1").arg(i);
|
||||
QString file = QString("file_%1").arg(i);
|
||||
_settings->setValue(name, _technos[i].first);
|
||||
_settings->setValue(file, _technos[i].second);
|
||||
}
|
||||
}
|
||||
|
||||
void MyWidget::updateConfig(QStringList& list, vector<pair<QString, QString> >& technos) {
|
||||
_program = list.value(0);
|
||||
_library = list.value(1);
|
||||
_technos.clear();
|
||||
for ( size_t i = 0 ; i < technos.size() ; i++ ) {
|
||||
_technos.push_back(pair<QString, QString>(technos[i].first, technos[i].second));
|
||||
}
|
||||
_nbTechno = _technos.size();
|
||||
updateComboBox();
|
||||
}
|
||||
|
||||
void MyWidget::updateComboBox() {
|
||||
if (_technoCB->count() != 0)
|
||||
_technoCB->clear();
|
||||
QStringList choices;
|
||||
for ( size_t i = 0 ; i < _technos.size() ; i++ ) {
|
||||
choices << _technos[i].first;
|
||||
}
|
||||
_technoCB->addItems(choices);
|
||||
}
|
||||
|
||||
void MyWidget::about() {
|
||||
QMessageBox::about(this, tr("About runPharos"), tr("<p><h1 align=\"center\">runPharos</h1></p>"
|
||||
"<p>This tool allows every one to easily run pharos on a specified technology.</p>"
|
||||
"<p align=\"center\">Version 1.0<br>19/02/2010<br>by <b>D.Dupuis</b></p>"));
|
||||
|
||||
}
|
||||
|
||||
void MyWidget::execute() {
|
||||
QStringList arguments;
|
||||
QString techno ("");
|
||||
QString name = _technoCB->currentText();
|
||||
for ( size_t i = 0 ; i < _technos.size() ; i++ ) {
|
||||
if ( _technos[i].first == name )
|
||||
techno = _technos[i].second;
|
||||
}
|
||||
if ( techno == "" )
|
||||
return;
|
||||
arguments << techno;
|
||||
|
||||
_myProcess = new QProcess(this);
|
||||
QStringList env = QProcess::systemEnvironment();
|
||||
QString DYLD = QString("DYLD_LIBRARY_PATH=%1").arg(_library);
|
||||
QString LD = QString("LD_LIBRARY_PATH=%1").arg(_library);
|
||||
QString PP = QString("PYTHONPATH=%1/python").arg(_library);
|
||||
env << DYLD << LD << PP;
|
||||
_myProcess->setEnvironment(env);
|
||||
connect(_myProcess, SIGNAL(readyReadStandardError()) , this, SLOT(updateError()));
|
||||
connect(_myProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(updateText()));
|
||||
connect(_myProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(finished(int, QProcess::ExitStatus)) );
|
||||
_myProcess->start(_program, arguments);
|
||||
_execute->setEnabled(false);
|
||||
_stop->setEnabled(true);
|
||||
}
|
||||
|
||||
void MyWidget::stop() {
|
||||
_myProcess->terminate();
|
||||
_execute->setEnabled(true);
|
||||
_stop->setEnabled(false);
|
||||
}
|
||||
|
||||
void MyWidget::showOrHide() {
|
||||
if ( _console->isHidden() ) {
|
||||
_show->setText("&Hide console");
|
||||
_console->show();
|
||||
_clear->show();
|
||||
setFixedSize(620,450);
|
||||
}
|
||||
else {
|
||||
_show->setText("&Show console");
|
||||
_console->hide();
|
||||
_clear->hide();
|
||||
setFixedSize(400,110);
|
||||
}
|
||||
}
|
||||
|
||||
void MyWidget::updateError() {
|
||||
QByteArray data = _myProcess->readAllStandardError();
|
||||
_console->insertPlainText(QString(data));
|
||||
}
|
||||
|
||||
void MyWidget::updateText() {
|
||||
QByteArray data = _myProcess->readAllStandardOutput();
|
||||
_console->insertPlainText(QString(data));
|
||||
}
|
||||
|
||||
void MyWidget::finished(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
_execute->setEnabled(true);
|
||||
_stop->setEnabled(false);
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
#ifndef __MY_WIDGET_H
|
||||
#define __MY_WIDGET_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QProcess>
|
||||
#include <QString>
|
||||
|
||||
class QComboBox;
|
||||
class QPushButton;
|
||||
class QTextEdit;
|
||||
class QSettings;
|
||||
class QStringList;
|
||||
|
||||
class MyWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MyWidget (QWidget *parent =0);
|
||||
~MyWidget () {};
|
||||
|
||||
QComboBox* _technoCB;
|
||||
QPushButton* _execute;
|
||||
QPushButton* _stop;
|
||||
QPushButton* _show;
|
||||
QPushButton* _clear;
|
||||
QTextEdit* _console;
|
||||
|
||||
QProcess* _myProcess;
|
||||
|
||||
QSettings* _settings;
|
||||
QString _program;
|
||||
QString _library;
|
||||
int _nbTechno;
|
||||
std::vector<std::pair<QString, QString> > _technos;
|
||||
|
||||
private:
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
void runConfigDialog(bool);
|
||||
void updateComboBox();
|
||||
|
||||
public slots:
|
||||
void about();
|
||||
void reconfig();
|
||||
void execute();
|
||||
void stop();
|
||||
void finished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void showOrHide();
|
||||
void updateError();
|
||||
void updateText();
|
||||
void updateConfig(QStringList&, std::vector<std::pair<QString, QString> >&);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,68 +0,0 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPushButton>
|
||||
#include <QFileDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLineEdit>
|
||||
|
||||
#include "TechnoRow.h"
|
||||
|
||||
TechnoRow::TechnoRow(int id, QWidget *parent) : QWidget(parent), _id(id) {
|
||||
_suppress = new QPushButton( tr("-"), this);
|
||||
_suppress->setStyleSheet("font: bold 24pt; color: red; border: 0px");
|
||||
_suppress->setFixedWidth(_suppress->height());
|
||||
_name = new QLineEdit(this);
|
||||
_name->setFixedWidth(80);
|
||||
_file = new QLineEdit(this);
|
||||
_file->setFixedWidth(300);
|
||||
_browse = new QPushButton( tr("&browse"), this);
|
||||
|
||||
connect(_suppress, SIGNAL(clicked()), this, SLOT(suppress()));
|
||||
connect(_browse , SIGNAL(clicked()), this, SLOT(chooseFile()));
|
||||
|
||||
//QDialogButtonBox* buttons = new QDialogButtonBox();
|
||||
//buttons->addButton ( _execute, QDialogButtonBox::RejectRole );
|
||||
//buttons->addButton ( _stop , QDialogButtonBox::AcceptRole );
|
||||
//buttons->addButton ( _show , QDialogButtonBox::ResetRole );
|
||||
//buttons->addButton ( _clear , QDialogButtonBox::ResetRole );
|
||||
|
||||
//connect ( _execute, SIGNAL(clicked()), this , SLOT(execute()) );
|
||||
//connect ( _stop , SIGNAL(clicked()), this , SLOT(stop()) );
|
||||
//connect ( _show , SIGNAL(clicked()), this , SLOT(showOrHide()) );
|
||||
//connect ( _clear , SIGNAL(clicked()), _console, SLOT(clear()) );
|
||||
|
||||
QHBoxLayout* hLayout = new QHBoxLayout();
|
||||
hLayout->setContentsMargins(0,0,0,0);
|
||||
hLayout->addWidget(_suppress);
|
||||
hLayout->addWidget(_name);
|
||||
hLayout->addWidget(_file);
|
||||
hLayout->addWidget(_browse);
|
||||
setLayout(hLayout);
|
||||
}
|
||||
|
||||
QString TechnoRow::getName() {
|
||||
return _name->text();
|
||||
}
|
||||
|
||||
QString TechnoRow::getFile() {
|
||||
return _file->text();
|
||||
}
|
||||
|
||||
void TechnoRow::setName(QString& name) {
|
||||
_name->setText(name);
|
||||
}
|
||||
|
||||
void TechnoRow::setFile(QString& file) {
|
||||
_file->setText(file);
|
||||
}
|
||||
|
||||
void TechnoRow::suppress() {
|
||||
emit(suppressed(_id));
|
||||
}
|
||||
|
||||
void TechnoRow::chooseFile() {
|
||||
_file->setText(QFileDialog::getOpenFileName(this, tr("Select dtr file"), "", tr("Xml file (*.xml)")));
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
#ifndef __TECHNOROW_H
|
||||
#define __TECHNOROW_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QPushButton;
|
||||
class QLineEdit;
|
||||
|
||||
class TechnoRow : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TechnoRow (int id, QWidget *parent =0);
|
||||
~TechnoRow () {};
|
||||
|
||||
QString getName();
|
||||
QString getFile();
|
||||
void setName(QString&);
|
||||
void setFile(QString&);
|
||||
|
||||
int _id;
|
||||
QLineEdit* _name;
|
||||
QLineEdit* _file;
|
||||
QPushButton* _suppress;
|
||||
QPushButton* _browse;
|
||||
|
||||
signals:
|
||||
void suppressed(int);
|
||||
|
||||
public slots:
|
||||
void suppress();
|
||||
void chooseFile();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,14 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! -e "./compile.sh" ]; then
|
||||
echo "You must run compile.sh in its own directory : ./compile.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "build" ]; then
|
||||
echo "Creating build directory"
|
||||
mkdir build
|
||||
fi
|
||||
|
||||
cd build && cmake .. && make DESTDIR=.. -j2 install
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 16 KiB |
Binary file not shown.
|
@ -1,11 +0,0 @@
|
|||
#include <QApplication>
|
||||
#include "MainWindow.h"
|
||||
|
||||
int main ( int argc, char **argv ) {
|
||||
QApplication app ( argc, argv );
|
||||
|
||||
MainWindow mWindow;
|
||||
mWindow.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
Loading…
Reference in New Issue