From f82abb17b187809b81ca024858904580ea997809 Mon Sep 17 00:00:00 2001
From: Olivier Langella <olivier.langella@u-psud.fr>
Date: Sun, 20 Aug 2017 08:05:56 +0200
Subject: [PATCH] WIP: new about dialog window

---
 src/CMakeLists.txt                   |   3 +
 src/gui/about_dialog/about_dialog.ui | 111 +++++++++++++++++++++++++++
 src/gui/about_dialog/aboutdialog.cpp |  50 ++++++++++++
 src/gui/about_dialog/aboutdialog.h   |  47 ++++++++++++
 src/gui/main.ui                      |  18 ++++-
 src/gui/mainwindow.h                 |   3 +
 6 files changed, 229 insertions(+), 3 deletions(-)
 create mode 100644 src/gui/about_dialog/about_dialog.ui
 create mode 100644 src/gui/about_dialog/aboutdialog.cpp
 create mode 100644 src/gui/about_dialog/aboutdialog.h

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5d40024c..91fb52f0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -107,6 +107,7 @@ SET(CPP_FILES
 # (CMAKE_BINARY_DIR holds a path to the build directory, while INCLUDE_DIRECTORIES() works just like INCLUDEPATH from qmake)
 
 SET(XTPCPP_SRCS
+  ./gui/about_dialog/aboutdialog.cpp
   ./gui/choose_modification_dialog/choosemodificationdialog.cpp
   ./gui/edit_label_methods/editlabelmethods.cpp
   ./gui/edit_modifications/editmodifications.cpp
@@ -139,6 +140,7 @@ SET(XTPCPP_SRCS
 )
 
 SET (GUI_UIS
+  ./gui/about_dialog/about_dialog.ui
   ./gui/choose_modification_dialog/choose_modification_dialog.ui
   ./gui/edit_label_methods/edit_label_methods.ui
   ./gui/edit_modifications/edit_modifications.ui
@@ -158,6 +160,7 @@ SET (GUI_UIS
 )
 
 SET(XTPCPP_MOC_HDRS
+  ./gui/about_dialog/aboutdialog.h
   ./gui/choose_modification_dialog/choosemodificationdialog.h
   ./gui/edit_label_methods/editlabelmethods.h
   ./gui/edit_modifications/editmodifications.h
diff --git a/src/gui/about_dialog/about_dialog.ui b/src/gui/about_dialog/about_dialog.ui
new file mode 100644
index 00000000..e3e5413f
--- /dev/null
+++ b/src/gui/about_dialog/about_dialog.ui
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AboutDialog</class>
+ <widget class="QDialog" name="AboutDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout">
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout"/>
+     </item>
+     <item>
+      <widget class="QTextEdit" name="textEdit">
+       <property name="enabled">
+        <bool>true</bool>
+       </property>
+       <property name="acceptDrops">
+        <bool>false</bool>
+       </property>
+       <property name="frameShadow">
+        <enum>QFrame::Sunken</enum>
+       </property>
+       <property name="readOnly">
+        <bool>true</bool>
+       </property>
+       <property name="html">
+        <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;X!Tandem Pipeline C++ is developped by PAPPSO team (&lt;a href=&quot;http://pappso.inra.fr&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://pappso.inra.fr&lt;/span&gt;&lt;/a&gt;).&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;This software is distributed under the terms of the GNU General Public License.&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;For more information on X!Tandem search tools, see &lt;a href=&quot;http://www.thegpm.org/tandem/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.thegpm.org/tandem/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="verticalSpacer">
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>40</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>AboutDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>AboutDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/gui/about_dialog/aboutdialog.cpp b/src/gui/about_dialog/aboutdialog.cpp
new file mode 100644
index 00000000..73751c8a
--- /dev/null
+++ b/src/gui/about_dialog/aboutdialog.cpp
@@ -0,0 +1,50 @@
+
+/*******************************************************************************
+* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>.
+*
+* This file is part of XTPcpp.
+*
+*     XTPcpp is free software: you can redistribute it and/or modify
+*     it under the terms of the GNU General Public License as published by
+*     the Free Software Foundation, either version 3 of the License, or
+*     (at your option) any later version.
+*
+*     XTPcpp is distributed in the hope that it will be useful,
+*     but WITHOUT ANY WARRANTY; without even the implied warranty of
+*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*     GNU General Public License for more details.
+*
+*     You should have received a copy of the GNU General Public License
+*     along with XTPcpp.  If not, see <http://www.gnu.org/licenses/>.
+*
+* Contributors:
+*     Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
+******************************************************************************/
+
+#include "aboutdialog.h"
+#include <QDebug>
+
+AboutDialog::AboutDialog(QWidget * parent):
+    QDialog(parent),
+    ui(new Ui::AboutDialog)
+{
+    qDebug() << "AboutDialog::AboutDialog begin";
+    ui->setupUi(this);
+    this->setModal(true);
+    
+#if QT_VERSION >= 0x050000
+    // Qt5 code
+#else
+// Qt4 code
+
+#endif
+
+}
+
+AboutDialog::~AboutDialog()
+{
+    qDebug() << "AboutDialog::~AboutDialog";
+    delete ui;
+    
+    qDebug() << "AboutDialog::~AboutDialog end";
+}
diff --git a/src/gui/about_dialog/aboutdialog.h b/src/gui/about_dialog/aboutdialog.h
new file mode 100644
index 00000000..299a6b33
--- /dev/null
+++ b/src/gui/about_dialog/aboutdialog.h
@@ -0,0 +1,47 @@
+
+/*******************************************************************************
+* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>.
+*
+* This file is part of XTPcpp.
+*
+*     XTPcpp is free software: you can redistribute it and/or modify
+*     it under the terms of the GNU General Public License as published by
+*     the Free Software Foundation, either version 3 of the License, or
+*     (at your option) any later version.
+*
+*     XTPcpp is distributed in the hope that it will be useful,
+*     but WITHOUT ANY WARRANTY; without even the implied warranty of
+*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*     GNU General Public License for more details.
+*
+*     You should have received a copy of the GNU General Public License
+*     along with XTPcpp.  If not, see <http://www.gnu.org/licenses/>.
+*
+* Contributors:
+*     Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
+******************************************************************************/
+
+#ifndef ABOUTDIALOG_H
+#define ABOUTDIALOG_H
+
+#include <QDialog>
+
+
+namespace Ui {
+class AboutDialog;
+}
+
+class AboutDialog : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit AboutDialog(QWidget * parent);
+    ~AboutDialog();
+
+private:
+    Ui::AboutDialog *ui;
+
+};
+
+#endif // ABOUTDIALOG_H
diff --git a/src/gui/main.ui b/src/gui/main.ui
index b21bdc63..76d47375 100644
--- a/src/gui/main.ui
+++ b/src/gui/main.ui
@@ -26,7 +26,7 @@
      <x>0</x>
      <y>0</y>
      <width>463</width>
-     <height>23</height>
+     <height>25</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuFile">
@@ -60,8 +60,15 @@
     <addaction name="actionModifications"/>
     <addaction name="actionLabeling_methods"/>
    </widget>
+   <widget class="QMenu" name="menu">
+    <property name="title">
+     <string>?</string>
+    </property>
+    <addaction name="actionAbout"/>
+   </widget>
    <addaction name="menuFile"/>
    <addaction name="menu_edit"/>
+   <addaction name="menu"/>
   </widget>
   <widget class="QStatusBar" name="statusbar"/>
   <action name="actionLoad">
@@ -106,12 +113,17 @@
   </action>
   <action name="actionProticDb">
    <property name="text">
-    <string>PROTICdb</string>
+    <string>&amp;PROTICdb</string>
    </property>
   </action>
   <action name="action_spectral_counting_mcq">
    <property name="text">
-    <string>Spectral Counting mcq</string>
+    <string>Spectral &amp;Counting mcq</string>
+   </property>
+  </action>
+  <action name="actionAbout">
+   <property name="text">
+    <string>About</string>
    </property>
   </action>
  </widget>
diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h
index c6152358..aecb50ff 100644
--- a/src/gui/mainwindow.h
+++ b/src/gui/mainwindow.h
@@ -38,6 +38,7 @@
 #include "load_results_dialog/loadresultsdialog.h"
 #include "export_spreadsheet_dialog/exportspreadsheetdialog.h"
 #include "waiting_message_dialog/waitingmessagedialog.h"
+#include "about_dialog/aboutdialog.h"
 
 
 
@@ -56,6 +57,7 @@ public:
 public slots:
     void loadResults();
     void selectXpipFile();
+    void doActionAbout();
     void doActionQuit();
     void doActionFasta();
     void doActionMassChroQ();
@@ -106,6 +108,7 @@ private :
     LoadResultsDialog * _p_load_results_dialog=nullptr;
     ExportSpreadsheetDialog * _p_export_spreadsheet_dialog;
     WaitingMessageDialog * _p_waiting_message_dialog;
+    AboutDialog * _p_about_dialog=nullptr;
 
 };
 
-- 
GitLab