Yay! QuasselTopia has a working core connection dialog now! Nothing else yet, GUI...
authorManuel Nickschas <sputnick@quassel-irc.org>
Thu, 6 Sep 2007 22:29:27 +0000 (22:29 +0000)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 6 Sep 2007 22:29:27 +0000 (22:29 +0000)
But you can connect to the core and the client (which is already fully functional on Qtopia!)
initializes correctly. Now all that's missing is a GUI for actually displaying the
client data... ;-)

Also, obsolete--

23 files changed:
Quassel.kdevelop.filelist
qtopia-build/quasseltopia.pro
src/client/client.cpp
src/core/core.cpp
src/core/coresession.cpp
src/images/icons.qrc
src/qtgui/mainwin.cpp
src/qtopia/coreconnectdlg.cpp [new file with mode: 0644]
src/qtopia/coreconnectdlg.h [new file with mode: 0644]
src/qtopia/example.cpp [deleted file]
src/qtopia/example.desktop [deleted file]
src/qtopia/example.h [deleted file]
src/qtopia/examplebase.ui [deleted file]
src/qtopia/main.cpp
src/qtopia/qtopia.pro
src/qtopia/qtopiagui.cpp [new file with mode: 0644]
src/qtopia/qtopiagui.h [new file with mode: 0644]
src/qtopia/qtopiamainwin.cpp [new file with mode: 0644]
src/qtopia/qtopiamainwin.h [new file with mode: 0644]
src/qtopia/quasseltopia.desktop [new file with mode: 0644]
src/qtopia/ui/coreconnectdlg.ui [new file with mode: 0644]
src/qtopia/ui/coreconnectprogressdlg.ui [new file with mode: 0644]
src/qtopia/ui/editcoreacctdlg.ui [new file with mode: 0644]

index 2458e69..6be6c32 100644 (file)
@@ -115,3 +115,15 @@ src/contrib/qxt/qxtmetaobject.h
 src/contrib/qxt/qxtnullable.h
 src/contrib/qxt/qxtnull.cpp
 src/contrib/qxt/qxtnull.h
 src/contrib/qxt/qxtnullable.h
 src/contrib/qxt/qxtnull.cpp
 src/contrib/qxt/qxtnull.h
+src/qtopia
+src/qtopia/main.cpp
+src/qtopia/qtopiamainwin.h
+src/qtopia/qtopiamainwin.cpp
+src/qtopia/qtopiagui.h
+src/qtopia/qtopiagui.cpp
+src/qtopia/coreconnectdlg.cpp
+src/qtopia/coreconnectdlg.h
+src/qtopia/ui
+src/qtopia/ui/coreconnectdlg.ui
+src/qtopia/ui/coreconnectprogressdlg.ui
+src/qtopia/ui/editcoreacctdlg.ui
index bb4a36f..62d0d60 100644 (file)
@@ -1,7 +1,7 @@
 qtopia_project(qtopia app)
 
 TARGET=quasseltopia
 qtopia_project(qtopia app)
 
 TARGET=quasseltopia
-CONFIG+=qtopia_main no_quicklaunch
+CONFIG+=debug qtopia_main no_quicklaunch
 
 # Find files
 INCLUDEPATH+=../src/qtopia ../src/client ../src/common ../src/contrib/qxt
 
 # Find files
 INCLUDEPATH+=../src/qtopia ../src/client ../src/common ../src/contrib/qxt
@@ -14,5 +14,27 @@ include(../src/qtopia/qtopia.pro)
 include(../src/client/client.pro)
 
 # SXE permissions required
 include(../src/client/client.pro)
 
 # SXE permissions required
-pkg.domain=none
+#pkg.domain=none
+#pkg.name=Quassel IRC
 
 
+desktop.files=../src/qtopia/quasseltopia.desktop
+desktop.path=/apps/Applications
+desktop.trtarget=example-nct
+desktop.hint=nct desktop
+
+#pics.files=pics/*
+#pics.path=/pics/example
+#pics.hint=pics
+
+#help.source=help
+#help.files=example.html
+#help.hint=help
+
+INSTALLS+=desktop
+
+pkg.name=QuasselTopia
+pkg.desc=Quassel IRC, a next-gen IRC client
+pkg.version=0.0.1-1
+pkg.maintainer=www.quassel-irc.org
+pkg.license=GPL
+pkg.domain=window
index f98fe72..8ee2f39 100644 (file)
@@ -121,10 +121,11 @@ bool Client::isConnected() {
 void Client::connectToCore(const QVariantMap &conn) {
   // TODO implement SSL
   coreConnectionInfo = conn;
 void Client::connectToCore(const QVariantMap &conn) {
   // TODO implement SSL
   coreConnectionInfo = conn;
-  if(isConnected() || socket != 0) {
+  if(isConnected()) {
     emit coreConnectionError(tr("Already connected to Core!"));
     return;
   }
     emit coreConnectionError(tr("Already connected to Core!"));
     return;
   }
+  if(socket != 0) socket->deleteLater();
   if(conn["Host"].toString().isEmpty()) {
     clientMode = LocalCore;
     socket = new QBuffer(this);
   if(conn["Host"].toString().isEmpty()) {
     clientMode = LocalCore;
     socket = new QBuffer(this);
@@ -176,6 +177,7 @@ void Client::coreSocketDisconnected() {
   connectedToCore = false;
   emit disconnected();
   socket->deleteLater();
   connectedToCore = false;
   emit disconnected();
   socket->deleteLater();
+  blockSize = 0;
 
   /* Clear internal data. Hopefully nothing relies on it at this point. */
   _bufferModel->clear();
 
   /* Clear internal data. Hopefully nothing relies on it at this point. */
   _bufferModel->clear();
@@ -205,6 +207,7 @@ void Client::recvCoreState(const QVariant &state) {
   syncToCore(state);
 }
 
   syncToCore(state);
 }
 
+// TODO: auth errors
 void Client::syncToCore(const QVariant &coreState) {
   if(!coreState.toMap().contains("SessionState")) {
     emit coreConnectionError(tr("Invalid data received from core!"));
 void Client::syncToCore(const QVariant &coreState) {
   if(!coreState.toMap().contains("SessionState")) {
     emit coreConnectionError(tr("Invalid data received from core!"));
@@ -261,6 +264,7 @@ QStringList Client::sessionDataKeys() {
 
 void Client::coreSocketError(QAbstractSocket::SocketError) {
   emit coreConnectionError(socket->errorString());
 
 void Client::coreSocketError(QAbstractSocket::SocketError) {
   emit coreConnectionError(socket->errorString());
+  socket->deleteLater();
 }
 
 void Client::coreHasData() {
 }
 
 void Client::coreHasData() {
index dc22a97..5159f93 100644 (file)
@@ -112,7 +112,7 @@ void Core::clientHasData() {
     try {
       processClientInit(socket, item);
     } catch(Storage::AuthError) {
     try {
       processClientInit(socket, item);
     } catch(Storage::AuthError) {
-      qWarning() << "Authentification error!";  // FIXME
+      qWarning() << "Authentification error!";  // FIXME: send auth error to client
       socket->close();
       return;
     } catch(Exception e) {
       socket->close();
       return;
     } catch(Exception e) {
@@ -156,6 +156,7 @@ void Core::processClientInit(QTcpSocket *socket, const QVariant &v) {
   QVariant reply = initSession(uid);
   disconnect(socket, 0, this, 0);
   sessions[uid]->addClient(socket);
   QVariant reply = initSession(uid);
   disconnect(socket, 0, this, 0);
   sessions[uid]->addClient(socket);
+  qDebug() << "Client initialized successfully.";
   writeDataToDevice(socket, reply);
 }
 
   writeDataToDevice(socket, reply);
 }
 
index 34ae160..f85cf55 100644 (file)
@@ -190,7 +190,7 @@ QVariant CoreSession::sessionState() {
   v["SessionData"] = sessionData;
   mutex.unlock();
   v["Networks"] = QVariant(servers.keys());
   v["SessionData"] = sessionData;
   mutex.unlock();
   v["Networks"] = QVariant(servers.keys());
-  // v["Payload"] = QByteArray(100000000, 'a');
+  // v["Payload"] = QByteArray(100000000, 'a');  // for testing purposes
   return v;
 }
 
   return v;
 }
 
index 9b6281c..2cff7ad 100644 (file)
@@ -89,6 +89,6 @@
         <file>default/view_split.png</file>
         <file>default/view_top_bottom.png</file>
         <file>default/wizard.png</file>
         <file>default/view_split.png</file>
         <file>default/view_top_bottom.png</file>
         <file>default/wizard.png</file>
-       <file>qirc-icon.png</file>
+        <file>qirc-icon.png</file>
     </qresource>
 </RCC>
     </qresource>
 </RCC>
index 2bc5cf7..36b3675 100644 (file)
@@ -37,7 +37,7 @@ MainWin::MainWin(QtGui *_gui, QWidget *parent) : QMainWindow(parent), gui(_gui)
   setWindowIconText("Quassel IRC");
 
   statusBar()->showMessage(tr("Waiting for core..."));
   setWindowIconText("Quassel IRC");
 
   statusBar()->showMessage(tr("Waiting for core..."));
-
+  
 }
 
 void MainWin::init() {
 }
 
 void MainWin::init() {
diff --git a/src/qtopia/coreconnectdlg.cpp b/src/qtopia/coreconnectdlg.cpp
new file mode 100644 (file)
index 0000000..d02d737
--- /dev/null
@@ -0,0 +1,247 @@
+/***************************************************************************
+ *   Copyright (C) 2005-07 by The Quassel IRC Development Team             *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   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 <QtGui>
+#include <QSoftMenuBar>
+
+#include "coreconnectdlg.h"
+#include "global.h"
+#include "client.h"
+#include "clientsettings.h"
+
+CoreConnectDlg::CoreConnectDlg(QWidget *parent, bool /*doAutoConnect*/) : QDialog(parent) {
+  ui.setupUi(this);
+
+  setAttribute(Qt::WA_DeleteOnClose);
+  setModal(true);
+
+  coreState = 0;
+
+  QMenu *menu = new QMenu(this);
+  newAccAction = new QAction(QIcon(":icon/new"), tr("New"), this);
+  delAccAction = new QAction(QIcon(":icon/trash"), tr("Delete"), this);
+  editAccAction = new QAction(QIcon(":icon/settings"), tr("Properties..."), this);
+  menu->addAction(newAccAction);
+  menu->addAction(delAccAction);
+  menu->addAction(editAccAction);
+  QSoftMenuBar::addMenuTo(this, menu);
+  QSoftMenuBar::setCancelEnabled(this, true);
+  ui.newAccount->setDefaultAction(newAccAction);
+  ui.delAccount->setDefaultAction(delAccAction);
+  ui.editAccount->setDefaultAction(editAccAction);
+  connect(newAccAction, SIGNAL(triggered()), this, SLOT(createAccount()));
+  connect(delAccAction, SIGNAL(triggered()), this, SLOT(removeAccount()));
+  connect(editAccAction, SIGNAL(triggered()), this, SLOT(editAccount()));
+  connect(ui.accountList, SIGNAL(itemSelectionChanged()), this, SLOT(setWidgetStates()));
+  connect(ui.doConnect, SIGNAL(clicked()), this, SLOT(doConnect()));
+
+  ui.accountList->setSelectionMode(QAbstractItemView::SingleSelection);
+  ui.accountList->setSortingEnabled(true);
+
+  AccountSettings s;
+  ui.accountList->addItems(s.knownAccounts());
+  if(ui.accountList->count()) ui.accountList->item(0)->setSelected(true);
+  setWidgetStates();
+}
+
+CoreConnectDlg::~CoreConnectDlg() {
+  //qDebug() << "destroy";
+}
+
+void CoreConnectDlg::setWidgetStates() {
+  editAccAction->setEnabled(ui.accountList->selectedItems().count());
+  delAccAction->setEnabled(ui.accountList->selectedItems().count());
+  ui.doConnect->setEnabled(ui.accountList->selectedItems().count());
+}
+
+void CoreConnectDlg::createAccount() {
+  editAccount("");
+}
+
+void CoreConnectDlg::editAccount() {
+  if(!ui.accountList->selectedItems().count()) return;
+  QString acc = ui.accountList->selectedItems()[0]->text();
+  editAccount(acc);
+}
+
+void CoreConnectDlg::editAccount(QString acc) {
+  EditCoreAcctDlg *dlg = new EditCoreAcctDlg(acc, this);
+  dlg->showMaximized();
+  int res = dlg->exec();
+  if(res == QDialog::Accepted) {
+    AccountSettings s;
+    ui.accountList->clear();
+    ui.accountList->addItems(s.knownAccounts());
+    QList<QListWidgetItem *> list = ui.accountList->findItems(dlg->accountName(), Qt::MatchExactly);
+    Q_ASSERT(list.count() == 1);
+    list[0]->setSelected(true);
+    setWidgetStates();
+  }
+  dlg->deleteLater();
+}
+
+void CoreConnectDlg::removeAccount() {
+  if(ui.accountList->selectedItems().count()) {
+    QListWidgetItem *item = ui.accountList->selectedItems()[0];
+    int res = QMessageBox::warning(this, tr("Delete account?"), tr("Do you really want to delete the data for the account '%1'?<br>"
+        "Note that this only affects your local account settings and will not remove "
+        "any data from the core.").arg(item->text()), QMessageBox::Yes|QMessageBox::No, QMessageBox::No);
+    if(res == QMessageBox::Yes) {
+      AccountSettings s;
+      s.removeAccount(item->text());
+      item = ui.accountList->takeItem(ui.accountList->row(item));
+      delete item;
+      setWidgetStates();
+    }
+  }
+}
+
+void CoreConnectDlg::doConnect() {
+  if(!ui.accountList->selectedItems().count()) return;
+  QString acc = ui.accountList->selectedItems()[0]->text();
+  AccountSettings s;
+  QVariantMap connInfo = s.value(acc, "AccountData").toMap();
+  connInfo["AccountName"] = acc;
+
+  progressDlg = new CoreConnectProgressDlg(this);
+  connect(progressDlg, SIGNAL(accepted()), this, SLOT(connectionSuccess()));
+  connect(progressDlg, SIGNAL(rejected()), this, SLOT(connectionFailure()));
+  progressDlg->showMaximized();
+  progressDlg->connectToCore(connInfo);
+}
+
+void CoreConnectDlg::connectionSuccess() {
+  if(progressDlg->isConnected()) {
+    progressDlg->deleteLater();
+    accept();
+  } else {
+    connectionFailure();
+  }
+}
+
+void CoreConnectDlg::connectionFailure() {
+  progressDlg->deleteLater();
+  Client::instance()->disconnectFromCore();
+}
+
+QVariant CoreConnectDlg::getCoreState() {
+  return coreState;
+}
+
+/****************************************************************************************************/
+
+EditCoreAcctDlg::EditCoreAcctDlg(QString accname, QDialog *parent) : QDialog(parent), accName(accname) {
+  ui.setupUi(this);
+  setModal(true);
+
+  ui.accountEdit->setText(accountName());
+  if(accName.isEmpty()) {
+    ui.port->setValue(DEFAULT_PORT);
+    ui.accountEdit->setFocus();
+  } else {
+    ui.hostEdit->setFocus();
+    AccountSettings s;
+    QVariantMap data = s.value(accName, "AccountData").toMap();
+    ui.hostEdit->setText(data["Host"].toString());
+    ui.port->setValue(data["Port"].toUInt());
+    ui.userEdit->setText(data["User"].toString());
+    //if(data.contains("Password")) {
+      ui.passwdEdit->setText(data["Password"].toString());
+    //  ui.rememberPasswd->setChecked(true);
+    //} else ui.rememberPasswd->setChecked(false);
+  }
+}
+
+QString EditCoreAcctDlg::accountName() const {
+  return accName;
+}
+
+void EditCoreAcctDlg::accept() {
+  AccountSettings s;
+  if(ui.userEdit->text().isEmpty() || ui.hostEdit->text().isEmpty() || ui.accountEdit->text().isEmpty()) {
+    int res = QMessageBox::warning(this, tr("Missing information"),
+                                   tr("Please enter all required information or discard changes to return to account selection."),
+                                      QMessageBox::Discard|QMessageBox::Retry);
+    if(res != QMessageBox::Retry) reject();
+    return;
+  }
+  if(ui.accountEdit->text() != accountName() && s.knownAccounts().contains(ui.accountEdit->text())) {
+    int res = QMessageBox::warning(this, tr("Non-unique account name"),
+                                   tr("Account names need to be unique. Please enter a different name or discard all changes to "
+                                      "return to account selection."),
+                                      QMessageBox::Discard|QMessageBox::Retry);
+    if(res != QMessageBox::Retry) reject();
+    ui.accountEdit->setSelection(0, ui.accountEdit->text().length());
+    ui.accountEdit->setFocus();
+    return;
+  }
+  if(accountName() != ui.accountEdit->text()) {
+    s.removeAccount(accountName());
+    accName = ui.accountEdit->text();
+  }
+  QVariantMap accData;
+  accData["User"] = ui.userEdit->text();
+  accData["Host"] = ui.hostEdit->text();
+  accData["Port"] = ui.port->value();
+  accData["Password"] = ui.passwdEdit->text();
+  s.setValue(accountName(), "AccountData", accData);
+  QDialog::accept();
+}
+
+/********************************************************************************************/
+
+CoreConnectProgressDlg::CoreConnectProgressDlg(QDialog *parent) : QDialog(parent) {
+  ui.setupUi(this);
+
+  setModal(true);
+
+  connectsuccess = false;
+
+  connect(Client::instance(), SIGNAL(coreConnectionMsg(const QString &)), ui.connectionStatus, SLOT(setText(const QString &)));
+  connect(Client::instance(), SIGNAL(coreConnectionProgress(uint, uint)), this, SLOT(updateProgressBar(uint, uint)));
+  connect(Client::instance(), SIGNAL(coreConnectionError(QString)), this, SLOT(coreConnectionError(QString)));
+  connect(Client::instance(), SIGNAL(connected()), this, SLOT(coreConnected()));
+
+}
+
+bool CoreConnectProgressDlg::isConnected() const {
+  return connectsuccess;
+}
+
+void CoreConnectProgressDlg::connectToCore(QVariantMap connInfo) {
+  Client::instance()->connectToCore(connInfo);
+
+}
+
+void CoreConnectProgressDlg::coreConnected() {
+  connectsuccess = true;
+  accept();
+}
+
+void CoreConnectProgressDlg::coreConnectionError(QString err) {
+  QMessageBox::warning(this, tr("Connection Error"), tr("<b>Could not connect to Quassel Core!</b><br>\n") + err, QMessageBox::Retry);
+  reject();
+}
+
+void CoreConnectProgressDlg::updateProgressBar(uint partial, uint total) {
+  ui.connectionProgress->setMaximum(total);
+  ui.connectionProgress->setValue(partial);
+}
+
diff --git a/src/qtopia/coreconnectdlg.h b/src/qtopia/coreconnectdlg.h
new file mode 100644 (file)
index 0000000..8f03ee0
--- /dev/null
@@ -0,0 +1,99 @@
+/***************************************************************************
+ *   Copyright (C) 2005-07 by The Quassel IRC Development Team             *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   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 _CORECONNECTDLG_H
+#define _CORECONNECTDLG_H
+
+#include "ui_coreconnectdlg.h"
+#include "ui_coreconnectprogressdlg.h"
+#include "ui_editcoreacctdlg.h"
+#include "global.h"
+
+class CoreConnectProgressDlg;
+
+class CoreConnectDlg : public QDialog {
+  Q_OBJECT
+
+  public:
+    CoreConnectDlg(QWidget *parent = 0, bool doAutoConnect = false);
+    ~CoreConnectDlg();
+    QVariant getCoreState();
+
+  private slots:
+    void createAccount();
+    void removeAccount();
+    void editAccount();
+    void setWidgetStates();
+    void doConnect();
+    void connectionSuccess();
+    void connectionFailure();
+
+  private:
+    Ui::CoreConnectDlg ui;
+    QVariant coreState;
+
+    void editAccount(QString);
+
+    QAction *newAccAction, *editAccAction, *delAccAction;
+
+    CoreConnectProgressDlg *progressDlg;
+};
+
+class EditCoreAcctDlg : public QDialog {
+  Q_OBJECT
+
+  public:
+    EditCoreAcctDlg(QString accname = 0, QDialog *parent = 0);
+    QString accountName() const;
+
+  public slots:
+    void accept();
+
+  private slots:
+
+
+  private:
+    Ui::EditCoreAcctDlg ui;
+    QString accName;
+
+};
+
+class CoreConnectProgressDlg : public QDialog {
+  Q_OBJECT
+
+  public:
+    CoreConnectProgressDlg(QDialog *parent = 0);
+    bool isConnected() const;
+
+  public slots:
+    void connectToCore(QVariantMap connInfo);
+
+  private slots:
+    void coreConnected();
+    void coreConnectionError(QString);
+    void updateProgressBar(uint partial, uint total);
+
+  private:
+    Ui::CoreConnectProgressDlg ui;
+    bool connectsuccess;
+
+};
+
+#endif
diff --git a/src/qtopia/example.cpp b/src/qtopia/example.cpp
deleted file mode 100644 (file)
index b6756a3..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2000-$THISYEAR$ $TROLLTECH$. All rights reserved.
-**
-** This file is part of the $MODULE$ of the Qtopia Toolkit.
-**
-** $TROLLTECH_DUAL_LICENSE$
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-****************************************************************************/
-
-#include "example.h"
-#include <qpushbutton.h>
-
-ExampleBase::ExampleBase( QWidget *parent, Qt::WFlags f )
-    : QWidget( parent, f )
-{
-    setupUi( this );
-}
-
-ExampleBase::~ExampleBase()
-{
-}
-
-/* 
- *  Constructs a Example which is a child of 'parent', with the 
- *  name 'name' and widget flags set to 'f' 
- */
-Example::Example( QWidget *parent, Qt::WFlags f )
-    : ExampleBase( parent, f )
-{
-    connect(quit, SIGNAL(clicked()), this, SLOT(goodBye()));
-}
-
-/*  
- *  Destroys the object and frees any allocated resources
- */
-Example::~Example()
-{
-    // no need to delete child widgets, Qt does it all for us
-}
-
-/*
- *  A simple slot... not very interesting.
- */
-void Example::goodBye()
-{
-    close();
-}
-
diff --git a/src/qtopia/example.desktop b/src/qtopia/example.desktop
deleted file mode 100644 (file)
index 3a4067d..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-[Translation]
-File=example-nct
-Context=Example
-
-[Desktop Entry]
-Comment[]=An Example Program
-Exec=quasseltest
-Icon=example/Example
-Type=Application
-Name[]=QuasselTest
diff --git a/src/qtopia/example.h b/src/qtopia/example.h
deleted file mode 100644 (file)
index 76d2bb0..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2000-$THISYEAR$ $TROLLTECH$. All rights reserved.
-**
-** This file is part of the $MODULE$ of the Qtopia Toolkit.
-**
-** $TROLLTECH_DUAL_LICENSE$
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-****************************************************************************/
-
-#ifndef EXAMPLE_H
-#define EXAMPLE_H
-#include "ui_examplebase.h"
-
-class ExampleBase : public QWidget, public Ui_ExampleBase
-{
-public:
-    ExampleBase( QWidget *parent = 0, Qt::WFlags f = 0 );
-    virtual ~ExampleBase();
-};
-
-class Example : public ExampleBase
-{ 
-    Q_OBJECT
-public:
-    Example( QWidget *parent = 0, Qt::WFlags f = 0 );
-    virtual ~Example();
-
-private slots:
-    void goodBye();
-};
-
-#endif // EXAMPLE_H
diff --git a/src/qtopia/examplebase.ui b/src/qtopia/examplebase.ui
deleted file mode 100644 (file)
index 55a3187..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<ui version="4.0" stdsetdef="1" >
-  <author></author>
-  <comment></comment>
-  <exportmacro></exportmacro>
-  <class>ExampleBase</class>
-  <widget class="QWidget" name="ExampleBase" >
-    <property name="geometry" >
-      <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>196</width>
-        <height>245</height>
-      </rect>
-    </property>
-    <property name="windowTitle" >
-      <string>Example</string>
-    </property>
-    <layout class="QVBoxLayout" >
-      <property name="margin" >
-        <number>11</number>
-      </property>
-      <property name="spacing" >
-        <number>6</number>
-      </property>
-      <item>
-        <widget class="QLabel" name="TextLabel1" >
-          <property name="text" >
-            <string>This is just an example! It doesn't do anything interesting at all.</string>
-          </property>
-          <property name="wordWrap" >
-            <bool>true</bool>
-          </property>
-        </widget>
-      </item>
-      <item>
-        <widget class="QPushButton" name="quit" >
-          <property name="text" >
-            <string>Quit</string>
-          </property>
-        </widget>
-      </item>
-    </layout>
-  </widget>
-</ui>
index 0d113bf..a99ebbb 100644 (file)
@@ -1,19 +1,26 @@
-/****************************************************************************
-**
-** Copyright (C) 2000-$THISYEAR$ $TROLLTECH$. All rights reserved.
-**
-** This file is part of the $MODULE$ of the Qtopia Toolkit.
-**
-** $TROLLTECH_DUAL_LICENSE$
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-****************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2005-07 by The Quassel Team                             *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   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 "example.h"
+#include "qtopiamainwin.h"
 #include <qtopia/qtopiaapplication.h>
 
 #include <qtopia/qtopiaapplication.h>
 
-QTOPIA_ADD_APPLICATION("example", Example)
+QTOPIA_ADD_APPLICATION("Quassel IRC", QtopiaMainWin)
 QTOPIA_MAIN
 
 QTOPIA_MAIN
 
index 4972eb7..263bbe8 100644 (file)
@@ -1,4 +1,4 @@
 # Input
 # Input
-HEADERS += example.h
-FORMS += examplebase.ui
-SOURCES += example.cpp main.cpp
+HEADERS += coreconnectdlg.h qtopiagui.h qtopiamainwin.h
+SOURCES += coreconnectdlg.cpp qtopiagui.cpp qtopiamainwin.cpp main.cpp
+FORMS += ui/coreconnectdlg.ui ui/coreconnectprogressdlg.ui ui/editcoreacctdlg.ui
diff --git a/src/qtopia/qtopiagui.cpp b/src/qtopia/qtopiagui.cpp
new file mode 100644 (file)
index 0000000..26251dd
--- /dev/null
@@ -0,0 +1,50 @@
+/***************************************************************************
+ *   Copyright (C) 2005-07 by The Quassel IRC Development Team             *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   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 "qtopiagui.h"
+#include "qtopiamainwin.h"
+
+QtopiaGui::QtopiaGui(QtopiaMainWin *mw) : AbstractUi(), mainWin(mw) {
+  connect(mainWin, SIGNAL(connectToCore(const QVariantMap &)), this, SIGNAL(connectToCore(const QVariantMap &)));
+  connect(mainWin, SIGNAL(disconnectFromCore()), this, SIGNAL(disconnectFromCore()));
+
+
+}
+
+QtopiaGui::~QtopiaGui() {
+  delete mainWin;
+
+}
+
+void QtopiaGui::init() {
+
+}
+
+AbstractUiMsg *QtopiaGui::layoutMsg(const Message &msg) {
+  return mainWin->layoutMsg(msg);
+}
+
+void QtopiaGui::connectedToCore() {
+  mainWin->connectedToCore();
+}
+
+void QtopiaGui::disconnectedFromCore() {
+  mainWin->disconnectedFromCore();
+}
diff --git a/src/qtopia/qtopiagui.h b/src/qtopia/qtopiagui.h
new file mode 100644 (file)
index 0000000..747e5d6
--- /dev/null
@@ -0,0 +1,47 @@
+/***************************************************************************
+ *   Copyright (C) 2005-07 by The Quassel IRC Development Team             *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   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 _QTOPIAGUI_H_
+#define _QTOPIAGUI_H_
+
+#include "quasselui.h"
+
+class QtopiaMainWin;
+
+//! This class encapsulates Quassel's GUI for Qtopia.
+class QtopiaGui : public AbstractUi {
+  Q_OBJECT
+
+  public:
+    QtopiaGui(QtopiaMainWin *mainWin);
+    ~QtopiaGui();
+    void init();
+    AbstractUiMsg *layoutMsg(const Message &);
+
+  protected slots:
+    void connectedToCore();
+    void disconnectedFromCore();
+
+  private:
+    QtopiaMainWin *mainWin;
+};
+
+
+#endif
diff --git a/src/qtopia/qtopiamainwin.cpp b/src/qtopia/qtopiamainwin.cpp
new file mode 100644 (file)
index 0000000..8625e02
--- /dev/null
@@ -0,0 +1,79 @@
+/***************************************************************************
+ *   Copyright (C) 2005-07 by The Quassel IRC Development Team             *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   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 "qtopiamainwin.h"
+
+#include "global.h"
+#include "message.h"
+#include "qtopiagui.h"
+#include "coreconnectdlg.h"
+
+// This constructor is the first thing to be called for a Qtopia app, so we do the init stuff
+// here (rather than in a main.cpp).
+QtopiaMainWin::QtopiaMainWin(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) {
+  qRegisterMetaType<QVariant>("QVariant");
+  qRegisterMetaType<Message>("Message");
+  qRegisterMetaType<BufferId>("BufferId");
+  qRegisterMetaTypeStreamOperators<QVariant>("QVariant");
+  qRegisterMetaTypeStreamOperators<Message>("Message");
+  qRegisterMetaTypeStreamOperators<BufferId>("BufferId");
+
+  Global::runMode = Global::ClientOnly;
+
+  QCoreApplication::setOrganizationDomain("quassel-irc.org");
+  QCoreApplication::setApplicationName("Quassel IRC");
+  QCoreApplication::setOrganizationName("Quassel IRC Development Team");
+
+  //Style::init();
+  QtopiaGui *gui = new QtopiaGui(this);
+  Client::init(gui);
+  //gui->init();
+
+  setWindowTitle("Quassel IRC");
+  //setWindowTitle(QString::fromUtf8("Κυασελ Εγαρζη"));
+  setWindowIcon(QIcon(":/qirc-icon.png"));
+  setWindowIconText("Quassel IRC");
+
+  CoreConnectDlg *dlg = new CoreConnectDlg(this);
+  //setCentralWidget(dlg);
+  dlg->showMaximized();
+  dlg->exec();
+}
+
+QtopiaMainWin::~QtopiaMainWin() {
+
+
+}
+
+void QtopiaMainWin::connectedToCore() {
+  foreach(BufferId id, Client::allBufferIds()) {
+    emit requestBacklog(id, 100, -1);
+  }
+}
+
+void QtopiaMainWin::disconnectedFromCore() {
+
+
+}
+
+AbstractUiMsg *QtopiaMainWin::layoutMsg(const Message &msg) {
+  //return new ChatLine(msg);
+  return 0;
+}
diff --git a/src/qtopia/qtopiamainwin.h b/src/qtopia/qtopiamainwin.h
new file mode 100644 (file)
index 0000000..2c5cbc4
--- /dev/null
@@ -0,0 +1,52 @@
+/***************************************************************************
+ *   Copyright (C) 2005-07 by The Quassel IRC Development Team             *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   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 _QTOPIAMAINWIN_H_
+#define _QTOPIAMAINWIN_H_
+
+#include <QtGui>
+
+#include "client.h"
+#include "global.h"
+
+class QtopiaMainWin : public QMainWindow {
+  Q_OBJECT
+
+  public:
+    QtopiaMainWin(QWidget *parent = 0, Qt::WFlags f = 0);
+    ~QtopiaMainWin();
+
+    AbstractUiMsg *layoutMsg(const Message &);
+
+  protected slots:
+    void connectedToCore();
+    void disconnectedFromCore();
+
+  signals:
+    void connectToCore(const QVariantMap &connInfo);
+    void disconnectFromCore();
+    void requestBacklog(BufferId, QVariant, QVariant);
+
+  private:
+
+    friend class QtopiaGui;
+};
+
+#endif
diff --git a/src/qtopia/quasseltopia.desktop b/src/qtopia/quasseltopia.desktop
new file mode 100644 (file)
index 0000000..e5c59c1
--- /dev/null
@@ -0,0 +1,10 @@
+[Translation]
+File=example-nct
+Context=QuasselIRC
+
+[Desktop Entry]
+Comment[]=A Next-Gen IRC Client
+Exec=quasseltopia
+Icon=example/Example
+Type=Application
+Name[]=QuasselIRC
diff --git a/src/qtopia/ui/coreconnectdlg.ui b/src/qtopia/ui/coreconnectdlg.ui
new file mode 100644 (file)
index 0000000..330ad55
--- /dev/null
@@ -0,0 +1,149 @@
+<ui version="4.0" >
+ <class>CoreConnectDlg</class>
+ <widget class="QDialog" name="CoreConnectDlg" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>188</width>
+    <height>283</height>
+   </rect>
+  </property>
+  <property name="sizePolicy" >
+   <sizepolicy>
+    <hsizetype>0</hsizetype>
+    <vsizetype>0</vsizetype>
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle" >
+   <string>Select Core Account</string>
+  </property>
+  <property name="windowIcon" >
+   <iconset/>
+  </property>
+  <property name="modal" >
+   <bool>false</bool>
+  </property>
+  <layout class="QVBoxLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item>
+    <widget class="QLabel" name="label_6" >
+     <property name="text" >
+      <string>Available Quassel Core accounts:</string>
+     </property>
+     <property name="textFormat" >
+      <enum>Qt::PlainText</enum>
+     </property>
+     <property name="wordWrap" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <widget class="QListWidget" name="accountList" />
+     </item>
+     <item>
+      <layout class="QVBoxLayout" >
+       <property name="margin" >
+        <number>0</number>
+       </property>
+       <property name="spacing" >
+        <number>6</number>
+       </property>
+       <item>
+        <widget class="QToolButton" name="newAccount" >
+         <property name="text" >
+          <string>...</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QToolButton" name="delAccount" >
+         <property name="text" >
+          <string>...</string>
+         </property>
+         <property name="icon" >
+          <iconset resource="../../images/icons.qrc" >:/default/edit_remove.png</iconset>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QToolButton" name="editAccount" >
+         <property name="text" >
+          <string>...</string>
+         </property>
+         <property name="icon" >
+          <iconset resource="../../images/icons.qrc" >:/default/edit.png</iconset>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="QPushButton" name="doConnect" >
+     <property name="text" >
+      <string>Connect</string>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <tabstops>
+  <tabstop>accountList</tabstop>
+  <tabstop>doConnect</tabstop>
+  <tabstop>newAccount</tabstop>
+  <tabstop>delAccount</tabstop>
+  <tabstop>editAccount</tabstop>
+  <tabstop>delAccount</tabstop>
+  <tabstop>editAccount</tabstop>
+  <tabstop>accountList</tabstop>
+  <tabstop>newAccount</tabstop>
+ </tabstops>
+ <resources>
+  <include location="../../images/icons.qrc" />
+ </resources>
+ <connections/>
+</ui>
diff --git a/src/qtopia/ui/coreconnectprogressdlg.ui b/src/qtopia/ui/coreconnectprogressdlg.ui
new file mode 100644 (file)
index 0000000..68e1ef8
--- /dev/null
@@ -0,0 +1,59 @@
+<ui version="4.0" >
+ <class>CoreConnectProgressDlg</class>
+ <widget class="QDialog" name="CoreConnectProgressDlg" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>156</width>
+    <height>183</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Connection Progress</string>
+  </property>
+  <layout class="QVBoxLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item>
+    <widget class="QLabel" name="connectionStatus" >
+     <property name="text" >
+      <string>Connecting...</string>
+     </property>
+     <property name="wordWrap" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QProgressBar" name="connectionProgress" >
+     <property name="value" >
+      <number>0</number>
+     </property>
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>31</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/qtopia/ui/editcoreacctdlg.ui b/src/qtopia/ui/editcoreacctdlg.ui
new file mode 100644 (file)
index 0000000..92207ea
--- /dev/null
@@ -0,0 +1,120 @@
+<ui version="4.0" >
+ <class>EditCoreAcctDlg</class>
+ <widget class="QDialog" name="EditCoreAcctDlg" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>193</width>
+    <height>241</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Edit Core Account</string>
+  </property>
+  <layout class="QVBoxLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item>
+    <layout class="QGridLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item row="2" column="0" >
+      <widget class="QLabel" name="portLabel" >
+       <property name="text" >
+        <string>Port:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="0" >
+      <widget class="QLabel" name="hostLabel" >
+       <property name="text" >
+        <string>Host:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="4" column="0" >
+      <widget class="QLabel" name="passwdLabel" >
+       <property name="text" >
+        <string>Password:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="1" >
+      <widget class="QLineEdit" name="hostEdit" />
+     </item>
+     <item row="0" column="1" >
+      <widget class="QLineEdit" name="accountEdit" />
+     </item>
+     <item row="3" column="1" >
+      <widget class="QLineEdit" name="userEdit" />
+     </item>
+     <item row="0" column="0" >
+      <widget class="QLabel" name="accountLabel" >
+       <property name="text" >
+        <string>Account:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="4" column="1" >
+      <widget class="QLineEdit" name="passwdEdit" >
+       <property name="echoMode" >
+        <enum>QLineEdit::Password</enum>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="1" >
+      <widget class="QSpinBox" name="port" >
+       <property name="maximum" >
+        <number>65535</number>
+       </property>
+       <property name="minimum" >
+        <number>1024</number>
+       </property>
+       <property name="value" >
+        <number>4242</number>
+       </property>
+      </widget>
+     </item>
+     <item row="3" column="0" >
+      <widget class="QLabel" name="userLabel" >
+       <property name="text" >
+        <string>User:</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <tabstops>
+  <tabstop>accountEdit</tabstop>
+  <tabstop>hostEdit</tabstop>
+  <tabstop>port</tabstop>
+  <tabstop>userEdit</tabstop>
+  <tabstop>passwdEdit</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>