Sync measurements.
--HG-- branch : feature
This commit is contained in:
parent
00cd073fad
commit
62a6fcce44
|
@ -80,7 +80,8 @@ Q_LOGGING_CATEGORY(vMainWindow, "v.mainwindow")
|
|||
MainWindow::MainWindow(QWidget *parent)
|
||||
:MainWindowsNoGUI(parent), ui(new Ui::MainWindow), watcher(new QFileSystemWatcher(this)), currentTool(Tool::Arrow),
|
||||
lastUsedTool(Tool::Arrow), sceneDraw(nullptr), sceneDetails(nullptr),
|
||||
mouseCoordinate(nullptr), helpLabel(nullptr), isInitialized(false), dialogTable(nullptr), dialogTool(nullptr),
|
||||
mouseCoordinate(nullptr), helpLabel(nullptr), isInitialized(false), mChanges(false), dialogTable(nullptr),
|
||||
dialogTool(nullptr),
|
||||
dialogHistory(nullptr), comboBoxDraws(nullptr), mode(Draw::Calculation), currentDrawIndex(0),
|
||||
currentToolBoxIndex(0), drawMode(true), recentFileActs(),
|
||||
separatorAct(nullptr),
|
||||
|
@ -305,6 +306,19 @@ bool MainWindow::LoadMeasurements(const QString &path)
|
|||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::ToggleMSync(bool toggle)
|
||||
{
|
||||
if (mChanges)
|
||||
{
|
||||
ui->actionSyncMeasurements->setEnabled(toggle);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->actionSyncMeasurements->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief OptionDraw help change name of pattern piece.
|
||||
|
@ -1062,7 +1076,7 @@ void MainWindow::ShowMeasurements()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::MeasurementsChanged(const QString &path)
|
||||
{
|
||||
bool mChanges = false;
|
||||
mChanges = false;
|
||||
QFileInfo checkFile(path);
|
||||
if (checkFile.exists())
|
||||
{
|
||||
|
@ -1084,24 +1098,27 @@ void MainWindow::MeasurementsChanged(const QString &path)
|
|||
}
|
||||
}
|
||||
|
||||
ToggleMSync(true);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::SyncMeasurements()
|
||||
{
|
||||
if (mChanges)
|
||||
{
|
||||
QMessageBox::StandardButton reply = QMessageBox::question(this, tr("Update measurements"),
|
||||
tr("Measurement file was changed. Do you want to update?"),
|
||||
QMessageBox::Yes|QMessageBox::No);
|
||||
if (reply == QMessageBox::Yes)
|
||||
if(LoadMeasurements(doc->MPath()))
|
||||
{
|
||||
if(LoadMeasurements(path))
|
||||
if (not watcher->files().contains(doc->MPath()))
|
||||
{
|
||||
if (not watcher->files().contains(path))
|
||||
{
|
||||
watcher->addPath(path);
|
||||
}
|
||||
helpLabel->setText(tr("Measurements updated"));
|
||||
doc->LiteParseTree(Document::LiteParse);
|
||||
watcher->addPath(doc->MPath());
|
||||
}
|
||||
helpLabel->setText(tr("Measurements updated"));
|
||||
doc->LiteParseTree(Document::LiteParse);
|
||||
mChanges = false;
|
||||
}
|
||||
}
|
||||
|
||||
ToggleMSync(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -2888,6 +2905,8 @@ void MainWindow::CreateActions()
|
|||
recentFileActs[i]->setVisible(false);
|
||||
connect(recentFileActs[i], &QAction::triggered, this, &MainWindow::OpenRecentFile);
|
||||
}
|
||||
|
||||
connect(ui->actionSyncMeasurements, &QAction::triggered, this, &MainWindow::SyncMeasurements);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -167,6 +167,7 @@ private slots:
|
|||
void CreateMeasurements();
|
||||
void ShowMeasurements();
|
||||
void MeasurementsChanged(const QString &path);
|
||||
void SyncMeasurements();
|
||||
private:
|
||||
Q_DISABLE_COPY(MainWindow)
|
||||
/** @brief ui keeps information about user interface */
|
||||
|
@ -194,6 +195,7 @@ private:
|
|||
|
||||
/** @brief isInitialized true after first show window. */
|
||||
bool isInitialized;
|
||||
bool mChanges;
|
||||
|
||||
DialogIncrements *dialogTable;
|
||||
DialogTool *dialogTool;
|
||||
|
@ -294,6 +296,8 @@ private:
|
|||
void InitScenes();
|
||||
|
||||
bool LoadMeasurements(const QString &path);
|
||||
|
||||
void ToggleMSync(bool toggle);
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
@ -372,7 +372,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>117</width>
|
||||
<width>130</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -458,7 +458,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>117</width>
|
||||
<width>130</width>
|
||||
<height>156</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -622,7 +622,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>117</width>
|
||||
<width>130</width>
|
||||
<height>196</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -864,7 +864,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>117</width>
|
||||
<width>130</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -1089,6 +1089,7 @@
|
|||
<addaction name="actionLoadStandard"/>
|
||||
<addaction name="actionCreateNew"/>
|
||||
<addaction name="actionShowM"/>
|
||||
<addaction name="actionSyncMeasurements"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuWindow">
|
||||
<property name="title">
|
||||
|
@ -1139,6 +1140,7 @@
|
|||
<addaction name="actionNew"/>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="actionSyncMeasurements"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<widget class="QToolBar" name="toolBarStages">
|
||||
|
@ -1893,6 +1895,18 @@
|
|||
<string>Show measurements</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSyncMeasurements">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../libs/vmisc/share/resources/icon.qrc">
|
||||
<normaloff>:/icon/32x32/syncM.png</normaloff>:/icon/32x32/syncM.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sync measurements</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
|
|
@ -50,5 +50,6 @@
|
|||
<file>icon/24x24/left_to_right_arrow.png</file>
|
||||
<file>icon/24x24/right_to_left_arrow.png</file>
|
||||
<file>icon/32x32/clockwise.png</file>
|
||||
<file>icon/32x32/syncM.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
BIN
src/libs/vmisc/share/resources/icon/32x32/syncM.png
Normal file
BIN
src/libs/vmisc/share/resources/icon/32x32/syncM.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 837 B |
Loading…
Reference in New Issue
Block a user