From: Michal MalĂ˝ <madcatxster@devoid-pointer.net> Date: Sat, 28 Feb 2015 21:31:01 +0000 (+0100) Subject: Add "Save all changes" option and assign keyboard shortcuts to "Save X-Git-Tag: 0.4a~17 X-Git-Url: https://gitweb.devoid-pointer.net/?a=commitdiff_plain;h=a4bfc40f6b8b0867d649d5ac5e2a628e90976fc1;p=anyanka.git Add "Save all changes" option and assign keyboard shortcuts to "Save changes" and "Save all changes" actions. --- diff --git a/datamanager.cpp b/datamanager.cpp index 2a7b6bd..0e2b0ab 100644 --- a/datamanager.cpp +++ b/datamanager.cpp @@ -649,6 +649,20 @@ void DataManager::onSaveChanges() sr->saveUserDataToJSON(); } +void DataManager::onSaveAllChanges() +{ + SingleRunsMap::iterator it; + + if (m_activeSequence == nullptr) + return; + + it = m_activeSequence->begin(); + while (it != m_activeSequence->end()) { + it->second->saveUserDataToJSON(); + it++; + } +} + void DataManager::onSequenceSelected(const QString& key) { if (m_sequenceRejected) { diff --git a/datamanager.h b/datamanager.h index 847960f..7587717 100644 --- a/datamanager.h +++ b/datamanager.h @@ -107,6 +107,7 @@ public slots: void onLoadSequence(const QString& dir); void onLoadSingleRun(const QString& dir); void onSaveChanges(); + void onSaveAllChanges(); void onSequenceSelected(const QString& key); void onSingleRunSelected(const QString& key); diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 70ebb45..6f45266 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -71,6 +71,7 @@ void MainWindow::connectActions() connect(ui->actionLoad_single_run, SIGNAL(triggered()), this, SLOT(onLoadSingleRun())); connect(ui->actionLoad_sequence, SIGNAL(triggered()), this, SLOT(onLoadSequence())); connect(ui->actionSave_changes, SIGNAL(triggered()), this, SLOT(onSaveChanges())); + connect(ui->actionSave_all_changes, SIGNAL(triggered()), this, SLOT(onSaveAllChanges())); /* EXPORT menu */ connect(ui->actionRaw_values, SIGNAL(triggered()), this, SLOT(onExportRawData())); connect(ui->actionIntegration_results, SIGNAL(triggered()), this, SLOT(onExportPeaks())); diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 98eb7c8..a02bd91 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -77,6 +77,7 @@ private slots: void onLoadSequence(); void onLoadSingleRun(); void onSaveChanges() { emit saveChanges(); } + void onSaveAllChanges() { emit saveAllChanges(); } void onSequenceSelected(const QString& str); void onSingleRunSelected(const QString& str); void onSWFullSizeToggle(); @@ -91,6 +92,7 @@ signals: void loadSequence(const QString& dir); void loadSingleRun(const QString& dir); void saveChanges(); + void saveAllChanges(); void sequenceSelected(const QString& str); void singleRunSelected(const QString& str); void zoomMode(); diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui index 4a0d984..b994eae 100644 --- a/gui/mainwindow.ui +++ b/gui/mainwindow.ui @@ -198,8 +198,8 @@ <rect> <x>0</x> <y>0</y> - <width>780</width> - <height>336</height> + <width>782</width> + <height>309</height> </rect> </property> <property name="sizePolicy"> @@ -219,7 +219,7 @@ <x>0</x> <y>0</y> <width>800</width> - <height>19</height> + <height>25</height> </rect> </property> <widget class="QMenu" name="menuData"> @@ -230,6 +230,7 @@ <addaction name="actionLoad_sequence"/> <addaction name="separator"/> <addaction name="actionSave_changes"/> + <addaction name="actionSave_all_changes"/> </widget> <widget class="QMenu" name="menuHelp"> <property name="title"> @@ -289,6 +290,17 @@ <property name="text"> <string>Save changes</string> </property> + <property name="shortcut"> + <string>Ctrl+S</string> + </property> + </action> + <action name="actionSave_all_changes"> + <property name="text"> + <string>Save all changes</string> + </property> + <property name="shortcut"> + <string>Ctrl+Shift+S</string> + </property> </action> </widget> <resources/> diff --git a/main.cpp b/main.cpp index 2efeba2..11df5d4 100644 --- a/main.cpp +++ b/main.cpp @@ -57,6 +57,7 @@ int main(int argc, char *argv[]) QObject::connect(mWin.get(), SIGNAL(exportPeaks()), dMgr.get(), SLOT(onExportPeaks())); QObject::connect(mWin.get(), SIGNAL(exportRawData()), dMgr.get(), SLOT(onExportRawData())); QObject::connect(mWin.get(), SIGNAL(saveChanges()), dMgr.get(), SLOT(onSaveChanges())); + QObject::connect(mWin.get(), SIGNAL(saveAllChanges()), dMgr.get(), SLOT(onSaveAllChanges())); QObject::connect(mWin.get(), SIGNAL(loadSingleRun(QString)), dMgr.get(), SLOT(onLoadSingleRun(QString))); QObject::connect(mWin.get(), SIGNAL(loadSequence(QString)), dMgr.get(), SLOT(onLoadSequence(QString))); QObject::connect(mWin.get(), SIGNAL(sequenceSelected(QString)), dMgr.get(), SLOT(onSequenceSelected(QString))); diff --git a/sequence.h b/sequence.h index e6afe06..d5862cd 100644 --- a/sequence.h +++ b/sequence.h @@ -55,7 +55,7 @@ public: private: std::string m_selectedRunKey; - std::map<std::string, std::shared_ptr<SingleRunData>> m_singleRuns; + SingleRunsMap m_singleRuns; signals: