Added autosaving file each 5 minutes.
--HG-- branch : develop
This commit is contained in:
parent
016e539c6b
commit
dbc2578c71
|
@ -99,6 +99,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
fileName.clear();
|
||||
changeInFile = false;
|
||||
|
||||
//Autosaving file each 5 minutes
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->setTimerType(Qt::VeryCoarseTimer);
|
||||
connect(timer, &QTimer::timeout, this, &MainWindow::AutoSavePattern);
|
||||
timer->start(300000);
|
||||
}
|
||||
|
||||
void MainWindow::ActionNewDraw(){
|
||||
|
@ -948,6 +953,20 @@ bool MainWindow::SafeSaveing(const QString &fileName) const{
|
|||
return result;
|
||||
}
|
||||
|
||||
void MainWindow::AutoSavePattern(){
|
||||
if(!fileName.isEmpty()){
|
||||
bool result = SafeSaveing(fileName);
|
||||
if(result){
|
||||
ui->actionSave->setEnabled(false);
|
||||
changeInFile = false;
|
||||
QFileInfo info(fileName);
|
||||
QString title(info.fileName());
|
||||
title.append("-Valentina");
|
||||
setWindowTitle(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow(){
|
||||
CanselTool();
|
||||
delete ui;
|
||||
|
|
|
@ -154,6 +154,7 @@ private:
|
|||
void AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool,
|
||||
const qint64 &idDetail);
|
||||
bool SafeSaveing(const QString &fileName)const;
|
||||
void AutoSavePattern();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user