Raw -> Smart Pointers for musredit qt5.
This commit is contained in:
parent
afbe8a8ee6
commit
4d516d659d
@ -36,7 +36,7 @@
|
||||
#include <QPixmap>
|
||||
#include <QXmlStreamReader>
|
||||
|
||||
#include <musredit.h>
|
||||
#include "musredit.h"
|
||||
|
||||
class PAdmin;
|
||||
|
||||
@ -208,8 +208,8 @@ class PAdmin : public QObject
|
||||
bool fEnableMusrT0; ///< flag indicating if musrT0 shall be enabled at startup from within musredit (default: yes).
|
||||
bool fDarkThemeIconsMenu; ///< flag indicating if dark theme icons shall be used in the menu (default: no)
|
||||
bool fDarkThemeIconsToolbar; ///< flag indicating if dark theme icons shall be used in the toolbar (default: no)
|
||||
int fEditWidth; ///< startup edit width
|
||||
int fEditHeight; ///< startup edit height
|
||||
int fEditWidth{900}; ///< startup edit width
|
||||
int fEditHeight{800}; ///< startup edit height
|
||||
|
||||
QString fBeamline; ///< name of the beamline. Used to generate default run header lines.
|
||||
QString fInstitute; ///< name of the institute. Used to generate default run header lines.
|
||||
|
@ -92,7 +92,7 @@ bool PDefaultPathsXMLParser::parse(QIODevice *device)
|
||||
if (fXml.hasError()) {
|
||||
QString msg;
|
||||
msg = QString("%1 Line %2, column %3").arg(fXml.errorString()).arg(fXml.lineNumber()).arg(fXml.columnNumber());
|
||||
QMessageBox::critical(0, "**ERROR**", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
QMessageBox::critical(nullptr, "**ERROR**", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ PDefaultPaths::PDefaultPaths() : QObject()
|
||||
PDefaultPathsXMLParser handler(fPrefPathName, this);
|
||||
if (!handler.isValid()) {
|
||||
fValid = false;
|
||||
QMessageBox::critical(0, "ERROR",
|
||||
QMessageBox::critical(nullptr, "ERROR",
|
||||
"Error parsing musrfit_startup.xml settings file.\nProbably a few things will not work porperly.\nPlease fix this first.",
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
return;
|
||||
@ -219,8 +219,7 @@ PDefaultPaths::PDefaultPaths() : QObject()
|
||||
*/
|
||||
PChangeDefaultPathsDialog::PChangeDefaultPathsDialog()
|
||||
{
|
||||
fDefaultPath = 0;
|
||||
fDefaultPath = new PDefaultPaths();
|
||||
fDefaultPath = std::make_unique<PDefaultPaths>();
|
||||
if (!fDefaultPath->isValid())
|
||||
return;
|
||||
|
||||
|
@ -30,6 +30,8 @@
|
||||
#ifndef _PCHANGEDEFAULTPATHSDIALOG_H_
|
||||
#define _PCHANGEDEFAULTPATHSDIALOG_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QXmlStreamReader>
|
||||
@ -98,7 +100,7 @@ class PChangeDefaultPathsDialog : public QDialog, private Ui::PChangeDefaultPath
|
||||
void saveDefaultPathList();
|
||||
|
||||
private:
|
||||
PDefaultPaths *fDefaultPath;
|
||||
std::unique_ptr<PDefaultPaths> fDefaultPath;
|
||||
};
|
||||
|
||||
#endif // _PCHANGEDEFAULTPATHSDIALOG_H_
|
||||
|
@ -45,20 +45,20 @@ PDumpOutputHandler::PDumpOutputHandler(QVector<QString> &cmd)
|
||||
return;
|
||||
|
||||
// Layout
|
||||
fVbox = new QVBoxLayout( this );
|
||||
fOutput = new QTextEdit();
|
||||
fVbox->addWidget(fOutput);
|
||||
fVbox = std::make_unique<QVBoxLayout>( this );
|
||||
fOutput = std::make_unique<QTextEdit>();
|
||||
fVbox->addWidget(fOutput.get());
|
||||
fOutput->setMinimumSize(600, 755);
|
||||
fOutput->setReadOnly(true);
|
||||
connect( fOutput, SIGNAL( destroyed() ), this, SLOT( quitButtonPressed() ) );
|
||||
fQuitButton = new QPushButton( tr("Quit") );
|
||||
fVbox->addWidget(fQuitButton);
|
||||
connect( fQuitButton, SIGNAL( clicked() ), this, SLOT( quitButtonPressed() ) );
|
||||
connect( fOutput.get(), SIGNAL( destroyed() ), this, SLOT( quitButtonPressed() ) );
|
||||
fQuitButton = std::make_unique<QPushButton>( tr("Quit") );
|
||||
fVbox->addWidget(fQuitButton.get());
|
||||
connect( fQuitButton.get(), SIGNAL( clicked() ), this, SLOT( quitButtonPressed() ) );
|
||||
resize( 600, 800 );
|
||||
fQuitButton->setFocus();
|
||||
|
||||
// QProcess related code
|
||||
fProc = new QProcess( this );
|
||||
fProc = std::make_unique<QProcess>( this );
|
||||
|
||||
// make sure that the system environment variables are properly set
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
@ -75,15 +75,15 @@ PDumpOutputHandler::PDumpOutputHandler(QVector<QString> &cmd)
|
||||
for (int i=1; i<cmd.size(); i++)
|
||||
arguments << cmd[i];
|
||||
|
||||
connect( fProc, SIGNAL( readyReadStandardOutput() ), this, SLOT( readFromStdOut() ) );
|
||||
connect( fProc, SIGNAL( readyReadStandardError() ), this, SLOT( readFromStdErr() ) );
|
||||
connect( fProc.get(), SIGNAL( readyReadStandardOutput() ), this, SLOT( readFromStdOut() ) );
|
||||
connect( fProc.get(), SIGNAL( readyReadStandardError() ), this, SLOT( readFromStdErr() ) );
|
||||
|
||||
|
||||
fProc->start(program, arguments);
|
||||
if ( !fProc->waitForStarted() ) {
|
||||
// error handling
|
||||
QString msg(tr("Could not execute the output command: ")+cmd[0]);
|
||||
QMessageBox::critical( 0,
|
||||
QMessageBox::critical( nullptr,
|
||||
tr("Fatal error"),
|
||||
msg,
|
||||
tr("Quit") );
|
||||
@ -132,10 +132,6 @@ PDumpOutputHandler::~PDumpOutputHandler()
|
||||
|
||||
}
|
||||
}
|
||||
if (fProc) {
|
||||
delete fProc;
|
||||
fProc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
@ -30,6 +30,9 @@
|
||||
#ifndef _PDUMPOUTPUTHANDLER_H_
|
||||
#define _PDUMPOUTPUTHANDLER_H_
|
||||
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
#include <QDialog>
|
||||
@ -39,8 +42,6 @@
|
||||
#include <QMessageBox>
|
||||
#include <QVector>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>This class is the capturing the output of musrfit and displays it in a dialog so
|
||||
@ -62,11 +63,11 @@ class PDumpOutputHandler : public QDialog
|
||||
|
||||
private:
|
||||
Q_PID fProcPID; ///< keeps the process PID
|
||||
QProcess *fProc; ///< pointer to the dump_header process
|
||||
std::unique_ptr<QProcess> fProc; ///< pointer to the dump_header process
|
||||
|
||||
QVBoxLayout *fVbox; ///< pointer to the dialog layout manager
|
||||
QTextEdit *fOutput; ///< the captured dump_header output is written (read only) into this text edit object.
|
||||
QPushButton *fQuitButton; ///< quit button
|
||||
std::unique_ptr<QVBoxLayout> fVbox; ///< pointer to the dialog layout manager
|
||||
std::unique_ptr<QTextEdit> fOutput; ///< the captured dump_header output is written (read only) into this text edit object.
|
||||
std::unique_ptr<QPushButton> fQuitButton; ///< quit button
|
||||
};
|
||||
|
||||
#endif // _PDUMPOUTPUTHANDLER_H_
|
||||
|
@ -46,22 +46,21 @@ PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QVector<QString>
|
||||
return;
|
||||
|
||||
// Layout
|
||||
fVbox = new QVBoxLayout( this );
|
||||
//Qt.3x fVbox->resize(800, 500);
|
||||
fOutput = new QPlainTextEdit();
|
||||
fVbox = std::make_unique<QVBoxLayout>( this );
|
||||
fOutput = std::make_unique<QPlainTextEdit>();
|
||||
fOutput->setMaximumBlockCount(1000);
|
||||
fVbox->addWidget(fOutput);
|
||||
fVbox->addWidget(fOutput.get());
|
||||
fOutput->setMinimumSize(800, 455);
|
||||
fOutput->setReadOnly(true);
|
||||
connect( fOutput, SIGNAL( destroyed() ), this, SLOT( quitButtonPressed() ) );
|
||||
fQuitButton = new QPushButton( tr("Fitting...") );
|
||||
fVbox->addWidget(fQuitButton);
|
||||
connect( fQuitButton, SIGNAL( clicked() ), this, SLOT( quitButtonPressed() ) );
|
||||
connect( fOutput.get(), SIGNAL( destroyed() ), this, SLOT( quitButtonPressed() ) );
|
||||
fQuitButton = std::make_unique<QPushButton>( tr("Fitting...") );
|
||||
fVbox->addWidget(fQuitButton.get());
|
||||
connect( fQuitButton.get(), SIGNAL( clicked() ), this, SLOT( quitButtonPressed() ) );
|
||||
resize( 800, 500 );
|
||||
fQuitButton->setFocus();
|
||||
|
||||
// QProcess related code
|
||||
fProc = new QProcess( this );
|
||||
fProc = std::make_unique<QProcess>( this );
|
||||
|
||||
// make sure that the system environment variables are properly set
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
@ -83,9 +82,9 @@ PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QVector<QString>
|
||||
for (int i=1; i<cmd.size(); i++)
|
||||
arguments << cmd[i];
|
||||
|
||||
connect( fProc, SIGNAL( readyReadStandardOutput() ), this, SLOT( readFromStdOut() ) );
|
||||
connect( fProc, SIGNAL( readyReadStandardError() ), this, SLOT( readFromStdErr() ) );
|
||||
connect( fProc, SIGNAL( finished(int, QProcess::ExitStatus) ), this, SLOT( processDone(int, QProcess::ExitStatus) ) );
|
||||
connect( fProc.get(), SIGNAL( readyReadStandardOutput() ), this, SLOT( readFromStdOut() ) );
|
||||
connect( fProc.get(), SIGNAL( readyReadStandardError() ), this, SLOT( readFromStdErr() ) );
|
||||
connect( fProc.get(), SIGNAL( finished(int, QProcess::ExitStatus) ), this, SLOT( processDone(int, QProcess::ExitStatus) ) );
|
||||
|
||||
fProc->start(program, arguments);
|
||||
if ( !fProc->waitForStarted() ) {
|
||||
@ -138,10 +137,6 @@ PFitOutputHandler::~PFitOutputHandler()
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (fProc) {
|
||||
delete fProc;
|
||||
fProc = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
@ -30,6 +30,9 @@
|
||||
#ifndef _PFITOUTPUTHANDLER_H_
|
||||
#define _PFITOUTPUTHANDLER_H_
|
||||
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
#include <QDialog>
|
||||
@ -39,8 +42,6 @@
|
||||
#include <QMessageBox>
|
||||
#include <QVector>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>This class is the capturing the output of musrfit and displays it in a dialog so
|
||||
@ -63,11 +64,11 @@ class PFitOutputHandler : public QDialog
|
||||
|
||||
private:
|
||||
Q_PID fProcPID; ///< keeps the process PID
|
||||
QProcess *fProc; ///< pointer to the musrfit process
|
||||
std::unique_ptr<QProcess> fProc; ///< pointer to the musrfit process
|
||||
|
||||
QVBoxLayout *fVbox; ///< pointer to the dialog layout manager
|
||||
QPlainTextEdit *fOutput; ///< the captured musrfit output is written (read only) into this text edit object.
|
||||
QPushButton *fQuitButton; ///< quit button, either to interrupt the fit or to close the dialog at the end of the fit.
|
||||
std::unique_ptr<QVBoxLayout> fVbox; ///< pointer to the dialog layout manager
|
||||
std::unique_ptr<QPlainTextEdit> fOutput; ///< the captured musrfit output is written (read only) into this text edit object.
|
||||
std::unique_ptr<QPushButton> fQuitButton; ///< quit button, either to interrupt the fit or to close the dialog at the end of the fit.
|
||||
};
|
||||
|
||||
#endif // _PFITOUTPUTHANDLER_H_
|
||||
|
@ -91,7 +91,7 @@ PTextEdit::PTextEdit( QWidget *parent )
|
||||
bool gotTheme = getTheme();
|
||||
|
||||
// reads and manages the conents of the xml-startup (musredit_startup.xml) file
|
||||
fAdmin = new PAdmin();
|
||||
fAdmin = std::make_unique<PAdmin>();
|
||||
|
||||
// set default setting of the fDarkMenuIconIcons only if a theme has been recognized, otherwise take the
|
||||
// one from the xml startup file.
|
||||
@ -109,16 +109,14 @@ PTextEdit::PTextEdit( QWidget *parent )
|
||||
|
||||
// enable file system watcher. Needed to get notification if the msr-file is changed outside of musrfit at runtime
|
||||
fFileSystemWatcherActive = true;
|
||||
fFileSystemWatcher = new QFileSystemWatcher();
|
||||
fFileSystemWatcher = std::make_unique<QFileSystemWatcher>();
|
||||
if (fFileSystemWatcher == nullptr) {
|
||||
QMessageBox::information(this, "**ERROR**", "Couldn't invoke QFileSystemWatcher!");
|
||||
} else {
|
||||
connect( fFileSystemWatcher, SIGNAL(fileChanged(const QString&)), this, SLOT(fileChanged(const QString&)));
|
||||
connect( fFileSystemWatcher.get(), SIGNAL(fileChanged(const QString&)), this, SLOT(fileChanged(const QString&)));
|
||||
}
|
||||
|
||||
// initialize stuff
|
||||
fMusrT0Action = nullptr;
|
||||
|
||||
fMsr2DataParam = nullptr;
|
||||
fFindReplaceData = nullptr;
|
||||
|
||||
@ -129,9 +127,9 @@ PTextEdit::PTextEdit( QWidget *parent )
|
||||
setupMusrActions();
|
||||
setupHelpActions();
|
||||
|
||||
fTabWidget = new QTabWidget( this );
|
||||
fTabWidget = std::make_unique<QTabWidget>( this );
|
||||
fTabWidget->setMovable(true); // allows to shuffle around tabs
|
||||
setCentralWidget( fTabWidget );
|
||||
setCentralWidget( fTabWidget.get() );
|
||||
|
||||
textFamily(fAdmin->getFontName());
|
||||
textSize(QString("%1").arg(fAdmin->getFontSize()));
|
||||
@ -152,7 +150,7 @@ PTextEdit::PTextEdit( QWidget *parent )
|
||||
fileNew();
|
||||
}
|
||||
|
||||
connect( fTabWidget, SIGNAL( currentChanged(int) ), this, SLOT( applyFontSettings(int) ));
|
||||
connect( fTabWidget.get(), SIGNAL( currentChanged(int) ), this, SLOT( applyFontSettings(int) ));
|
||||
|
||||
fLastDirInUse = fAdmin->getDefaultSavePath();
|
||||
}
|
||||
@ -164,14 +162,6 @@ PTextEdit::PTextEdit( QWidget *parent )
|
||||
*/
|
||||
void PTextEdit::aboutToQuit()
|
||||
{
|
||||
if (fAdmin) {
|
||||
delete fAdmin;
|
||||
fAdmin = nullptr;
|
||||
}
|
||||
if (fMusrT0Action) {
|
||||
delete fMusrT0Action;
|
||||
fMusrT0Action = nullptr;
|
||||
}
|
||||
if (fMsr2DataParam) {
|
||||
delete fMsr2DataParam;
|
||||
fMsr2DataParam = nullptr;
|
||||
@ -650,33 +640,33 @@ void PTextEdit::setupTextActions()
|
||||
tb->setWindowTitle( "Format Actions" );
|
||||
addToolBar( tb );
|
||||
|
||||
fComboFont = new QComboBox();
|
||||
fComboFont = std::make_unique<QComboBox>();
|
||||
fComboFont->setEditable(true);
|
||||
QFontDatabase db;
|
||||
fComboFont->addItems( db.families() );
|
||||
connect( fComboFont, SIGNAL( activated( const QString & ) ),
|
||||
connect( fComboFont.get(), SIGNAL( activated( const QString & ) ),
|
||||
this, SLOT( textFamily( const QString & ) ) );
|
||||
QLineEdit *edit = fComboFont->lineEdit();
|
||||
if (edit == nullptr) {
|
||||
return;
|
||||
}
|
||||
edit->setText( fAdmin->getFontName() );
|
||||
tb->addWidget(fComboFont);
|
||||
tb->addWidget(fComboFont.get());
|
||||
|
||||
fComboSize = new QComboBox( tb );
|
||||
fComboSize = std::make_unique<QComboBox>( tb );
|
||||
fComboSize->setEditable(true);
|
||||
QList<int> sizes = db.standardSizes();
|
||||
QList<int>::Iterator it = sizes.begin();
|
||||
for ( ; it != sizes.end(); ++it )
|
||||
fComboSize->addItem( QString::number( *it ) );
|
||||
connect( fComboSize, SIGNAL( activated( const QString & ) ),
|
||||
connect( fComboSize.get(), SIGNAL( activated( const QString & ) ),
|
||||
this, SLOT( textSize( const QString & ) ) );
|
||||
edit = fComboSize->lineEdit();
|
||||
if (edit == nullptr) {
|
||||
return;
|
||||
}
|
||||
edit->setText( QString("%1").arg(fAdmin->getFontSize()) );
|
||||
tb->addWidget(fComboSize);
|
||||
tb->addWidget(fComboSize.get());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -868,19 +858,19 @@ void PTextEdit::setupMusrActions()
|
||||
iconName = QString(":/icons/musrt0-dark.svg");
|
||||
else
|
||||
iconName = QString(":/icons/musrt0-plain.svg");
|
||||
fMusrT0Action = new QAction( QIcon( QPixmap(iconName) ), tr( "&T0" ), this );
|
||||
fMusrT0Action = std::make_unique<QAction>( QIcon( QPixmap(iconName) ), tr( "&T0" ), this );
|
||||
fMusrT0Action->setStatusTip( tr("Start musrt0") );
|
||||
connect( fMusrT0Action, SIGNAL( triggered() ), this, SLOT( musrT0() ) );
|
||||
menu->addAction(fMusrT0Action);
|
||||
fActions["musrt0"] = fMusrT0Action;
|
||||
connect( fMusrT0Action.get(), SIGNAL( triggered() ), this, SLOT( musrT0() ) );
|
||||
menu->addAction(fMusrT0Action.get());
|
||||
fActions["musrt0"] = fMusrT0Action.get();
|
||||
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||
iconName = QString(":/icons/musrt0-plain.svg");
|
||||
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&T0" ), this );
|
||||
connect( a, SIGNAL( triggered() ), this, SLOT( musrT0() ) );
|
||||
}
|
||||
tb->addAction(fMusrT0Action);
|
||||
tb->addAction(fMusrT0Action.get());
|
||||
fMusrT0Action->setEnabled(fAdmin->getEnableMusrT0Flag());
|
||||
fActions["musrt0-tb"] = fMusrT0Action;
|
||||
fActions["musrt0-tb"] = fMusrT0Action.get();
|
||||
|
||||
// musrFT
|
||||
if (fDarkMenuIcon)
|
||||
@ -982,7 +972,7 @@ void PTextEdit::load( const QString &f, const int index )
|
||||
return;
|
||||
|
||||
// create a new text edit object
|
||||
PSubTextEdit *edit = new PSubTextEdit( fAdmin );
|
||||
PSubTextEdit *edit = new PSubTextEdit( fAdmin.get() );
|
||||
edit->setFont(QFont(fAdmin->getFontName(), fAdmin->getFontSize()));
|
||||
|
||||
// place the text edit object at the appropriate tab position
|
||||
@ -1022,6 +1012,9 @@ void PTextEdit::load( const QString &f, const int index )
|
||||
*/
|
||||
PSubTextEdit *PTextEdit::currentEditor() const
|
||||
{
|
||||
if (fTabWidget == nullptr)
|
||||
return nullptr;
|
||||
|
||||
if ( fTabWidget->currentWidget() ) {
|
||||
if (fTabWidget->currentWidget()->inherits( "PSubTextEdit" )) {
|
||||
return dynamic_cast<PSubTextEdit*>(fTabWidget->currentWidget());
|
||||
@ -1163,7 +1156,7 @@ void PTextEdit::insertStatisticBlock()
|
||||
*/
|
||||
void PTextEdit::fileNew()
|
||||
{
|
||||
PSubTextEdit *edit = new PSubTextEdit( fAdmin );
|
||||
PSubTextEdit *edit = new PSubTextEdit( fAdmin.get() );
|
||||
edit->setFont(QFont(fAdmin->getFontName(), fAdmin->getFontSize()));
|
||||
doConnections( edit );
|
||||
fTabWidget->addTab( edit, tr( "noname" ) );
|
||||
@ -2727,7 +2720,7 @@ void PTextEdit::musrFT()
|
||||
*/
|
||||
void PTextEdit::musrPrefs()
|
||||
{
|
||||
PPrefsDialog *dlg = new PPrefsDialog(fAdmin);
|
||||
PPrefsDialog *dlg = new PPrefsDialog(fAdmin.get());
|
||||
|
||||
if (dlg == nullptr) {
|
||||
QMessageBox::critical(this, "**ERROR** musrPrefs", "Couldn't invoke Preferences Dialog.");
|
||||
|
@ -30,6 +30,9 @@
|
||||
#ifndef _PTEXTEDIT_H_
|
||||
#define _PTEXTEDIT_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QAction>
|
||||
#include <QMainWindow>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
@ -40,10 +43,12 @@
|
||||
#include <QProcess>
|
||||
#include <QFileInfo>
|
||||
#include <QByteArray>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QComboBox>
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
|
||||
#include "PAdmin.h"
|
||||
#include "musredit.h"
|
||||
|
||||
class PSubTextEdit;
|
||||
@ -65,7 +70,6 @@ class PTextEdit : public QMainWindow
|
||||
|
||||
public:
|
||||
PTextEdit( QWidget *parent = nullptr );
|
||||
virtual ~PTextEdit() {}
|
||||
|
||||
int getEditW() { return fEditW; }
|
||||
int getEditH() { return fEditH; }
|
||||
@ -167,8 +171,8 @@ private slots:
|
||||
private:
|
||||
bool fDarkMenuIcon; ///< flag indicating if a dark or plain icon shall be used in the menu pull-downs
|
||||
bool fDarkToolBarIcon; ///< flag indicating if a dark or plain icon shall be used in the toolbar
|
||||
PAdmin *fAdmin; ///< pointer to the xml-startup file informations. Needed for different purposes like default working- and executable directories etc.
|
||||
QFileSystemWatcher *fFileSystemWatcher; ///< checks if msr-files are changing on the disk while being open in musredit.
|
||||
std::unique_ptr<PAdmin> fAdmin; ///< pointer to the xml-startup file informations. Needed for different purposes like default working- and executable directories etc.
|
||||
std::unique_ptr<QFileSystemWatcher> fFileSystemWatcher; ///< checks if msr-files are changing on the disk while being open in musredit.
|
||||
bool fFileSystemWatcherActive; ///< flag to enable/disable the file system watcher
|
||||
QTimer fFileSystemWatcherTimeout; ///< timer used to re-enable file system watcher. Needed to delay the re-enabling
|
||||
QString fLastDirInUse; ///< string holding the path from where the last file was loaded.
|
||||
@ -176,16 +180,16 @@ private:
|
||||
int fEditW, fEditH;
|
||||
|
||||
QMap<QString, QAction*> fActions;
|
||||
QAction *fMusrT0Action;
|
||||
std::unique_ptr<QAction> fMusrT0Action;
|
||||
|
||||
PMsr2DataParam *fMsr2DataParam; ///< structure holding the necessary input information for msr2data
|
||||
PFindReplaceData *fFindReplaceData; ///< structure holding the ncessary input for find/replace
|
||||
|
||||
QComboBox *fComboFont; ///< combo box for the font selector
|
||||
QComboBox *fComboSize; ///< combo box for the font size
|
||||
std::unique_ptr<QComboBox> fComboFont; ///< combo box for the font selector
|
||||
std::unique_ptr<QComboBox> fComboSize; ///< combo box for the font size
|
||||
bool fFontChanging; ///< flag needed to prevent some textChanged feature to occure when only the font changed
|
||||
|
||||
QTabWidget *fTabWidget; ///< tab widget in which the text editor(s) are placed
|
||||
std::unique_ptr<QTabWidget> fTabWidget; ///< tab widget in which the text editor(s) are placed
|
||||
QMap<PSubTextEdit*, QString> fFilenames; ///< mapper between tab widget object and filename
|
||||
|
||||
QMenu *fRecentFilesMenu; ///< recent file menu
|
||||
|
@ -28,6 +28,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
@ -67,12 +68,12 @@ int main( int argc, char ** argv )
|
||||
|
||||
QApplication a( argc, argv );
|
||||
|
||||
PTextEdit *mw = new PTextEdit();
|
||||
std::unique_ptr<PTextEdit> mw = std::make_unique<PTextEdit>();
|
||||
mw->setWindowTitle( "MusrFit Editor" );
|
||||
mw->resize( mw->getEditW(), mw->getEditH() );
|
||||
mw->show();
|
||||
|
||||
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
|
||||
a.connect( &a, SIGNAL( aboutToQuit() ), mw, SLOT( aboutToQuit() ) );
|
||||
a.connect( &a, SIGNAL( aboutToQuit() ), mw.get(), SLOT( aboutToQuit() ) );
|
||||
return a.exec();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user