Commit ede9977d by Anselme

greatly improved manipulating the project matrix, added some options to build…

greatly improved manipulating the project matrix, added some options to build and deploy some dependencies, added automatik mkdir for build dirs
parent a3fe92d5
......@@ -2,14 +2,35 @@
"bullet3" : {
"git" : "https://github.com/bulletphysics/bullet3.git",
"priority" : 0,
"cmake" : [],
"make" : ""
"cmake" : [
"-DBUILD_SHARED_LIBS=False",
"-DBUILD_UNIT_TESTS=False",
"-DBUILD_OPENGL3_DEMOS=False",
"-DBUILD_CPU_DEMOS=False",
"-DBUILD_CLSOCKET=False",
"-DBUILD_ENET=False",
"-DBUILD_EXTRAS=False",
"-DBUILD_BULLET2_DEMOS=False",
"-DUSE_GLUT=False",
"-DUSE_GRAPHICAL_BENCHMARK=False",
"-DINSTALL_CMAKE_FILES=False"
],
"make" : "",
"install" : [
"copy lib/libLinearMath_[MODE].a [ROOT]/cpp_dependencies/lib[MODE]/libLinearMath.a",
"copy lib/libBulletCollision_[MODE].a [ROOT]/cpp_dependencies/lib[MODE]/libBulletCollision.a",
"copy lib/libBulletDynamics_[MODE].a [ROOT]/cpp_dependencies/lib[MODE]/libBulletDynamics.a"
]
},
"SFML" : {
"git" : "https://github.com/SFML/SFML.git",
"priority" : 0,
"cmake" : [],
"make" : ""
"cmake" : [
"-DBUILD_SHARED_LIBS=False",
"-DSFML_USE_STATIC_STD_LIBS=True"
],
"make" : "",
"install" : ""
},
"glm" : {
"git" : "https://github.com/g-truc/glm.git",
......@@ -43,6 +64,12 @@
"cmake" : [],
"make" : ""
},
"SparrowProjects" : {
"git" : "https://git.epicsparrow.com/EpicSparrow/SparrowProjects.git",
"priority" : 1,
"cmake" : [],
"make" : ""
},
"SparrowSerializer" : {
"git" : "https://git.epicsparrow.com/EpicSparrow/SparrowSerializer.git",
"priority" : 1,
......
{
"Command": [
{
2,
"",
["clone", "https://github.com/SFML/SFML.git"]
},
{
3,
"",
["../../src/SFML", "-DBUILD_SHARED_LIBS=False", "-DSFML_USE_STATIC_STD_LIBS=True"]
},
{
4,
"",
[]
},
{
5,
"build",
["cd \"SFML-$compileMode\"\ncd lib\nif [ $compileMode = \"Debug\" ] ; then\nmv libsfml-audio-s-d.a ../../../lib/Debug/libsfml-audio.a\nmv libsfml-graphics-s-d.a ../../../lib/Debug/libsfml-graphics.a\nmv libsfml-main-d.a ../../../lib/Debug/libsfml-main.a\nmv libsfml-network-s-d.a ../../../lib/Debug/libsfml-network.a\nmv libsfml-system-s-d.a ../../../lib/Debug/libsfml-system.a\nmv libsfml-window-s-d.a ../../../lib/Debug/libsfml-window.a\nelse\nmv libsfml-audio-s.a ../../../lib/Release/libsfml-audio.a\nmv libsfml-graphics-s.a ../../../lib/Release/libsfml-graphics.a\nmv libsfml-main.a ../../../lib/Release/libsfml-main.a\nmv libsfml-network-s.a ../../../lib/Release/libsfml-network.a\nmv libsfml-system-s.a ../../../lib/Release/libsfml-system.a\nmv libsfml-window-s.a ../../../lib/Release/libsfml-window.a\nfi\nif [ `uname -o` = \"Msys\" ] ; then\ncd ../../..\ncp src/SFML/extlibs/libs-mingw/x86/* lib/Release/\nfi\ncp src/SFML/include/SFML include/SFML -R"]
},
{
2,
"",
["clone", "https://git.epicsparrow.com/epicsparrow/CMakeTemplate.git"]
},
{
1,
"",
["https://epicsparrow.com/files/workspace/glm.zip"]
},
{
2,
"",
["clone", "https://git.epicsparrow.com/epicsparrow/SparrowSerializer.git"]
},
{
3,
"",
[]
},
{
4,
"",
[]
},
{
4,
"",
["install"]
},
{
2,
"",
["clone", "https://git.epicsparrow.com/EpicSparrow/SparrowInput.git"]
},
{
3,
"",
[]
},
{
4,
"",
[]
},
{
4,
"",
["install"]
}
],
"Project": [
{
"SFML",
[],
[{"Command", 0}, {"Command", 1}, {"Command", 2}, {"Command", 3}],
[]
},
{
"CMakeTemplate",
[],
[{"Command", 4}],
[]
},
{
"SparrowSerializer",
[{"Project", 1}, {"Project", 3}],
[{"Command", 6}],
[{"Command", 7}, {"Command", 8}, {"Command", 9}]
},
{
"glm",
[],
[{"Command", 5}],
[]
},
{
"SparrowInput",
[{"Project", 0}, {"Project", 1}, {"Project", 3}],
[{"Command", 10}],
[{"Command", 11}, {"Command", 12}, {"Command", 13}]
}
]
}
......@@ -125,11 +125,12 @@ void MainWindow::startTasks()
{
if(!isRunning)
{
isRunning = true;
ui->tableView->clearSelection();
ui->tableView->setEnabled(false);
ui->actionStart->setText("Stop");
ui->tableView->appendSelectionToTaskQueue();
m_taskManager->startQueue();
if(m_taskManager->startQueue())
{
isRunning = true;
ui->tableView->setEnabled(false);
ui->actionStart->setText("Stop");
}
}
}
......@@ -69,7 +69,7 @@
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
<enum>QAbstractItemView::ContiguousSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
......
......@@ -3,6 +3,8 @@
#include "projecttable.h"
#include <QKeyEvent>
#include <QDesktopServices>
#include <QSettings>
ProjectMatrix::ProjectMatrix(QWidget* parent) :
QTableView(parent)
......@@ -12,45 +14,39 @@ ProjectMatrix::ProjectMatrix(QWidget* parent) :
void ProjectMatrix::keyPressEvent(QKeyEvent *event)
{
switch ( event->key() )
{
case Qt::Key_Plus :
setStatus(Task::READY);
break;
case Qt::Key_Minus :
setStatus(Task::AVAILABLE);
break;
default:
QTableView::keyPressEvent(event);
}
QTableView::keyPressEvent(event);
}
void ProjectMatrix::setModel(QAbstractItemModel *model)
void ProjectMatrix::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
{
mModel = dynamic_cast<ProjectTable*>(model);
QTableView::setModel(mModel);
QTableView::selectionChanged(selected, deselected);
}
void ProjectMatrix::setStatus(Task::Status status)
void ProjectMatrix::mouseReleaseEvent(QMouseEvent *event)
{
QItemSelectionModel *select = selectionModel();
if(select->hasSelection())
QTableView::mouseReleaseEvent(event);
if(event->button() == Qt::LeftButton)
{
QModelIndexList list = select->selectedIndexes();
for(QModelIndex index : list)
QItemSelectionModel *select = selectionModel();
if(select->hasSelection())
{
Task::Status currentStatus = mModel->getStatus(index);
if(currentStatus != Task::DISABLED)
QModelIndexList list = select->selectedIndexes();
for(QModelIndex& index : list)
{
if(status == Task::AVAILABLE)
mModel->setStatus(index, Task::AVAILABLE);
else if(currentStatus == Task::AVAILABLE && status == Task::READY)
mModel->setStatus(index, Task::READY);
if(mModel->getStatus(index) != Task::DISABLED)
mModel->setStatus(index, mModel->getStatus(index) == Task::AVAILABLE ? Task::READY : Task::AVAILABLE);
}
clearSelection();
}
}
}
void ProjectMatrix::setModel(QAbstractItemModel *model)
{
mModel = dynamic_cast<ProjectTable*>(model);
QTableView::setModel(mModel);
}
void ProjectMatrix::appendSelectionToTaskQueue()
{
int rows = mModel->rowCount();
......@@ -61,10 +57,16 @@ void ProjectMatrix::appendSelectionToTaskQueue()
for(int j=0; j<cols; ++j)
{
Task::Command command = Task::Command(j);
if(mModel->getStatus(project, command) == Task::READY)
Task::Status status = mModel->getStatus(project, command);
if(status != Task::DISABLED && status != Task::AVAILABLE)
emit newTask(project, command);
}
}
}
void openInExplorer(Project* p)
{
QSettings settings("EpicSparrow", "SparrowProjects");
QString workDir = QString("%1%2/").arg(settings.value("workspace").toString()).arg(p->name);
QDesktopServices::openUrl(workDir);
}
......@@ -11,7 +11,7 @@ class ProjectMatrix : public QTableView
{
Q_OBJECT
void setStatus(Task::Status status);
void setSelectedTask(bool isSelected);
ProjectTable* mModel;
......@@ -25,6 +25,10 @@ public:
protected:
void keyPressEvent(QKeyEvent *event) override;
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;
void mouseReleaseEvent(QMouseEvent *event) override;
signals:
void newTask(Project* p, Task::Command c);
};
......
......@@ -2,6 +2,7 @@
#include <QSettings>
#include <QProcess>
#include <QDir>
#include "project.h"
......@@ -54,22 +55,22 @@ Task::Task(Project* p, Task::Command c) :
break;
case Task::CMAKE :
program = settings.value("cmakePath").toString();
workingDir = QString("%1%2/%3/").arg(settings.value("workspace").toString()).arg(p->name).arg(settings.value("lastMode").toString());
workingDir = QString("%1%2/build-%3/").arg(settings.value("workspace").toString()).arg(p->name).arg(settings.value("lastMode").toString());
arguments << ".." << QString("-DCMAKE_BUILD_TYPE=%1").arg(settings.value("lastMode").toString());
#ifdef WIN32
arguments << "-G" << "\"CodeBlocks - MinGW Makefiles\"";
arguments << "-G" << "CodeBlocks - MinGW Makefiles";
#endif
arguments << QString("-DCMAKE_BUILD_TYPE=%1").arg(settings.value("lastMode").toString());
for(const QString& str : p->customCMakeOptions)
arguments << str;
break;
case Task::MAKE :
program = settings.value("makePath").toString();
workingDir = QString("%1%2/%3/").arg(settings.value("workspace").toString()).arg(p->name).arg(settings.value("lastMode").toString());
workingDir = QString("%1%2/build-%3/").arg(settings.value("workspace").toString()).arg(p->name).arg(settings.value("lastMode").toString());
arguments << "-j4";
break;
case Task::INSTALL :
program = settings.value("makePath").toString();
workingDir = QString("%1%2/%3/").arg(settings.value("workspace").toString()).arg(p->name).arg(settings.value("lastMode").toString());
workingDir = QString("%1%2/build-%3/").arg(settings.value("workspace").toString()).arg(p->name).arg(settings.value("lastMode").toString());
arguments << "install";
break;
default:
......@@ -77,6 +78,11 @@ Task::Task(Project* p, Task::Command c) :
break;
}
QDir dir(workingDir);
if (!dir.exists()) {
dir.mkpath(".");
}
process->setProcessChannelMode(QProcess::MergedChannels);
process->setWorkingDirectory(workingDir);
process->setProgram(program);
......
......@@ -47,14 +47,16 @@ void TaskManager::abortTasks()
t->cancelTask();
}
void TaskManager::startQueue()
bool TaskManager::startQueue()
{
if(!taskQueue.empty())
{
Task* t = taskQueue.front();
emit taskStatusChanged(t->project, t->command, Task::RUNNING);
t->run();
return true;
}
return false;
}
......
......@@ -20,7 +20,7 @@ public:
TaskManager(QObject* parent);
void abortTasks();
void startQueue();
bool startQueue();
public slots:
void addTask(Project *p, Task::Command c);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment