Refactoring.
This commit is contained in:
parent
fbbcf5320f
commit
4a7ce91f65
|
@ -50,11 +50,10 @@
|
|||
#include "../vformat/vwatermark.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
WatermarkWindow::WatermarkWindow(const QString &patternPath, QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
WatermarkWindow::WatermarkWindow(const QString &patternPath, QWidget *parent)
|
||||
: QMainWindow(parent),
|
||||
ui(new Ui::WatermarkWindow),
|
||||
m_patternPath(patternPath),
|
||||
m_okPathColor()
|
||||
m_patternPath(patternPath)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_okPathColor = ui->lineEditPath->palette().color(ui->lineEditPath->foregroundRole());
|
||||
|
@ -274,7 +273,7 @@ void WatermarkWindow::showEvent(QShowEvent *event)
|
|||
// do your init stuff here
|
||||
|
||||
QSize sz = VAbstractApplication::VApp()->Settings()->GetWatermarkEditorSize();
|
||||
if (sz.isEmpty() == false)
|
||||
if (not sz.isEmpty())
|
||||
{
|
||||
resize(sz);
|
||||
}
|
||||
|
@ -384,10 +383,9 @@ auto WatermarkWindow::on_actionSave_triggered() -> bool
|
|||
{
|
||||
return on_actionSaveAs_triggered();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_curFileFormatVersion < VWatermarkConverter::WatermarkMaxVer
|
||||
&& not ContinueFormatRewrite(m_curFileFormatVersionStr, VWatermarkConverter::WatermarkMaxVerStr))
|
||||
|
||||
if (m_curFileFormatVersion < VWatermarkConverter::WatermarkMaxVer &&
|
||||
not ContinueFormatRewrite(m_curFileFormatVersionStr, VWatermarkConverter::WatermarkMaxVerStr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -413,8 +411,8 @@ auto WatermarkWindow::on_actionSave_triggered() -> bool
|
|||
// #ifdef Q_OS_WIN32
|
||||
// qt_ntfs_permission_lookup++; // turn checking on
|
||||
// #endif /*Q_OS_WIN32*/
|
||||
bool changed = QFile::setPermissions(m_curFile,
|
||||
QFileInfo(m_curFile).permissions() | QFileDevice::WriteUser);
|
||||
bool changed =
|
||||
QFile::setPermissions(m_curFile, QFileInfo(m_curFile).permissions() | QFileDevice::WriteUser);
|
||||
// #ifdef Q_OS_WIN32
|
||||
// qt_ntfs_permission_lookup--; // turn it off again
|
||||
// #endif /*Q_OS_WIN32*/
|
||||
|
@ -456,7 +454,6 @@ auto WatermarkWindow::on_actionSave_triggered() -> bool
|
|||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void WatermarkWindow::on_actionOpen_triggered()
|
||||
|
@ -607,11 +604,8 @@ auto WatermarkWindow::ContinueFormatRewrite(const QString ¤tFormatVersion,
|
|||
VAbstractApplication::VApp()->Settings()->SetConfirmFormatRewriting(not msgBox.isChecked());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -652,7 +646,7 @@ void WatermarkWindow::SetCurrentFile(const QString &fileName)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto WatermarkWindow::OpenNewEditor(const QString &fileName) const -> bool
|
||||
auto WatermarkWindow::OpenNewEditor(const QString &fileName) -> bool
|
||||
{
|
||||
if (this->isWindowModified() || not m_curFile.isEmpty())
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ class WatermarkWindow : public QMainWindow
|
|||
|
||||
public:
|
||||
explicit WatermarkWindow(const QString &patternPath, QWidget *parent = nullptr);
|
||||
~WatermarkWindow();
|
||||
~WatermarkWindow() override;
|
||||
|
||||
auto CurrentFile() const -> QString;
|
||||
|
||||
|
@ -52,13 +52,13 @@ public:
|
|||
|
||||
signals:
|
||||
void New();
|
||||
void OpenAnother(const QString &fileName) const;
|
||||
void OpenAnother(const QString &fileName);
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
virtual void changeEvent(QEvent* event) override;
|
||||
virtual void showEvent(QShowEvent *event) override;
|
||||
virtual void resizeEvent(QResizeEvent *event) override;
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void changeEvent(QEvent *event) override;
|
||||
void showEvent(QShowEvent *event) override;
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void on_actionNew_triggered();
|
||||
|
@ -76,7 +76,7 @@ private:
|
|||
QString m_patternPath;
|
||||
QString m_curFile{};
|
||||
VWatermarkData m_data{};
|
||||
QColor m_okPathColor;
|
||||
QColor m_okPathColor{};
|
||||
bool m_isInitialized{false};
|
||||
|
||||
unsigned m_curFileFormatVersion{0x0};
|
||||
|
@ -92,7 +92,7 @@ private:
|
|||
auto ContinueFormatRewrite(const QString ¤tFormatVersion, const QString &maxFormatVersion) -> bool;
|
||||
auto SaveWatermark(const QString &fileName, QString &error) -> bool;
|
||||
void SetCurrentFile(const QString &fileName);
|
||||
auto OpenNewEditor(const QString &fileName = QString()) const -> bool;
|
||||
auto OpenNewEditor(const QString &fileName = QString()) -> bool;
|
||||
void Clear();
|
||||
auto IgnoreLocking(int error, const QString &path) -> bool;
|
||||
void ShowWatermark();
|
||||
|
|
Loading…
Reference in New Issue
Block a user