]> Devoid-pointer.net GitWeb - anyanka.git/commitdiff
Add "Save all changes" option and assign keyboard shortcuts to "Save
authorMichal Malý <madcatxster@devoid-pointer.net>
Sat, 28 Feb 2015 21:31:01 +0000 (22:31 +0100)
committerMichal Malý <madcatxster@devoid-pointer.net>
Sat, 28 Feb 2015 21:31:01 +0000 (22:31 +0100)
changes" and "Save all changes" actions.

datamanager.cpp
datamanager.h
gui/mainwindow.cpp
gui/mainwindow.h
gui/mainwindow.ui
main.cpp
sequence.h

index 2a7b6bd4dcfdd5ef33bdcf8d1e15566969f5c7e9..0e2b0ab5b0fff4f1e51bd5dbaae0f7350f129135 100644 (file)
@@ -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) {
index 847960f1d81c4c5178a62596b9191ce653c0b31b..75877171a263bf81f59db05eb335f13fa81fc5da 100644 (file)
@@ -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);
 
index 70ebb45da86b0f2e04d7166c3d115aac9fba21c8..6f45266d7bc3dfa1ef37470866cd853cb9d8cf25 100644 (file)
@@ -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()));
index 98eb7c8204238d9ebb9f588a76b2409187f497c4..a02bd91ce89b2bce9750abbd9b5b819102fa2845 100644 (file)
@@ -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();
index 4a0d98439348adcaae75c799dc54b3a7677c970b..b994eaed4de370c99d6fd085669167a38ccb2c91 100644 (file)
         <rect>
          <x>0</x>
          <y>0</y>
-         <width>780</width>
-         <height>336</height>
+         <width>782</width>
+         <height>309</height>
         </rect>
        </property>
        <property name="sizePolicy">
      <x>0</x>
      <y>0</y>
      <width>800</width>
-     <height>19</height>
+     <height>25</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuData">
     <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">
    <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/>
index 2efeba2e67f3c48cd6b9458a901d2607489a93a6..11df5d4f3254ab61dbdaf753549e8a7dfa69a6a9 100644 (file)
--- 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)));
index e6afe06c920ac2ee4597c2d9b7ae6abe15660d23..d5862cdee2b24387b04056503bca4a6e5f4bd89d 100644 (file)
@@ -55,7 +55,7 @@ public:
 
 private:
   std::string m_selectedRunKey;
-  std::map<std::string, std::shared_ptr<SingleRunData>> m_singleRuns;
+  SingleRunsMap m_singleRuns;
 
 signals: