Dmitry Yu Okunev лет назад: 9
Родитель
Сommit
a58874c257
18 измененных файлов с 393 добавлено и 24 удалено
  1. 1 0
      .gitignore
  2. 3 0
      .gitmodules
  3. 10 0
      common.h
  4. 19 0
      helpwindow.cpp
  5. 25 0
      helpwindow.h
  6. 51 0
      helpwindow.ui
  7. 21 0
      main.cpp
  8. 21 0
      mainwindow.cpp
  9. 6 1
      mainwindow.h
  10. 77 11
      mainwindow.ui
  11. 20 4
      mephi-tasks.pro
  12. 9 8
      mephi-tasks.pro.user
  13. 1 0
      qtredmine
  14. 31 0
      redmine.cpp
  15. 21 0
      redmine.h
  16. 20 0
      syntaxwindow.cpp
  17. 25 0
      syntaxwindow.h
  18. 32 0
      syntaxwindow.ui

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+build-qtredmine-Desktop-*

+ 3 - 0
.gitmodules

@@ -0,0 +1,3 @@
+[submodule "qtredmine"]
+	path = qtredmine
+	url = https://github.com/xaionaro/redmine-qt

+ 10 - 0
common.h

@@ -0,0 +1,10 @@
+#ifndef COMMON_H
+#define COMMON_H
+
+#include "redmine.h"
+#define SERVER_URL "https://tasks.mephi.ru"
+
+extern Redmine *redmine;
+extern QString issues_filter;
+
+#endif // COMMON_H

+ 19 - 0
helpwindow.cpp

@@ -0,0 +1,19 @@
+#include "helpwindow.h"
+#include "ui_helpwindow.h"
+
+HelpWindow::HelpWindow(QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::HelpWindow)
+{
+    ui->setupUi(this);
+}
+
+HelpWindow::~HelpWindow()
+{
+    delete ui;
+}
+
+void HelpWindow::on_pushButton_clicked()
+{
+    delete this;
+}

+ 25 - 0
helpwindow.h

@@ -0,0 +1,25 @@
+#ifndef HELPWINDOW_H
+#define HELPWINDOW_H
+
+#include <QDialog>
+
+namespace Ui {
+class HelpWindow;
+}
+
+class HelpWindow : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit HelpWindow(QWidget *parent = 0);
+    ~HelpWindow();
+
+private slots:
+    void on_pushButton_clicked();
+
+private:
+    Ui::HelpWindow *ui;
+};
+
+#endif // HELPWINDOW_H

+ 51 - 0
helpwindow.ui

@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>HelpWindow</class>
+ <widget class="QDialog" name="HelpWindow">
+  <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>
+  <widget class="QPushButton" name="pushButton">
+   <property name="geometry">
+    <rect>
+     <x>320</x>
+     <y>270</y>
+     <width>71</width>
+     <height>21</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Закрыть</string>
+   </property>
+  </widget>
+  <widget class="QTextBrowser" name="textBrowser">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>10</y>
+     <width>381</width>
+     <height>251</height>
+    </rect>
+   </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:'Sans Serif'; font-size:9pt; 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;Клиентское приложение для системы управления задачами и проектами НИЯУ МИФИ.&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;Автор: Окунев Дмитрий Юрьевич &amp;lt;dyokunev@mephi.ru&amp;gt;, Управление Информатизации, 2015&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 21 - 0
main.cpp

@@ -1,9 +1,30 @@
 #include "mainwindow.h"
+#include "syntaxwindow.h"
+#include "common.h"
 #include <QApplication>
 
