- Added AlertWaiter and QBittorentSession
authorlvaatamoinen <lassi.vaatamoinen@ixonos.com>
Tue, 20 Oct 2009 13:33:29 +0000 (13:33 +0000)
committerlvaatamoinen <lassi.vaatamoinen@ixonos.com>
Tue, 20 Oct 2009 13:33:29 +0000 (13:33 +0000)
- Initial thread / signal -experimenting

git-svn-id: file:///svnroot/qtrapids/trunk@10 42ac0dd5-4c8c-4c71-bb3e-ecdfe252ffda

qtrapids.kdevelop
src/engine/AlertWaiterThread.cpp [new file with mode: 0644]
src/engine/AlertWaiterThread.h [new file with mode: 0644]
src/engine/QBittorrentSession.cpp [new file with mode: 0644]
src/engine/QBittorrentSession.h [new file with mode: 0644]
src/engine/engine.pro
src/gui/MainWindow.cpp
src/gui/MainWindow.h
src/gui/gui.pro
src/src.pro

index c8a115f..b476a37 100644 (file)
   </kdevdebugger>
   <kdevtrollproject>
     <run>
-      <mainprogram>/home/vaatala/Projects/qtrapids/trunk</mainprogram>
+      <mainprogram>/home/vaatala/Projects/qtrapids/trunk/bin/qtrapids</mainprogram>
       <programargs></programargs>
       <directoryradio>executable</directoryradio>
       <globaldebugarguments></globaldebugarguments>
-      <globalcwd>/home/vaatala/Projects/qtrapids</globalcwd>
-      <useglobalprogram>false</useglobalprogram>
+      <globalcwd>/home/vaatala/Projects/qtrapids/trunk/bin</globalcwd>
+      <useglobalprogram>true</useglobalprogram>
       <terminal>false</terminal>
       <autocompile>false</autocompile>
       <autoinstall>false</autoinstall>
       <autokdesu>false</autokdesu>
-      <envvars/>
+      <envvars>
+        <envvar value="." name="LD_LIBRARY_PATH" />
+      </envvars>
       <runarguments>
-        <qtrapids></qtrapids>
+        <qtrapids/>
       </runarguments>
       <cwd>
         <qtrapids>/home/vaatala/Projects/qtrapids/trunk</qtrapids>
       </cwd>
       <debugarguments>
-        <qtrapids></qtrapids>
+        <qtrapids/>
       </debugarguments>
     </run>
     <general>
     <projectdoc>
       <docsystem>Doxygen Documentation Collection</docsystem>
       <docurl>qtrapids.tag</docurl>
-      <usermanualurl></usermanualurl>
+      <usermanualurl/>
     </projectdoc>
   </kdevdocumentation>
   <substmap>
