more work on smart pointer transition of PTextEdit.
This commit is contained in:
parent
1117ad9732
commit
b88c18e7d9
@ -109,11 +109,11 @@ PTextEdit::PTextEdit( QWidget *parent )
|
|||||||
|
|
||||||
// enable file system watcher. Needed to get notification if the msr-file is changed outside of musrfit at runtime
|
// enable file system watcher. Needed to get notification if the msr-file is changed outside of musrfit at runtime
|
||||||
fFileSystemWatcherActive = true;
|
fFileSystemWatcherActive = true;
|
||||||
fFileSystemWatcher = new QFileSystemWatcher();
|
fFileSystemWatcher = std::make_unique<QFileSystemWatcher>();
|
||||||
if (fFileSystemWatcher == nullptr) {
|
if (fFileSystemWatcher == nullptr) {
|
||||||
QMessageBox::information(this, "ERROR", "Couldn't invoke QFileSystemWatcher!");
|
QMessageBox::information(this, "ERROR", "Couldn't invoke QFileSystemWatcher!");
|
||||||
} else {
|
} 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
|
// initialize stuff
|
||||||
@ -648,32 +648,32 @@ void PTextEdit::setupTextActions()
|
|||||||
tb->setWindowTitle( "Format Actions" );
|
tb->setWindowTitle( "Format Actions" );
|
||||||
addToolBar( tb );
|
addToolBar( tb );
|
||||||
|
|
||||||
fComboFont = new QComboBox();
|
fComboFont = std::make_unique<QComboBox>();
|
||||||
fComboFont->setEditable(true);
|
fComboFont->setEditable(true);
|
||||||
fComboFont->addItems( QFontDatabase::families() );
|
fComboFont->addItems( QFontDatabase::families() );
|
||||||
connect( fComboFont, SIGNAL( currentTextChanged( const QString & ) ),
|
connect( fComboFont.get(), SIGNAL( currentTextChanged( const QString & ) ),
|
||||||
this, SLOT( textFamily( const QString & ) ) );
|
this, SLOT( textFamily( const QString & ) ) );
|
||||||
QLineEdit *edit = fComboFont->lineEdit();
|
QLineEdit *edit = fComboFont->lineEdit();
|
||||||
if (edit == nullptr) {
|
if (edit == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
edit->setText( fAdmin->getFontName() );
|
edit->setText( fAdmin->getFontName() );
|
||||||
tb->addWidget(fComboFont);
|
tb->addWidget(fComboFont.get());
|
||||||
|
|
||||||
fComboSize = new QComboBox( tb );
|
fComboSize = std::make_unique<QComboBox>( tb );
|
||||||
fComboSize->setEditable(true);
|
fComboSize->setEditable(true);
|
||||||
QList<int> sizes = QFontDatabase::standardSizes();
|
QList<int> sizes = QFontDatabase::standardSizes();
|
||||||
QList<int>::Iterator it = sizes.begin();
|
QList<int>::Iterator it = sizes.begin();
|
||||||
for ( ; it != sizes.end(); ++it )
|
for ( ; it != sizes.end(); ++it )
|
||||||
fComboSize->addItem( QString::number( *it ) );
|
fComboSize->addItem( QString::number( *it ) );
|
||||||
connect( fComboSize, SIGNAL( currentTextChanged( const QString & ) ),
|
connect( fComboSize.get(), SIGNAL( currentTextChanged( const QString & ) ),
|
||||||
this, SLOT( textSize( const QString & ) ) );
|
this, SLOT( textSize( const QString & ) ) );
|
||||||
edit = fComboSize->lineEdit();
|
edit = fComboSize->lineEdit();
|
||||||
if (edit == nullptr) {
|
if (edit == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
edit->setText( QString("%1").arg(fAdmin->getFontSize()) );
|
edit->setText( QString("%1").arg(fAdmin->getFontSize()) );
|
||||||
tb->addWidget(fComboSize);
|
tb->addWidget(fComboSize.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
#include <QFileSystemWatcher>
|
||||||
|
#include <QComboBox>
|
||||||
|
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
@ -170,7 +172,7 @@ private:
|
|||||||
bool fDarkMenuIcon; ///< flag indicating if a dark or plain icon shall be used in the menu pull-downs
|
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
|
bool fDarkToolBarIcon; ///< flag indicating if a dark or plain icon shall be used in the toolbar
|
||||||
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<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<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
|
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
|
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.
|
QString fLastDirInUse; ///< string holding the path from where the last file was loaded.
|
||||||
@ -183,8 +185,8 @@ private:
|
|||||||
PMsr2DataParam *fMsr2DataParam; ///< structure holding the necessary input information for msr2data
|
PMsr2DataParam *fMsr2DataParam; ///< structure holding the necessary input information for msr2data
|
||||||
PFindReplaceData *fFindReplaceData; ///< structure holding the ncessary input for find/replace
|
PFindReplaceData *fFindReplaceData; ///< structure holding the ncessary input for find/replace
|
||||||
|
|
||||||
QComboBox *fComboFont; ///< combo box for the font selector
|
std::unique_ptr<QComboBox> fComboFont; ///< combo box for the font selector
|
||||||
QComboBox *fComboSize; ///< combo box for the font size
|
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
|
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
|
QTabWidget *fTabWidget; ///< tab widget in which the text editor(s) are placed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user