|
|
|
@ -242,13 +242,8 @@ PmuppGui::PmuppGui(QStringList fln)
|
|
|
|
|
fDatime = dt.toSecsSinceEpoch();
|
|
|
|
|
fMuppInstance = -1;
|
|
|
|
|
|
|
|
|
|
fMuppPlot = nullptr;
|
|
|
|
|
fNormalizeAction = nullptr;
|
|
|
|
|
|
|
|
|
|
fNormalize = false;
|
|
|
|
|
|
|
|
|
|
fVarDlg = nullptr;
|
|
|
|
|
|
|
|
|
|
fMacroPath = QString("./");
|
|
|
|
|
fMacroName = QString("");
|
|
|
|
|
|
|
|
|
@ -287,135 +282,134 @@ PmuppGui::PmuppGui(QStringList fln)
|
|
|
|
|
setupHelpActions();
|
|
|
|
|
|
|
|
|
|
// create central widget
|
|
|
|
|
fCentralWidget = new QWidget(this);
|
|
|
|
|
fCentralWidget = std::make_unique<QWidget>(this);
|
|
|
|
|
|
|
|
|
|
// setup widgets
|
|
|
|
|
fBoxLayout_Main = new QBoxLayout(QBoxLayout::TopToBottom);
|
|
|
|
|
fBoxLayout_Main = std::make_unique<QBoxLayout>(QBoxLayout::TopToBottom);
|
|
|
|
|
fBoxLayout_Main->setGeometry(QRect(10, 40, 600, 500));
|
|
|
|
|
|
|
|
|
|
fBoxLayout_Top = new QBoxLayout(QBoxLayout::LeftToRight);
|
|
|
|
|
fGridLayout_Left = new QGridLayout();
|
|
|
|
|
fGridLayout_Right = new QGridLayout();
|
|
|
|
|
fBoxLayout_Cmd = new QBoxLayout(QBoxLayout::LeftToRight);
|
|
|
|
|
fBoxLayout_Top = std::make_unique<QBoxLayout>(QBoxLayout::LeftToRight);
|
|
|
|
|
fGridLayout_Left = std::make_unique<QGridLayout>();
|
|
|
|
|
fGridLayout_Right = std::make_unique<QGridLayout>();
|
|
|
|
|
|
|
|
|
|
// label for the collection/parameter list widgets
|
|
|
|
|
fColLabel = new QLabel(this);
|
|
|
|
|
fColLabel = std::make_unique<QLabel>(this);
|
|
|
|
|
fColLabel->setText("Collection -> Parameter");
|
|
|
|
|
fColLabel->setMaximumHeight(15);
|
|
|
|
|
|
|
|
|
|
// central widget for the collection/parameter list widgets
|
|
|
|
|
fColParamSplitter = new QSplitter(Qt::Horizontal, this);
|
|
|
|
|
fColParamSplitter = std::make_unique<QSplitter>(Qt::Horizontal, this);
|
|
|
|
|
fColParamSplitter->setMinimumSize(550,330);
|
|
|
|
|
|
|
|
|
|
fColList = new QListWidget(this);
|
|
|
|
|
fColList = std::make_unique<QListWidget>(this);
|
|
|
|
|
fColList->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
|
|
|
|
|
|
|
|
|
fParamList = new QListWidget(this);
|
|
|
|
|
fParamList = std::make_unique<QListWidget>(this);
|
|
|
|
|
// the next two lines enable drag and drop facility (drag)
|
|
|
|
|
fParamList->setSelectionMode(QAbstractItemView::SingleSelection);
|
|
|
|
|
fParamList->setDragEnabled(true);
|
|
|
|
|
|
|
|
|
|
fColParamSplitter->addWidget(fColList);
|
|
|
|
|
fColParamSplitter->addWidget(fParamList);
|
|
|
|
|
fColParamSplitter->addWidget(fColList.get());
|
|
|
|
|
fColParamSplitter->addWidget(fParamList.get());
|
|
|
|
|
|
|
|
|
|
fRemoveCollection = new QPushButton("Remove Collection", this);
|
|
|
|
|
fRefreshCollection = new QPushButton("Refresh Collection", this);
|
|
|
|
|
fRemoveCollection = std::make_unique<QPushButton>("Remove Collection", this);
|
|
|
|
|
fRefreshCollection = std::make_unique<QPushButton>("Refresh Collection", this);
|
|
|
|
|
|
|
|
|
|
fGridLayout_Left->addWidget(fColLabel, 1, 1, 1, 2);
|
|
|
|
|
fGridLayout_Left->addWidget(fColParamSplitter, 2, 1, 1, 2);
|
|
|
|
|
fGridLayout_Left->addWidget(fRemoveCollection, 3, 1);
|
|
|
|
|
fGridLayout_Left->addWidget(fRefreshCollection, 3, 2);
|
|
|
|
|
fGridLayout_Left->addWidget(fColLabel.get(), 1, 1, 1, 2);
|
|
|
|
|
fGridLayout_Left->addWidget(fColParamSplitter.get(), 2, 1, 1, 2);
|
|
|
|
|
fGridLayout_Left->addWidget(fRemoveCollection.get(), 3, 1);
|
|
|
|
|
fGridLayout_Left->addWidget(fRefreshCollection.get(), 3, 2);
|
|
|
|
|
|
|
|
|
|
// X-axis
|
|
|
|
|
fXaxisLabel = new QLabel("x-axis");
|
|
|
|
|
fViewX = new QListWidget(this);
|
|
|
|
|
fXaxisLabel = std::make_unique<QLabel>("x-axis");
|
|
|
|
|
fViewX = std::make_unique<QListWidget>(this);
|
|
|
|
|
// the next two lines enable drag and drop facility (copy drop)
|
|
|
|
|
fViewX->viewport()->setAcceptDrops(true);
|
|
|
|
|
fViewX->setDropIndicatorShown(true);
|
|
|
|
|
|
|
|
|
|
fAddX = new QPushButton("add X", this);
|
|
|
|
|
fRemoveX = new QPushButton("remove X", this);
|
|
|
|
|
fAddX = std::make_unique<QPushButton>("add X", this);
|
|
|
|
|
fRemoveX = std::make_unique<QPushButton>("remove X", this);
|
|
|
|
|
|
|
|
|
|
// Y-axis
|
|
|
|
|
fYaxisLabel = new QLabel("y-axis");
|
|
|
|
|
fViewY = new QListWidget(this);
|
|
|
|
|
fYaxisLabel = std::make_unique<QLabel>("y-axis");
|
|
|
|
|
fViewY = std::make_unique<QListWidget>(this);
|
|
|
|
|
// the next two lines enable drag and drop facility (copy drop)
|
|
|
|
|
fViewY->viewport()->setAcceptDrops(true);
|
|
|
|
|
fViewY->setDropIndicatorShown(true);
|
|
|
|
|
|
|
|
|
|
fAddY = new QPushButton("add Y", this);
|
|
|
|
|
fRemoveY = new QPushButton("remove Y", this);
|
|
|
|
|
fAddY = std::make_unique<QPushButton>("add Y", this);
|
|
|
|
|
fRemoveY = std::make_unique<QPushButton>("remove Y", this);
|
|
|
|
|
|
|
|
|
|
// 2 column button's for the right grid
|
|
|
|
|
fAddDitto = new QPushButton("Add Ditto", this);
|
|
|
|
|
fPlot = new QPushButton("Plot", this);
|
|
|
|
|
fAddDitto = std::make_unique<QPushButton>("Add Ditto", this);
|
|
|
|
|
fPlot = std::make_unique<QPushButton>("Plot", this);
|
|
|
|
|
|
|
|
|
|
fGridLayout_Right->addWidget(fXaxisLabel, 1, 1);
|
|
|
|
|
fGridLayout_Right->addWidget(fYaxisLabel, 1, 2);
|
|
|
|
|
fGridLayout_Right->addWidget(fViewX, 2, 1);
|
|
|
|
|
fGridLayout_Right->addWidget(fViewY, 2, 2);
|
|
|
|
|
fGridLayout_Right->addWidget(fAddX, 3, 1);
|
|
|
|
|
fGridLayout_Right->addWidget(fAddY, 3, 2);
|
|
|
|
|
fGridLayout_Right->addWidget(fRemoveX, 4, 1);
|
|
|
|
|
fGridLayout_Right->addWidget(fRemoveY, 4, 2);
|
|
|
|
|
fGridLayout_Right->addWidget(fAddDitto, 5, 1, 1, 2);
|
|
|
|
|
fGridLayout_Right->addWidget(fPlot, 6, 1, 1, 2);
|
|
|
|
|
fGridLayout_Right->addWidget(fXaxisLabel.get(), 1, 1);
|
|
|
|
|
fGridLayout_Right->addWidget(fYaxisLabel.get(), 1, 2);
|
|
|
|
|
fGridLayout_Right->addWidget(fViewX.get(), 2, 1);
|
|
|
|
|
fGridLayout_Right->addWidget(fViewY.get(), 2, 2);
|
|
|
|
|
fGridLayout_Right->addWidget(fAddX.get(), 3, 1);
|
|
|
|
|
fGridLayout_Right->addWidget(fAddY.get(), 3, 2);
|
|
|
|
|
fGridLayout_Right->addWidget(fRemoveX.get(), 4, 1);
|
|
|
|
|
fGridLayout_Right->addWidget(fRemoveY.get(), 4, 2);
|
|
|
|
|
fGridLayout_Right->addWidget(fAddDitto.get(), 5, 1, 1, 2);
|
|
|
|
|
fGridLayout_Right->addWidget(fPlot.get(), 6, 1, 1, 2);
|
|
|
|
|
|
|
|
|
|
fBoxLayout_Top->addLayout(fGridLayout_Left);
|
|
|
|
|
fBoxLayout_Top->addLayout(fGridLayout_Right);
|
|
|
|
|
fBoxLayout_Top->addLayout(fGridLayout_Left.get());
|
|
|
|
|
fBoxLayout_Top->addLayout(fGridLayout_Right.get());
|
|
|
|
|
|
|
|
|
|
fCmdLineHistory = new QPlainTextEdit(this);
|
|
|
|
|
fCmdLineHistory = std::make_unique<QPlainTextEdit>(this);
|
|
|
|
|
fCmdLineHistory->setReadOnly(true);
|
|
|
|
|
fCmdLineHistory->setMaximumBlockCount(50);
|
|
|
|
|
// fill cmd history
|
|
|
|
|
for (int i=0; i<fCmdHistory.size(); i++)
|
|
|
|
|
fCmdLineHistory->insertPlainText(QString("%1\n").arg(fCmdHistory[i]));
|
|
|
|
|
fCmdLine = new QLineEdit(this);
|
|
|
|
|
fCmdLine = std::make_unique<QLineEdit>(this);
|
|
|
|
|
fCmdLine->installEventFilter(this);
|
|
|
|
|
fCmdLine->setText("$ ");
|
|
|
|
|
fCmdLine->setFocus(); // sets the keyboard focus
|
|
|
|
|
fExitButton = new QPushButton("E&xit", this);
|
|
|
|
|
fExitButton = std::make_unique<QPushButton>("E&xit", this);
|
|
|
|
|
|
|
|
|
|
QVBoxLayout *cmdLayout = new QVBoxLayout;
|
|
|
|
|
QLabel *cmdLabel = new QLabel("History:");
|
|
|
|
|
cmdLayout->addWidget(cmdLabel);
|
|
|
|
|
cmdLayout->addWidget(fCmdLineHistory);
|
|
|
|
|
cmdLayout->addWidget(fCmdLine);
|
|
|
|
|
cmdLayout->addWidget(fCmdLineHistory.get());
|
|
|
|
|
cmdLayout->addWidget(fCmdLine.get());
|
|
|
|
|
|
|
|
|
|
fBoxLayout_Cmd = new QBoxLayout(QBoxLayout::LeftToRight);
|
|
|
|
|
fBoxLayout_Cmd = std::make_unique<QBoxLayout>(QBoxLayout::LeftToRight);
|
|
|
|
|
fBoxLayout_Cmd->addLayout(cmdLayout);
|
|
|
|
|
fBoxLayout_Cmd->addWidget(fExitButton);
|
|
|
|
|
fBoxLayout_Cmd->setAlignment(fCmdLine, Qt::AlignBottom);
|
|
|
|
|
fBoxLayout_Cmd->setAlignment(fExitButton, Qt::AlignBottom);
|
|
|
|
|
fBoxLayout_Cmd->addWidget(fExitButton.get());
|
|
|
|
|
fBoxLayout_Cmd->setAlignment(fCmdLine.get(), Qt::AlignBottom);
|
|
|
|
|
fBoxLayout_Cmd->setAlignment(fExitButton.get(), Qt::AlignBottom);
|
|
|
|
|
|
|
|
|
|
fCmdSplitter = new QSplitter(Qt::Vertical, this);
|
|
|
|
|
fCmdSplitter = std::make_unique<QSplitter>(Qt::Vertical, this);
|
|
|
|
|
QWidget *topWidget = new QWidget(this); // only needed since splitter needs a QWidget
|
|
|
|
|
topWidget->setLayout(fBoxLayout_Top);
|
|
|
|
|
topWidget->setLayout(fBoxLayout_Top.get());
|
|
|
|
|
QWidget *cmdWidget = new QWidget(this); // only needed since splitter needs a QWidget
|
|
|
|
|
cmdWidget->setLayout(fBoxLayout_Cmd);
|
|
|
|
|
cmdWidget->setLayout(fBoxLayout_Cmd.get());
|
|
|
|
|
fCmdSplitter->addWidget(topWidget);
|
|
|
|
|
fCmdSplitter->addWidget(cmdWidget);
|
|
|
|
|
|
|
|
|
|
fBoxLayout_Main->addWidget(fCmdSplitter);
|
|
|
|
|
fBoxLayout_Main->addWidget(fCmdSplitter.get());
|
|
|
|
|
|
|
|
|
|
// establish all the necessary signal/slots
|
|
|
|
|
connect(fRefreshCollection, SIGNAL( pressed() ), this, SLOT( refresh() ));
|
|
|
|
|
connect(fRemoveCollection, SIGNAL( pressed() ), this, SLOT( remove() ));
|
|
|
|
|
connect(fAddX, SIGNAL( pressed() ), this, SLOT( addX() ));
|
|
|
|
|
connect(fAddY, SIGNAL( pressed() ), this, SLOT( addY() ));
|
|
|
|
|
connect(fRemoveX, SIGNAL( pressed() ), this, SLOT( removeX() ));
|
|
|
|
|
connect(fRemoveY, SIGNAL( pressed() ), this, SLOT( removeY() ));
|
|
|
|
|
connect(fAddDitto, SIGNAL( pressed() ), this, SLOT( addDitto() ));
|
|
|
|
|
connect(fPlot, SIGNAL( pressed()), this, SLOT( plot()) );
|
|
|
|
|
connect(fCmdLine, SIGNAL ( returnPressed() ), this, SLOT( handleCmds() ));
|
|
|
|
|
connect(fExitButton, SIGNAL( pressed() ), this, SLOT( aboutToQuit() ));
|
|
|
|
|
connect(fRefreshCollection.get(), SIGNAL( pressed() ), this, SLOT( refresh() ));
|
|
|
|
|
connect(fRemoveCollection.get(), SIGNAL( pressed() ), this, SLOT( remove() ));
|
|
|
|
|
connect(fAddX.get(), SIGNAL( pressed() ), this, SLOT( addX() ));
|
|
|
|
|
connect(fAddY.get(), SIGNAL( pressed() ), this, SLOT( addY() ));
|
|
|
|
|
connect(fRemoveX.get(), SIGNAL( pressed() ), this, SLOT( removeX() ));
|
|
|
|
|
connect(fRemoveY.get(), SIGNAL( pressed() ), this, SLOT( removeY() ));
|
|
|
|
|
connect(fAddDitto.get(), SIGNAL( pressed() ), this, SLOT( addDitto() ));
|
|
|
|
|
connect(fPlot.get(), SIGNAL( pressed()), this, SLOT( plot()) );
|
|
|
|
|
connect(fCmdLine.get(), SIGNAL ( returnPressed() ), this, SLOT( handleCmds() ));
|
|
|
|
|
connect(fExitButton.get(), SIGNAL( pressed() ), this, SLOT( aboutToQuit() ));
|
|
|
|
|
|
|
|
|
|
connect(fColList, SIGNAL( currentRowChanged(int) ), this, SLOT( updateParamList(int) ));
|
|
|
|
|
connect(fColList, SIGNAL( itemDoubleClicked(QListWidgetItem*) ), this, SLOT( editCollName(QListWidgetItem*) ));
|
|
|
|
|
connect(fColList.get(), SIGNAL( currentRowChanged(int) ), this, SLOT( updateParamList(int) ));
|
|
|
|
|
connect(fColList.get(), SIGNAL( itemDoubleClicked(QListWidgetItem*) ), this, SLOT( editCollName(QListWidgetItem*) ));
|
|
|
|
|
|
|
|
|
|
connect(fViewX, SIGNAL( currentRowChanged(int) ), this, SLOT( refreshY() ));
|
|
|
|
|
connect(fViewX, SIGNAL( itemChanged(QListWidgetItem*) ), this, SLOT( dropOnViewX(QListWidgetItem*) ));
|
|
|
|
|
connect(fViewY, SIGNAL( itemChanged(QListWidgetItem*) ), this, SLOT( dropOnViewY(QListWidgetItem*) ));
|
|
|
|
|
connect(fViewX.get(), SIGNAL( currentRowChanged(int) ), this, SLOT( refreshY() ));
|
|
|
|
|
connect(fViewX.get(), SIGNAL( itemChanged(QListWidgetItem*) ), this, SLOT( dropOnViewX(QListWidgetItem*) ));
|
|
|
|
|
connect(fViewY.get(), SIGNAL( itemChanged(QListWidgetItem*) ), this, SLOT( dropOnViewY(QListWidgetItem*) ));
|
|
|
|
|
|
|
|
|
|
// deal with parameter data specifics
|
|
|
|
|
if (dataAtStartup)
|
|
|
|
@ -423,8 +417,8 @@ PmuppGui::PmuppGui(QStringList fln)
|
|
|
|
|
|
|
|
|
|
connect(fParamDataHandler, SIGNAL( newData() ), this, SLOT( handleNewData() ));
|
|
|
|
|
|
|
|
|
|
fCentralWidget->setLayout(fBoxLayout_Main);
|
|
|
|
|
setCentralWidget(fCentralWidget);
|
|
|
|
|
fCentralWidget->setLayout(fBoxLayout_Main.get());
|
|
|
|
|
setCentralWidget(fCentralWidget.get());
|
|
|
|
|
|
|
|
|
|
// in case there is no db/dat file list given open the db/dat file open menu automatically.
|
|
|
|
|
if (fln.size() == 0) {
|
|
|
|
@ -593,11 +587,11 @@ void PmuppGui::setupToolActions()
|
|
|
|
|
|
|
|
|
|
menu->addSeparator();
|
|
|
|
|
|
|
|
|
|
fNormalizeAction = new QAction(tr( "Normalize" ), this);
|
|
|
|
|
fNormalizeAction = std::make_unique<QAction>(tr( "Normalize" ), this);
|
|
|
|
|
fNormalizeAction->setStatusTip( tr("Plot Data Normalized (y-axis)") );
|
|
|
|
|
fNormalizeAction->setCheckable(true);
|
|
|
|
|
connect( fNormalizeAction, SIGNAL( changed() ), this, SLOT( normalize() ) );
|
|
|
|
|
menu->addAction(fNormalizeAction);
|
|
|
|
|
connect( fNormalizeAction.get(), SIGNAL( changed() ), this, SLOT( normalize() ) );
|
|
|
|
|
menu->addAction(fNormalizeAction.get());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
@ -1308,13 +1302,10 @@ void PmuppGui::addVar()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// call variable dialog
|
|
|
|
|
if (fVarDlg != nullptr) {
|
|
|
|
|
delete fVarDlg;
|
|
|
|
|
fVarDlg = nullptr;
|
|
|
|
|
}
|
|
|
|
|
fVarDlg = new PVarDialog(collection_list, fDarkTheme);
|
|
|
|
|
connect(fVarDlg, SIGNAL(check_request(QString,QVector<int>)), this, SLOT(check(QString,QVector<int>)));
|
|
|
|
|
connect(fVarDlg, SIGNAL(add_request(QString,QVector<int>)), this, SLOT(add(QString,QVector<int>)));
|
|
|
|
|
fVarDlg.reset();
|
|
|
|
|
fVarDlg = std::make_unique<PVarDialog>(collection_list, fDarkTheme);
|
|
|
|
|
connect(fVarDlg.get(), SIGNAL(check_request(QString,QVector<int>)), this, SLOT(check(QString,QVector<int>)));
|
|
|
|
|
connect(fVarDlg.get(), SIGNAL(add_request(QString,QVector<int>)), this, SLOT(add(QString,QVector<int>)));
|
|
|
|
|
fVarDlg->show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2235,7 +2226,7 @@ void PmuppGui::startMuppPlot()
|
|
|
|
|
// feed the mupp instance
|
|
|
|
|
arg << QString("%1").arg(fMuppInstance);
|
|
|
|
|
|
|
|
|
|
fMuppPlot = new QProcess(this);
|
|
|
|
|
fMuppPlot = std::make_unique<QProcess>(this);
|
|
|
|
|
if (fMuppPlot == nullptr) {
|
|
|
|
|
QMessageBox::critical(this, "ERROR", "Couldn't invoke QProcess for mupp_plot!");
|
|
|
|
|
return;
|
|
|
|
|