diff --git a/src/engine/AlertWaiterThread.cpp b/src/engine/AlertWaiterThread.cpp
new file mode 100644 (file)
index 0000000..7a2f90f
--- /dev/null
@@ -0,0 +1,51 @@
+/***************************************************************************
+ *   Copyright (C) 2009 by Lassi Väätämöinen   *
+ *   lassi.vaatamoinen@ixonos.com   *
+ *                                                                         *
+ *   This program 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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program 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 this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#include <QDebug>
+
+#include "AlertWaiterThread.h"
+
+AlertWaiterThread::AlertWaiterThread(QObject* parent): QThread(parent)
+{
+}
+
+
+AlertWaiterThread::~AlertWaiterThread()
+{
+}
+
+
+void AlertWaiterThread::run()
+{
+       while (true)
+       {
+               qDebug() << "AlertWaiter running";
+               emit alert();
+               sleep(2);
+       }
+}
+
+
+// =================== SIGNALS =======================
+// AlertWaiterThread::alert()
+// {
+// }
+
+
diff --git a/src/engine/AlertWaiterThread.h b/src/engine/AlertWaiterThread.h
new file mode 100644 (file)
index 0000000..5ba3bf6
--- /dev/null
@@ -0,0 +1,46 @@
+/***************************************************************************
+ *   Copyright (C) 2009 by Lassi Väätämöinen   *
+ *   lassi.vaatamoinen@ixonos.com   *
+ *                                                                         *
+ *   This program 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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program 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 this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+#ifndef ALERTWAITERTHREAD_H
+#define ALERTWAITERTHREAD_H
+
+#include <QThread>
+
+/**
+       @author Lassi Väätämöinen <lassi.vaatamoinen@ixonos.com>
+*/
+class AlertWaiterThread : public QThread
+{
+       Q_OBJECT
+       
+       public:
+               AlertWaiterThread(QObject* parent = 0);
+
+    ~AlertWaiterThread();
+
+               void run(); // Overridden from QThread
+               
+       signals:
+               void alert();
+               
+       private:
+               
+};
+
+#endif
diff --git a/src/engine/QBittorrentSession.cpp b/src/engine/QBittorrentSession.cpp
new file mode 100644 (file)
index 0000000..34198c8
--- /dev/null
@@ -0,0 +1,31 @@
+/***************************************************************************
+ *   Copyright (C) 2009 by Lassi Väätämöinen   *
+ *   lassi.vaatamoinen@ixonos.com   *
+ *                                                                         *
+ *   This program 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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program 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 this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+#include "QBittorrentSession.h"
+
+QBittorrentSession::QBittorrentSession()
+{
+}
+
+
+QBittorrentSession::~QBittorrentSession()
+{
+}
+
+
diff --git a/src/engine/QBittorrentSession.h b/src/engine/QBittorrentSession.h
new file mode 100644 (file)
index 0000000..19de9d7
--- /dev/null
@@ -0,0 +1,39 @@
+/***************************************************************************
+ *   Copyright (C) 2009 by Lassi Väätämöinen   *
+ *   lassi.vaatamoinen@ixonos.com   *
+ *                                                                         *
+ *   This program 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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program 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 this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+#ifndef QBITTORRENTSESSION_H
+#define QBITTORRENTSESSION_H
+
+/**
+       @author Lassi Väätämöinen <lassi.vaatamoinen@ixonos.com>
+*/
+class QBittorrentSession {
+
+       public:
+    QBittorrentSession();
+
+    ~QBittorrentSession();
+       public slots:
+       private slots:
+       private:
+               
+
+};
+
+#endif
index 566e172..2344e7e 100644 (file)
@@ -1,2 +1,20 @@
-TEMPLATE = subdirs
+
+TEMPLATE = lib
+
+CONFIG += dll \
+ debug
+
+VERSION = 0.1
+
+HEADERS += AlertWaiterThread.h
+
+SOURCES += AlertWaiterThread.cpp
+
+QT -= gui
+
+CONFIG -= release
+
+TARGET = qtbittorrent
+
+DESTDIR = ../../bin
 
index dc1d73e..9615959 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "DownloadView.h"
 #include "SeedView.h"
+#include "AlertWaiterThread.h"
 
 #include "MainWindow.h"
 
@@ -85,6 +86,10 @@ MainWindow::MainWindow():
        
        addToolBar(Qt::TopToolBarArea, toolBar);
        connect(toolBar, SIGNAL(actionTriggered(QAction*)), this, SLOT(handleToolBarAction(QAction*)));
+       
+       alertWaiter_ = new AlertWaiterThread(this);
+       connect(alertWaiter_, SIGNAL(alert()), this, SLOT(on_alert()));
+       alertWaiter_->start();
 }
 
 
@@ -114,3 +119,7 @@ void MainWindow::handleToolBarAction(QAction* action)
        }
 }
 
+void MainWindow::on_alert()
+{
+       qDebug() << "MainWindow: got alert()";
+}
index fc89cdc..4bae579 100644 (file)
@@ -27,6 +27,8 @@ class QTabWidget;
 class DownloadView;
 class SeedView;
 
+class AlertWaiterThread;
+
 /**
        @author Lassi Väätämöinen <lassi.vaatamoinen@ixonos.com>
 */
@@ -44,10 +46,14 @@ class MainWindow : public QMainWindow {
                void on_aboutQtAction_clicked();
                void handleToolBarAction(QAction* action);
                
+               void on_alert();
+               
        private:
                QTabWidget *tabWidget_;
                DownloadView *dlView_;
                SeedView *seedView_;
+               
+               AlertWaiterThread *alertWaiter_;
 };
 
 #endif
index 8d105ec..24598ed 100644 (file)
@@ -14,5 +14,16 @@ CONFIG -= release
 CONFIG += debug \
  qtestlib
 
-DESTDIR = ../../
 
+TARGETDEPS += ../engine/liblibqtbittorrent.so
+
+DESTDIR = ../../bin
+
+INCLUDEPATH += ../engine
+
+LIBS += -L../../bin \
+  -lqtbittorrent \
+  -L/home/vaatala/Projects/qtrapids/trunk/bin \
+  -L../engine
+
+QMAKE_LFLAGS_DEBUG += -L.
index c6c5594..8923296 100644 (file)
@@ -1,14 +1,13 @@
 SUBDIRS += gui \
                                        engine
-SOURCES += qtrapids.cpp \
-           main.cpp 
-HEADERS += qtrapids.h 
+
 CONFIG += warn_on \
                                thread \
           qt
+
 TARGET = qtrapids
 DESTDIR = ../bin
-RESOURCES = application.qrc
+
 
 TEMPLATE = subdirs