+
+Redmine *redmine = NULL;
+QString issues_filter = "";
+
 int main(int argc, char *argv[])
 {
+    Redmine    _redmine;
+    redmine = &_redmine;
+
     QApplication a(argc, argv);
+    QStringList arglst = a.arguments();
+
+    if (arglst.isEmpty()) {
+        SyntaxWindow w;
+        w.show();
+        return a.exec();
+    }
+
+    QString apiKey = arglst.first();
+    redmine->apiKey(apiKey);
+    redmine->init();
+
     MainWindow w;
     w.show();
 

+ 21 - 0
mainwindow.cpp

@@ -1,14 +1,35 @@
 #include "mainwindow.h"
+#include "helpwindow.h"
 #include "ui_mainwindow.h"
+#include "common.h"
 
 MainWindow::MainWindow(QWidget *parent) :
     QMainWindow(parent),
     ui(new Ui::MainWindow)
 {
     ui->setupUi(this);
+    this->updateTasks();
+}
+
+int MainWindow::updateTasks() {
+    redmine->request(RedmineClient::GET, "/issues.json?"+issues_filter, "");
+
+    return 0;
 }
 
 MainWindow::~MainWindow()
 {
     delete ui;
 }
+
+void MainWindow::on_actionExit_triggered()
+{
+    qApp->quit();
+}
+
+void MainWindow::on_actionHelp_triggered()
+{
+    HelpWindow *win = new HelpWindow();
+    win->show();
+    return;
+}

+ 6 - 1
mainwindow.h

@@ -4,7 +4,7 @@
 #include <QMainWindow>
 
 namespace Ui {
-class MainWindow;
+    class MainWindow;
 }
 
 class MainWindow : public QMainWindow
@@ -15,7 +15,12 @@ public:
     explicit MainWindow(QWidget *parent = 0);
     ~MainWindow();
 
+private slots:
+    void on_actionExit_triggered();
+    void on_actionHelp_triggered();
+
 private:
+    int updateTasks();
     Ui::MainWindow *ui;
 };
 

+ 77 - 11
mainwindow.ui

@@ -1,24 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
  <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow" >
-  <property name="geometry" >
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>300</height>
+    <width>591</width>
+    <height>483</height>
    </rect>
   </property>
-  <property name="windowTitle" >
+  <property name="windowTitle">
    <string>MainWindow</string>
   </property>
-  <widget class="QMenuBar" name="menuBar" />
-  <widget class="QToolBar" name="mainToolBar" />
-  <widget class="QWidget" name="centralWidget" />
-  <widget class="QStatusBar" name="statusBar" />
+  <widget class="QWidget" name="centralWidget">
+   <widget class="QListView" name="Tasks_2">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>10</y>
+      <width>256</width>
+      <height>192</height>
+     </rect>
+    </property>
+   </widget>
+  </widget>
+  <widget class="QMenuBar" name="menuBar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>591</width>
+     <height>19</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menuInformation">
+    <property name="title">
+     <string>Информация</string>
+    </property>
+    <addaction name="actionHelp"/>
+   </widget>
+   <widget class="QMenu" name="menuInstance">
+    <property name="title">
+     <string>Программа</string>
+    </property>
+    <addaction name="actionExit"/>
+   </widget>
+   <widget class="QMenu" name="menu">
+    <property name="title">
+     <string>Конфигурация</string>
+    </property>
+    <addaction name="actionConfigureProjects"/>
+   </widget>
+   <addaction name="menuInstance"/>
+   <addaction name="menu"/>
+   <addaction name="menuInformation"/>
+  </widget>
+  <widget class="QStatusBar" name="statusBar"/>
+  <widget class="QToolBar" name="toolBar">
+   <property name="windowTitle">
+    <string>toolBar</string>
+   </property>
+   <attribute name="toolBarArea">
+    <enum>TopToolBarArea</enum>
+   </attribute>
+   <attribute name="toolBarBreak">
+    <bool>false</bool>
+   </attribute>
+  </widget>
+  <action name="actionHelp">
+   <property name="text">
+    <string>Помощь</string>
+   </property>
+  </action>
+  <action name="actionExit">
+   <property name="text">
+    <string>Завершить</string>
+   </property>
+  </action>
+  <action name="actionConfigureProjects">
+   <property name="text">
+    <string>Проекты</string>
+   </property>
+  </action>
  </widget>
- <layoutDefault spacing="6" margin="11" />
- <pixmapfunction></pixmapfunction>
+ <layoutdefault spacing="6" margin="11"/>
  <resources/>
  <connections/>
 </ui>

+ 20 - 4
mephi-tasks.pro

@@ -10,11 +10,27 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 
 TARGET = mephi-tasks
 TEMPLATE = app
-
+QMAKE_CXXFLAGS += -std=c++11
 
 SOURCES += main.cpp\
-        mainwindow.cpp
+        mainwindow.cpp \
+    helpwindow.cpp \
+    redmine.cpp \
+    syntaxwindow.cpp
+
+HEADERS  += mainwindow.h \
+    helpwindow.h \
+    redmine.h \
+    common.h \
+    syntaxwindow.h
+
+FORMS    += mainwindow.ui \
+    helpwindow.ui \
+    syntaxwindow.ui
 
