Coding-style applied the project.
$ cd util $ ./make_pretty.sh
This commit is contained in:
@@ -71,17 +71,17 @@ TraceAnalyzer::TraceAnalyzer(QWidget *parent) :
|
||||
ui->actionMetrics->setEnabled(false);
|
||||
}
|
||||
|
||||
TraceAnalyzer::TraceAnalyzer(QSet<QString> paths, StartupOption option, QWidget *parent):
|
||||
TraceAnalyzer::TraceAnalyzer(QSet<QString> paths, StartupOption option,
|
||||
QWidget *parent):
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::TraceAnalyzer)
|
||||
{
|
||||
setUpGui();
|
||||
|
||||
for(const QString& path : paths)
|
||||
for (const QString &path : paths)
|
||||
openTracefile(path);
|
||||
|
||||
if(option == StartupOption::runTests)
|
||||
{
|
||||
if (option == StartupOption::runTests) {
|
||||
ui->actionTest->trigger();
|
||||
}
|
||||
}
|
||||
@@ -97,25 +97,24 @@ void TraceAnalyzer::on_actionOpen_triggered()
|
||||
tr("Open Tracefile"),
|
||||
"../simulator/",
|
||||
tr("Tracefile (*.tdb)"));
|
||||
if(paths.isEmpty())
|
||||
{
|
||||
if (paths.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(const QString &path: paths)
|
||||
{
|
||||
for (const QString &path : paths) {
|
||||
openTracefile(path);
|
||||
}
|
||||
}
|
||||
|
||||
void TraceAnalyzer::openTracefile(const QString &path)
|
||||
{
|
||||
if(openedTraceFiles.contains(path))
|
||||
if (openedTraceFiles.contains(path))
|
||||
return;
|
||||
|
||||
TraceFileTab* tab = new TraceFileTab(this, path);
|
||||
connect(tab, SIGNAL(statusChanged(QString, bool)), this, SLOT(statusChanged(QString, bool)));
|
||||
ui->traceFileTabs->addTab(tab,QFileInfo(path).baseName());
|
||||
TraceFileTab *tab = new TraceFileTab(this, path);
|
||||
connect(tab, SIGNAL(statusChanged(QString, bool)), this,
|
||||
SLOT(statusChanged(QString, bool)));
|
||||
ui->traceFileTabs->addTab(tab, QFileInfo(path).baseName());
|
||||
openedTraceFiles.insert(path);
|
||||
|
||||
// Enable actions
|
||||
@@ -130,7 +129,8 @@ void TraceAnalyzer::openTracefile(const QString &path)
|
||||
|
||||
void TraceAnalyzer::on_traceFileTabs_tabCloseRequested(int index)
|
||||
{
|
||||
TraceFileTab* traceFileTab = static_cast<TraceFileTab*>(ui->traceFileTabs->widget(index));
|
||||
TraceFileTab *traceFileTab = static_cast<TraceFileTab *>
|
||||
(ui->traceFileTabs->widget(index));
|
||||
openedTraceFiles.remove(traceFileTab->getPathToTraceFile());
|
||||
ui->traceFileTabs->removeTab(index);
|
||||
delete traceFileTab;
|
||||
@@ -138,7 +138,7 @@ void TraceAnalyzer::on_traceFileTabs_tabCloseRequested(int index)
|
||||
|
||||
void TraceAnalyzer::on_actionClose_all_triggered()
|
||||
{
|
||||
while(ui->traceFileTabs->count())
|
||||
while (ui->traceFileTabs->count())
|
||||
on_traceFileTabs_tabCloseRequested(0);
|
||||
|
||||
// All files closed. Disable actions except for "Open".
|
||||
@@ -158,8 +158,9 @@ void TraceAnalyzer::on_actionReload_all_triggered()
|
||||
// Remove all tabs
|
||||
int tabIndex = 0;
|
||||
while (ui->traceFileTabs->count() != 0) {
|
||||
traceFileTab = static_cast<TraceFileTab*>(ui->traceFileTabs->widget(0));
|
||||
std::cout << "Closing tab #" << tabIndex << " \"" << traceFileTab->getPathToTraceFile().toStdString() << "\"" << std::endl;
|
||||
traceFileTab = static_cast<TraceFileTab *>(ui->traceFileTabs->widget(0));
|
||||
std::cout << "Closing tab #" << tabIndex << " \"" <<
|
||||
traceFileTab->getPathToTraceFile().toStdString() << "\"" << std::endl;
|
||||
|
||||
ui->traceFileTabs->removeTab(0);
|
||||
delete traceFileTab;
|
||||
@@ -173,10 +174,12 @@ void TraceAnalyzer::on_actionReload_all_triggered()
|
||||
// Recreate all tabs
|
||||
tabIndex = 0;
|
||||
for (auto path : list) {
|
||||
std::cout << "Reopening tab# " << tabIndex << " \"" << path.toStdString() << "\"" << std::endl;
|
||||
std::cout << "Reopening tab# " << tabIndex << " \"" << path.toStdString() <<
|
||||
"\"" << std::endl;
|
||||
|
||||
traceFileTab = new TraceFileTab(this, path);
|
||||
connect(traceFileTab, SIGNAL(statusChanged(QString, bool)), this, SLOT(statusChanged(QString, bool)));
|
||||
connect(traceFileTab, SIGNAL(statusChanged(QString, bool)), this,
|
||||
SLOT(statusChanged(QString, bool)));
|
||||
ui->traceFileTabs->addTab(traceFileTab, QFileInfo(path).baseName());
|
||||
|
||||
tabIndex++;
|
||||
@@ -190,7 +193,8 @@ void TraceAnalyzer::on_actionSaveChangesToDB_triggered()
|
||||
for (int index = 0; index < ui->traceFileTabs->count(); index++) {
|
||||
// Changes in the database files will trigger the file watchers from
|
||||
// the TraceFileTab class. They generate signals connected to TraceAnalyzer::statusChanged().
|
||||
TraceFileTab *traceFileTab = static_cast<TraceFileTab *>(ui->traceFileTabs->widget(index));
|
||||
TraceFileTab *traceFileTab = static_cast<TraceFileTab *>
|
||||
(ui->traceFileTabs->widget(index));
|
||||
traceFileTab->commitChangesToDB();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user