2016-04-29 16:13:32 +03:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QTreeView>
|
|
|
|
#include <QFileSystemModel>
|
2016-07-10 01:15:41 +03:00
|
|
|
#include <chrono>
|
2016-05-01 23:32:46 +03:00
|
|
|
#include "treemodel.h"
|
2016-06-26 18:46:51 +03:00
|
|
|
#include "blocks_graphics_view.h"
|
|
|
|
#include "blocks_tree_widget.h"
|
2016-06-26 20:54:16 +03:00
|
|
|
#include "main_window.h"
|
2016-06-26 12:48:59 +03:00
|
|
|
#include "profiler/reader.h"
|
2016-04-29 16:13:32 +03:00
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
QApplication app(argc, argv);
|
|
|
|
|
2016-05-01 23:32:46 +03:00
|
|
|
//QFileSystemModel *model = new QFileSystemModel;
|
|
|
|
//model->setRootPath(QDir::currentPath());
|
2016-06-26 12:48:59 +03:00
|
|
|
// const char* filename = 0;
|
|
|
|
// if(argc > 1 && argv[1]){
|
|
|
|
// filename = argv[1];
|
|
|
|
// }else{
|
|
|
|
// return 255;
|
|
|
|
// }
|
2016-06-10 23:45:21 +03:00
|
|
|
|
2016-06-26 12:48:59 +03:00
|
|
|
// QFile file(filename);
|
|
|
|
// file.open(QIODevice::ReadOnly);
|
|
|
|
// TreeModel model(file.readAll());
|
|
|
|
// file.close();
|
2016-05-01 23:32:46 +03:00
|
|
|
|
|
|
|
|
2016-06-26 12:48:59 +03:00
|
|
|
// QTreeView *tree = new QTreeView();
|
|
|
|
// tree->setModel(&model);
|
|
|
|
//
|
|
|
|
// tree->show();
|
2016-04-29 16:13:32 +03:00
|
|
|
|
2016-07-10 01:15:41 +03:00
|
|
|
auto now = ::std::chrono::duration_cast<std::chrono::seconds>(::std::chrono::system_clock::now().time_since_epoch()).count() >> 1;
|
|
|
|
srand((unsigned int)now);
|
|
|
|
|
2016-06-26 20:54:16 +03:00
|
|
|
int mode = 2;
|
2016-04-29 16:13:32 +03:00
|
|
|
|
2016-06-26 13:14:00 +03:00
|
|
|
switch (mode)
|
2016-06-26 12:48:59 +03:00
|
|
|
{
|
2016-06-26 13:14:00 +03:00
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
const bool test = false;
|
2016-06-26 12:48:59 +03:00
|
|
|
|
2016-06-26 13:14:00 +03:00
|
|
|
if (test)
|
|
|
|
{
|
2016-06-26 20:54:16 +03:00
|
|
|
ProfGraphicsView gview(true);
|
2016-06-26 13:14:00 +03:00
|
|
|
gview.show();
|
|
|
|
return app.exec();
|
|
|
|
}
|
|
|
|
|
|
|
|
thread_blocks_tree_t threaded_trees;
|
2016-06-26 22:34:51 +03:00
|
|
|
fillTreesFromFile("test.prof", threaded_trees, true);
|
2016-06-26 13:14:00 +03:00
|
|
|
|
2016-06-26 19:06:53 +03:00
|
|
|
ProfGraphicsView gview(threaded_trees);
|
2016-06-26 13:14:00 +03:00
|
|
|
gview.show();
|
2016-06-26 12:48:59 +03:00
|
|
|
|
2016-06-26 13:14:00 +03:00
|
|
|
return app.exec();
|
|
|
|
}
|
2016-06-26 12:48:59 +03:00
|
|
|
|
2016-06-26 13:14:00 +03:00
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
thread_blocks_tree_t threaded_trees;
|
2016-06-27 22:11:26 +03:00
|
|
|
auto nblocks = fillTreesFromFile("test.prof", threaded_trees, true);
|
2016-06-26 13:14:00 +03:00
|
|
|
|
2016-06-27 22:11:26 +03:00
|
|
|
ProfTreeWidget view(nblocks, threaded_trees);
|
2016-06-26 13:14:00 +03:00
|
|
|
view.show();
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
}
|
2016-06-26 20:54:16 +03:00
|
|
|
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
ProfMainWindow window;
|
|
|
|
window.show();
|
|
|
|
return app.exec();
|
|
|
|
}
|
2016-06-26 13:14:00 +03:00
|
|
|
}
|
2016-06-26 12:48:59 +03:00
|
|
|
|
2016-06-26 13:14:00 +03:00
|
|
|
return -1;
|
2016-05-01 23:32:46 +03:00
|
|
|
}
|