more work on smart pointer transition of musrStep.
This commit is contained in:
parent
7743eaee09
commit
3d7d86d657
@ -55,27 +55,27 @@ PModSelect::PModSelect(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
setWindowTitle("Modify Selected");
|
setWindowTitle("Modify Selected");
|
||||||
|
|
||||||
fScaleByFactor = new QPushButton("Scale by &Factor");
|
fScaleByFactor = std::make_unique<QPushButton>("Scale by &Factor");
|
||||||
fScaleByFactor->setWhatsThis("if pressed it will use the Factor value, and the absolut value selection to change the selected parameter steps.");
|
fScaleByFactor->setWhatsThis("if pressed it will use the Factor value, and the absolut value selection to change the selected parameter steps.");
|
||||||
fFactorLabel = new QLabel("Factor");
|
fFactorLabel = std::make_unique<QLabel>("Factor");
|
||||||
fFactorLineEdit = new QLineEdit("0.01");
|
fFactorLineEdit = std::make_unique<QLineEdit>("0.01");
|
||||||
fFactorLineEdit->setValidator(new QDoubleValidator);
|
fFactorLineEdit->setValidator(new QDoubleValidator);
|
||||||
fAbsVal = new QCheckBox("Absolute Value");
|
fAbsVal = std::make_unique<QCheckBox>("Absolute Value");
|
||||||
fAbsVal->setWhatsThis("if checked, the factor is used as an absolut value rather than a multiplication factor for the selected steps.");
|
fAbsVal->setWhatsThis("if checked, the factor is used as an absolut value rather than a multiplication factor for the selected steps.");
|
||||||
|
|
||||||
QHBoxLayout *top = new QHBoxLayout;
|
QHBoxLayout *top = new QHBoxLayout;
|
||||||
top->addWidget(fScaleByFactor);
|
top->addWidget(fScaleByFactor.get());
|
||||||
top->addWidget(fFactorLabel);
|
top->addWidget(fFactorLabel.get());
|
||||||
top->addWidget(fFactorLineEdit);
|
top->addWidget(fFactorLineEdit.get());
|
||||||
top->addWidget(fAbsVal);
|
top->addWidget(fAbsVal.get());
|
||||||
|
|
||||||
fScaleAutomatic = new QPushButton("Scale &Automatically");
|
fScaleAutomatic = std::make_unique<QPushButton>("Scale &Automatically");
|
||||||
fScaleAutomatic->setWhatsThis("Will try to reset the step size of the selected items based on some crude rules");
|
fScaleAutomatic->setWhatsThis("Will try to reset the step size of the selected items based on some crude rules");
|
||||||
fCancel = new QPushButton("&Cancel");
|
fCancel = std::make_unique<QPushButton>("&Cancel");
|
||||||
|
|
||||||
QHBoxLayout *bottom = new QHBoxLayout;
|
QHBoxLayout *bottom = new QHBoxLayout;
|
||||||
bottom->addWidget(fScaleAutomatic);
|
bottom->addWidget(fScaleAutomatic.get());
|
||||||
bottom->addWidget(fCancel);
|
bottom->addWidget(fCancel.get());
|
||||||
|
|
||||||
QVBoxLayout *main = new QVBoxLayout;
|
QVBoxLayout *main = new QVBoxLayout;
|
||||||
main->addLayout(top);
|
main->addLayout(top);
|
||||||
@ -83,10 +83,10 @@ PModSelect::PModSelect(QWidget *parent) :
|
|||||||
|
|
||||||
setLayout(main);
|
setLayout(main);
|
||||||
|
|
||||||
connect(fAbsVal, SIGNAL(stateChanged(int)), this, SLOT(absoluteValueStateChanged(int)));
|
connect(fAbsVal.get(), SIGNAL(stateChanged(int)), this, SLOT(absoluteValueStateChanged(int)));
|
||||||
connect(fScaleAutomatic, SIGNAL(pressed()), this, SLOT(scaleAuto()));
|
connect(fScaleAutomatic.get(), SIGNAL(pressed()), this, SLOT(scaleAuto()));
|
||||||
connect(fScaleByFactor, SIGNAL(pressed()), this, SLOT(getFactor()));
|
connect(fScaleByFactor.get(), SIGNAL(pressed()), this, SLOT(getFactor()));
|
||||||
connect(fCancel, SIGNAL(pressed()), this, SLOT(reject()));
|
connect(fCancel.get(), SIGNAL(pressed()), this, SLOT(reject()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -151,7 +151,7 @@ PMusrStep::PMusrStep(const char *fln, QWidget *parent) :
|
|||||||
fValid = false;
|
fValid = false;
|
||||||
|
|
||||||
QString title = QString("<b><font size=""14"">%1</font></b>").arg(fMsrFileName);
|
QString title = QString("<b><font size=""14"">%1</font></b>").arg(fMsrFileName);
|
||||||
fTitleLabel = new QLabel(title);
|
fTitleLabel = std::make_unique<QLabel>(title);
|
||||||
QLabel *icon = new QLabel();
|
QLabel *icon = new QLabel();
|
||||||
if (isDarkTheme)
|
if (isDarkTheme)
|
||||||
str = QString(":/icons/musrStep-32x32-dark.svg");
|
str = QString(":/icons/musrStep-32x32-dark.svg");
|
||||||
@ -160,7 +160,7 @@ PMusrStep::PMusrStep(const char *fln, QWidget *parent) :
|
|||||||
icon->setPixmap(QPixmap(str));
|
icon->setPixmap(QPixmap(str));
|
||||||
|
|
||||||
QHBoxLayout *titleLayout = new QHBoxLayout;
|
QHBoxLayout *titleLayout = new QHBoxLayout;
|
||||||
titleLayout->addWidget(fTitleLabel);
|
titleLayout->addWidget(fTitleLabel.get());
|
||||||
titleLayout->addWidget(icon);
|
titleLayout->addWidget(icon);
|
||||||
titleLayout->insertStretch(1);
|
titleLayout->insertStretch(1);
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ PMusrStep::PMusrStep(const char *fln, QWidget *parent) :
|
|||||||
setMinimumSize(400, height);
|
setMinimumSize(400, height);
|
||||||
|
|
||||||
// populate dialog
|
// populate dialog
|
||||||
fParamTable = new QTableWidget(fParamVec.size(), 3);
|
fParamTable = std::make_unique<QTableWidget>(fParamVec.size(), 3);
|
||||||
QStringList strL;
|
QStringList strL;
|
||||||
strL << "name" << "value" << "step";
|
strL << "name" << "value" << "step";
|
||||||
fParamTable->setHorizontalHeaderLabels(strL);
|
fParamTable->setHorizontalHeaderLabels(strL);
|
||||||
@ -202,54 +202,54 @@ PMusrStep::PMusrStep(const char *fln, QWidget *parent) :
|
|||||||
item = new QTableWidgetItem(fParamVec[i].step);
|
item = new QTableWidgetItem(fParamVec[i].step);
|
||||||
fParamTable->setItem(i, 2, item);
|
fParamTable->setItem(i, 2, item);
|
||||||
}
|
}
|
||||||
fCheckSpecific = new QPushButton("Check S&pecific");
|
fCheckSpecific = std::make_unique<QPushButton>("Check S&pecific");
|
||||||
fCheckSpecific->setWhatsThis("Allows to specify a template name which is used\nto select parameter names fitting to it.");
|
fCheckSpecific->setWhatsThis("Allows to specify a template name which is used\nto select parameter names fitting to it.");
|
||||||
fCheckAll = new QPushButton("Check A&ll");
|
fCheckAll = std::make_unique<QPushButton>("Check A&ll");
|
||||||
fCheckAll->setWhatsThis("Select all parameter names,\nexcept the ones with step == 0");
|
fCheckAll->setWhatsThis("Select all parameter names,\nexcept the ones with step == 0");
|
||||||
fUnCheckAll = new QPushButton("&Uncheck All");
|
fUnCheckAll = std::make_unique<QPushButton>("&Uncheck All");
|
||||||
fUnCheckAll->setWhatsThis("Unselect all parameter names");
|
fUnCheckAll->setWhatsThis("Unselect all parameter names");
|
||||||
|
|
||||||
QHBoxLayout *checkLayout = new QHBoxLayout;
|
QHBoxLayout *checkLayout = new QHBoxLayout;
|
||||||
checkLayout->addWidget(fCheckSpecific);
|
checkLayout->addWidget(fCheckSpecific.get());
|
||||||
checkLayout->addWidget(fCheckAll);
|
checkLayout->addWidget(fCheckAll.get());
|
||||||
checkLayout->addWidget(fUnCheckAll);
|
checkLayout->addWidget(fUnCheckAll.get());
|
||||||
|
|
||||||
fModifyAuto = new QPushButton("Modify &Automatic");
|
fModifyAuto = std::make_unique<QPushButton>("Modify &Automatic");
|
||||||
fModifyAuto->setWhatsThis("Will try to reset the step size,\nbased on some crude rules");
|
fModifyAuto->setWhatsThis("Will try to reset the step size,\nbased on some crude rules");
|
||||||
fModifyAuto->setDefault(true);
|
fModifyAuto->setDefault(true);
|
||||||
fModifySelected = new QPushButton("&Modify Selected");
|
fModifySelected = std::make_unique<QPushButton>("&Modify Selected");
|
||||||
fModifySelected->setWhatsThis("Will call a dialog which all to specify how\nto proceed with the selected parameter steps.");
|
fModifySelected->setWhatsThis("Will call a dialog which all to specify how\nto proceed with the selected parameter steps.");
|
||||||
|
|
||||||
QHBoxLayout *modifyLayout = new QHBoxLayout;
|
QHBoxLayout *modifyLayout = new QHBoxLayout;
|
||||||
modifyLayout->addWidget(fModifyAuto);
|
modifyLayout->addWidget(fModifyAuto.get());
|
||||||
modifyLayout->addWidget(fModifySelected);
|
modifyLayout->addWidget(fModifySelected.get());
|
||||||
|
|
||||||
fSave = new QPushButton("&Save&&Quit");
|
fSave = std::make_unique<QPushButton>("&Save&&Quit");
|
||||||
fCancel = new QPushButton("&Cancel");
|
fCancel = std::make_unique<QPushButton>("&Cancel");
|
||||||
|
|
||||||
QHBoxLayout *buttomLayout = new QHBoxLayout;
|
QHBoxLayout *buttomLayout = new QHBoxLayout;
|
||||||
buttomLayout->addWidget(fSave);
|
buttomLayout->addWidget(fSave.get());
|
||||||
buttomLayout->addWidget(fCancel);
|
buttomLayout->addWidget(fCancel.get());
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
mainLayout->addLayout(titleLayout);
|
mainLayout->addLayout(titleLayout);
|
||||||
mainLayout->addWidget(fParamTable);
|
mainLayout->addWidget(fParamTable.get());
|
||||||
mainLayout->addLayout(checkLayout);
|
mainLayout->addLayout(checkLayout);
|
||||||
mainLayout->addLayout(modifyLayout);
|
mainLayout->addLayout(modifyLayout);
|
||||||
mainLayout->addLayout(buttomLayout);
|
mainLayout->addLayout(buttomLayout);
|
||||||
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
connect(fParamTable, SIGNAL(cellChanged(int, int)), this, SLOT(handleCellChanged(int, int)));
|
connect(fParamTable.get(), SIGNAL(cellChanged(int, int)), this, SLOT(handleCellChanged(int, int)));
|
||||||
|
|
||||||
connect(fCheckSpecific, SIGNAL(pressed()), this, SLOT(checkSpecific()));
|
connect(fCheckSpecific.get(), SIGNAL(pressed()), this, SLOT(checkSpecific()));
|
||||||
connect(fCheckAll, SIGNAL(pressed()), this, SLOT(checkAll()));
|
connect(fCheckAll.get(), SIGNAL(pressed()), this, SLOT(checkAll()));
|
||||||
connect(fUnCheckAll, SIGNAL(pressed()), this, SLOT(unCheckAll()));
|
connect(fUnCheckAll.get(), SIGNAL(pressed()), this, SLOT(unCheckAll()));
|
||||||
|
|
||||||
connect(fModifyAuto, SIGNAL(pressed()), this, SLOT(modifyAuto()));
|
connect(fModifyAuto.get(), SIGNAL(pressed()), this, SLOT(modifyAuto()));
|
||||||
connect(fModifySelected, SIGNAL(pressed()), this, SLOT(modifyChecked()));
|
connect(fModifySelected.get(), SIGNAL(pressed()), this, SLOT(modifyChecked()));
|
||||||
connect(fSave, SIGNAL(pressed()), this, SLOT(saveAndQuit()));
|
connect(fSave.get(), SIGNAL(pressed()), this, SLOT(saveAndQuit()));
|
||||||
connect(fCancel, SIGNAL(pressed()), this, SLOT(reject()));
|
connect(fCancel.get(), SIGNAL(pressed()), this, SLOT(reject()));
|
||||||
|
|
||||||
fModSelect = new PModSelect(this);
|
fModSelect = new PModSelect(this);
|
||||||
connect(fModSelect, SIGNAL(scale(bool,double,bool)), this, SLOT(handleModSelect(bool,double,bool)));
|
connect(fModSelect, SIGNAL(scale(bool,double,bool)), this, SLOT(handleModSelect(bool,double,bool)));
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
#ifndef _PMUSRSTEP_H_
|
#ifndef _PMUSRSTEP_H_
|
||||||
#define _PMUSRSTEP_H_
|
#define _PMUSRSTEP_H_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
@ -37,6 +39,7 @@
|
|||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QLineEdit>
|
||||||
|
|
||||||
struct PParam {
|
struct PParam {
|
||||||
QString number;
|
QString number;
|
||||||
@ -65,12 +68,12 @@ class PModSelect : public QDialog
|
|||||||
void getFactor();
|
void getFactor();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QCheckBox *fAbsVal;
|
std::unique_ptr<QCheckBox> fAbsVal;
|
||||||
QLabel *fFactorLabel;
|
std::unique_ptr<QLabel> fFactorLabel;
|
||||||
QLineEdit *fFactorLineEdit;
|
std::unique_ptr<QLineEdit> fFactorLineEdit;
|
||||||
QPushButton *fScaleByFactor;
|
std::unique_ptr<QPushButton> fScaleByFactor;
|
||||||
QPushButton *fScaleAutomatic;
|
std::unique_ptr<QPushButton> fScaleAutomatic;
|
||||||
QPushButton *fCancel;
|
std::unique_ptr<QPushButton> fCancel;
|
||||||
};
|
};
|
||||||
|
|
||||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
@ -98,15 +101,15 @@ class PMusrStep : public QDialog
|
|||||||
|
|
||||||
QVector<PParam> fParamVec;
|
QVector<PParam> fParamVec;
|
||||||
|
|
||||||
QLabel *fTitleLabel;
|
std::unique_ptr<QLabel> fTitleLabel;
|
||||||
QTableWidget *fParamTable;
|
std::unique_ptr<QTableWidget> fParamTable;
|
||||||
QPushButton *fCheckSpecific;
|
std::unique_ptr<QPushButton> fCheckSpecific;
|
||||||
QPushButton *fCheckAll;
|
std::unique_ptr<QPushButton> fCheckAll;
|
||||||
QPushButton *fUnCheckAll;
|
std::unique_ptr<QPushButton> fUnCheckAll;
|
||||||
QPushButton *fModifyAuto;
|
std::unique_ptr<QPushButton> fModifyAuto;
|
||||||
QPushButton *fModifySelected;
|
std::unique_ptr<QPushButton> fModifySelected;
|
||||||
QPushButton *fSave;
|
std::unique_ptr<QPushButton> fSave;
|
||||||
QPushButton *fCancel;
|
std::unique_ptr<QPushButton> fCancel;
|
||||||
|
|
||||||
PModSelect *fModSelect;
|
PModSelect *fModSelect;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user