-HEADERS  += mainwindow.h
+win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../build-qtredmine-Desktop-Debug/release/ -lqtredmine
+else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../build-qtredmine-Desktop-Debug/debug/ -lqtredmine
+else:unix: LIBS += -L$$PWD/../build-qtredmine-Desktop-Debug/ -lqtredmine
 
-FORMS    += mainwindow.ui
+INCLUDEPATH += $$PWD/qtredmine
+DEPENDPATH += $$PWD/qtredmine

+ 9 - 8
mephi-tasks.pro.user

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 3.2.1, 2015-03-06T18:03:34. -->
+<!-- Written by QtCreator 3.2.1, 2015-03-06T20:34:15. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>
@@ -232,15 +232,16 @@
      <value type="int">13</value>
      <value type="int">14</value>
     </valuelist>
-    <value type="int" key="PE.EnvironmentAspect.Base">-1</value>
+    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
     <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
-    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
-    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
-    <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
-    <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
-    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">mephi-tasks</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
-    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
+    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/xaionaro/mephi-tasks/mephi-tasks.pro</value>
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">mephi-tasks.pro</value>
+    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
+    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
+    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
     <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
     <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
     <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>

+ 1 - 0
qtredmine

@@ -0,0 +1 @@
+Subproject commit dfb27a34e492818dda46bd5c331d2697d357756b

+ 31 - 0
redmine.cpp

@@ -0,0 +1,31 @@
+#include "redmine.h"
+#include "common.h"
+#include <RedmineClient.hpp>
+
+
+Redmine::Redmine()
+{
+
+}
+
+QString Redmine::apiKey(QString apiKey) {
+    return this->_apiKey = apiKey;
+}
+
+QString Redmine::apiKey() {
+    return this->_apiKey;
+}
+
+int Redmine::init() {
+    //this->setAuth(this->_apiKey);
+    return 0;
+}
+
+int Redmine::request(
+        RedmineClient::EMode    mode,
+        QString                 uri,
+        const QByteArray&       requestData
+) {
+    //this->sendRequest(SERVER_URL+uri, mode, requestData);
+    return 0;
+}

+ 21 - 0
redmine.h

@@ -0,0 +1,21 @@
+#ifndef REDMINE_H
+#define REDMINE_H
+
+#include <RedmineClient.hpp>
+
+class Redmine : public RedmineClient
+{
+private:
+    QString _apiKey;
+
+public:
+    QString apiKey(QString apiKey);
+    QString apiKey();
+
+    int init();
+    int request(RedmineClient::EMode mode, QString uri, const QByteArray& requestData = "");
+
+    Redmine();
+};
+
+#endif // REDMINE_H

+ 20 - 0
syntaxwindow.cpp

@@ -0,0 +1,20 @@
+#include "syntaxwindow.h"
+#include "ui_syntaxwindow.h"
+
+SyntaxWindow::SyntaxWindow(QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::SyntaxWindow)
+{
+    ui->setupUi(this);
+}
+
+SyntaxWindow::~SyntaxWindow()
+{
+    delete ui;
+}
+
+void SyntaxWindow::on_closeButton_toggled(bool checked)
+{
+    (void)checked;
+    delete this;
+}

+ 25 - 0
syntaxwindow.h

@@ -0,0 +1,25 @@
+#ifndef SYNTAXWINDOW_H
+#define SYNTAXWINDOW_H
+
+#include <QDialog>
+
+namespace Ui {
+class SyntaxWindow;
+}
+
+class SyntaxWindow : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit SyntaxWindow(QWidget *parent = 0);
+    ~SyntaxWindow();
+
+private slots:
+    void on_closeButton_toggled(bool checked);
+
+private:
+    Ui::SyntaxWindow *ui;
+};
+
+#endif // SYNTAXWINDOW_H

+ 32 - 0
syntaxwindow.ui

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SyntaxWindow</class>
+ <widget class="QDialog" name="SyntaxWindow">
+  <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>
+  <widget class="QPushButton" name="closeButton">
+   <property name="geometry">
+    <rect>
+     <x>310</x>
+     <y>270</y>
+     <width>80</width>
+     <height>21</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Закрыть</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>