Advertisement
Ollie920049

qgui.h

May 3rd, 2012
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.18 KB | None | 0 0
  1. /*
  2.  * =====================================================================================
  3.  *       Filename:  qgui.h
  4.  *
  5.  *        Version:  1.0
  6.  *        Created:  23/04/12 15:42:19
  7.  *       Compiler:  "make" from QScanner root. Requires qt make installed
  8.  *                   $ sudo apt-get install libqt4-dev
  9.  *
  10.  *         Author:  Oliver Fletcher, ttolf@lboro.ac.uk
  11.  *     University:  Loughborough University
  12.  * =====================================================================================
  13.  */
  14.  
  15. #ifndef QGUI_H
  16. #define QGUI_H
  17.  
  18. #include "ui_qgui.h"
  19. #include <stdlib.h>
  20. #include <QFuture>
  21. #include <QFutureWatcher>
  22. #include "k.h"
  23. #include <string>
  24.  
  25. class qguiApp : public QWidget, private Ui::qgui
  26. {
  27.   Q_OBJECT
  28.  
  29.   private:
  30.     QFutureWatcher<void> *watcher;
  31.     QFutureWatcher<void> *updateWatcher;
  32.     QFutureWatcher<void> *fileWatcher;
  33.     QFuture<QByteArray> *future;
  34.     QFuture<QByteArray> *updateFuture;
  35.     QFuture<QByteArray> *fileFuture;
  36.     bool isdir;
  37.     std::string fname;
  38.     std::string dir;
  39.  
  40.   public:
  41.     qguiApp(QWidget *parent=0);
  42.     ~qguiApp(){
  43.     }
  44.  
  45.   public slots:
  46.     void getPathOrDir();
  47.     void getPath();
  48.     void scanTypeChanged();
  49.     void run_thread();
  50.     void scan();
  51.     void display_logs();
  52.     void file_thread();
  53.     void file_logs();
  54.     void clearScan();
  55.     void clearFile();
  56.     void updateSettings();
  57.     void showSave();
  58.     void loadSettings();
  59.     void update_thread();
  60.     void update_start();
  61.     void update_logs();
  62.     void showHelp();
  63. };
  64.  
  65. class qconn
  66. {
  67.   private:
  68.     int c;
  69.  
  70.   public:
  71.     qconn(){
  72.       c=khp("localhost",5000);
  73.     }
  74.     ~qconn(){
  75.       kclose(c);
  76.     }
  77.  
  78.     K sync_query(char *qinput){
  79.       K result;
  80.       result = k(c,qinput,(K)0);
  81.       return result;
  82.     }
  83.     void async_query(char *qinput){
  84.       k(-c,qinput,(K)0);
  85.     }
  86.     bool isConnected(){
  87.       if(c < 0){
  88.         return false;
  89.       }
  90.       else return true;
  91.     }
  92. };
  93.  
  94. QByteArray q_query(char* qinput,bool isdir);
  95. QByteArray file_query(char* qinput);
  96. QByteArray update_query();
  97.  
  98. void launchDaemon();                            
  99. void qScannerPath();                            
  100.  
  101. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement