Added nicklist for QuasselTopia. Various cosmetic and visual fixes.
authorManuel Nickschas <sputnick@quassel-irc.org>
Thu, 29 Nov 2007 02:16:45 +0000 (02:16 +0000)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 29 Nov 2007 02:16:45 +0000 (02:16 +0000)
No more crashing on text input.

Is it can be sleepsy tiem now?

12 files changed:
qtopia-build/quasseltopia.pro
src/qtopia/bufferviewwidget.cpp
src/qtopia/mainwidget.cpp
src/qtopia/nicklistwidget.cpp
src/qtopia/nicklistwidget.h
src/qtopia/qtopiamainwin.cpp
src/qtopia/qtopiamainwin.h
src/qtopia/quasseltopia.desktop
src/qtopia/ui/mainwidget.ui
src/qtopia/ui/nicklistwidget.ui
src/qtui/mainwin.cpp
src/uisupport/inputline.cpp

index a4db28b..5f26232 100644 (file)
@@ -33,14 +33,14 @@ desktop.path=/apps/Applications
 desktop.hint=nct desktop
 
 pics.files=../src/images/qirc-icon.png
 desktop.hint=nct desktop
 
 pics.files=../src/images/qirc-icon.png
-pics.path=/pics/quasselirc/
+pics.path=/pics/quasselirc
 pics.hint=pics
 
 #help.source=help
 #help.files=example.html
 #help.hint=help
 
 pics.hint=pics
 
 #help.source=help
 #help.files=example.html
 #help.hint=help
 
-INSTALLS+=desktop
+INSTALLS+=desktop pics
 
 pkg.name=QuasselTopia
 pkg.desc=Quassel IRC, a next-gen IRC client
 
 pkg.name=QuasselTopia
 pkg.desc=Quassel IRC, a next-gen IRC client
index b884cde..18afc46 100644 (file)
@@ -25,7 +25,7 @@
 BufferViewWidget::BufferViewWidget(QWidget *parent) : QDialog(parent) {
   ui.setupUi(this);
   setModal(true);
 BufferViewWidget::BufferViewWidget(QWidget *parent) : QDialog(parent) {
   ui.setupUi(this);
   setModal(true);
-  setStyleSheet("background-color: rgba(255, 255, 255, 40%); color: rgb(0, 0, 0); font-size: 5pt;");
+  setStyleSheet("background-color: rgba(220, 220, 255, 40%); color: rgb(0, 0, 0); font-size: 5pt;");
   //ui.tabWidget->tabBar()->setStyleSheet("font-size: 5pt;");
 
   // get rid of the default tab page designer forces upon us :(
   //ui.tabWidget->tabBar()->setStyleSheet("font-size: 5pt;");
 
   // get rid of the default tab page designer forces upon us :(
index 520ba76..b083a8e 100644 (file)
@@ -25,6 +25,7 @@
 
 MainWidget::MainWidget(QWidget *parent) : QWidget(parent) {
   ui.setupUi(this);
 
 MainWidget::MainWidget(QWidget *parent) : QWidget(parent) {
   ui.setupUi(this);
+  ui.inputLine->hide(); ui.topicBar->hide();
   connect(ui.inputLine, SIGNAL(returnPressed()), this, SLOT(enterPressed()));
   currentBuffer = 0;
 }
   connect(ui.inputLine, SIGNAL(returnPressed()), this, SLOT(enterPressed()));
   currentBuffer = 0;
 }
@@ -63,6 +64,7 @@ void MainWidget::setBuffer(Buffer *buf) {
     chatWidgets.insert(buf, chatWidget);
     chatWidget->setFocusProxy(ui.inputLine);
   } else chatWidget = chatWidgets[buf];
     chatWidgets.insert(buf, chatWidget);
     chatWidget->setFocusProxy(ui.inputLine);
   } else chatWidget = chatWidgets[buf];
+  ui.inputLine->show(); ui.topicBar->show();
   ui.stack->setCurrentWidget(chatWidget);
   ui.inputLine->setFocus();
   currentBuffer = buf;
   ui.stack->setCurrentWidget(chatWidget);
   ui.inputLine->setFocus();
   currentBuffer = buf;
index e53b6a3..36f524a 100644 (file)
  ***************************************************************************/
 
 #include "nicklistwidget.h"
  ***************************************************************************/
 
 #include "nicklistwidget.h"
-//#include "nicktreemodel.h"
+
+#include "buffer.h"
+#include "nickview.h"
 
 NickListWidget::NickListWidget(QWidget *parent) : QDialog(parent) {
   ui.setupUi(this);
 
 NickListWidget::NickListWidget(QWidget *parent) : QDialog(parent) {
   ui.setupUi(this);
-
+  setModal(true);
+  setStyleSheet("background-color: rgba(220, 220, 255, 40%); color: rgb(0, 0, 0); font-size: 5pt;");
 
 
 }
 
 
 }
@@ -34,7 +37,29 @@ NickListWidget::~NickListWidget() {
 
 }
 
 
 }
 
-void NickListWidget::setNickModel(NickTreeModel *model) {
-  //ui.nickView->setModel(model);
+void NickListWidget::setBuffer(Buffer *buf) {
+  if(!buf) {
+    ui.stackedWidget->setCurrentWidget(ui.emptyPage);
+    return;
+  }
+  if(buf->bufferType() != Buffer::ChannelType) {
+    ui.stackedWidget->setCurrentWidget(ui.emptyPage);
+  } else {
+    if(nickViews.contains(buf)) {
+      ui.stackedWidget->setCurrentWidget(nickViews.value(buf));
+    } else {
+      NickView *view = new NickView(this);
+      view->setModel(buf->nickModel());
+      nickViews[buf] = view;
+      ui.stackedWidget->addWidget(view);
+      ui.stackedWidget->setCurrentWidget(view);
+    }
+  }
+}
 
 
+void NickListWidget::reset() {
+  foreach(NickView *view, nickViews.values()) {
+    ui.stackedWidget->removeWidget(view);
+    view->deleteLater();
+  }
 }
 }
index 6f35716..7d1b109 100644 (file)
@@ -25,7 +25,8 @@
 
 #include "ui_nicklistwidget.h"
 
 
 #include "ui_nicklistwidget.h"
 
-class NickTreeModel;
+class Buffer;
+class NickView;
 
 class NickListWidget : public QDialog {
   Q_OBJECT
 
 class NickListWidget : public QDialog {
   Q_OBJECT
@@ -35,10 +36,12 @@ class NickListWidget : public QDialog {
     ~NickListWidget();
 
   public slots:
     ~NickListWidget();
 
   public slots:
-    void setNickModel(NickTreeModel *model);
+    void setBuffer(Buffer *);
+    void reset();
 
   private:
     Ui::NickListWidget ui;
 
   private:
     Ui::NickListWidget ui;
+    QHash<Buffer *, NickView *> nickViews;
 
 };
 
 
 };
 
index 6348a02..02bbe71 100644 (file)
@@ -32,6 +32,9 @@
 #include "signalproxy.h"
 
 #include <Qtopia>
 #include "signalproxy.h"
 
 #include <Qtopia>
+#include <QSoftMenuBar>
+
+#define DEBUGMODE
 
 // 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).
 
 // 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).
@@ -91,21 +94,42 @@ QtopiaMainWin::~QtopiaMainWin() {
 
 }
 
 
 }
 
+void QtopiaMainWin::closeEvent(QCloseEvent *event) {
+#ifndef DEBUGMODE
+  QMessageBox *box = new QMessageBox(QMessageBox::Question, tr("Quit Quassel IRC?"), tr("Do you really want to quit Quassel IRC?"),
+                                     QMessageBox::Cancel, this);
+  QAbstractButton *quit = box->addButton(tr("Quit"), QMessageBox::AcceptRole);
+  box->exec();
+  if(box->clickedButton() == quit) event->accept();
+  else event->ignore();
+  box->deleteLater();
+#else
+  event->accept();
+#endif
+}
+
 void QtopiaMainWin::setupActions() {
   showBuffersAction = toolBar->addAction(QIcon(":icon/options-hide"), "Show Buffers", this, SLOT(showBufferView()));  // FIXME provide real icon
   showNicksAction = toolBar->addAction(QIcon(":icon/list"), "Show Nicks", this, SLOT(showNickList()));
 
 void QtopiaMainWin::setupActions() {
   showBuffersAction = toolBar->addAction(QIcon(":icon/options-hide"), "Show Buffers", this, SLOT(showBufferView()));  // FIXME provide real icon
   showNicksAction = toolBar->addAction(QIcon(":icon/list"), "Show Nicks", this, SLOT(showNickList()));
 
+  QMenu *menu = new QMenu(this);
+  menu->addAction(showBuffersAction);
+  menu->addAction(showNicksAction);
+  QSoftMenuBar::addMenuTo(this, menu);
 }
 
 void QtopiaMainWin::connectedToCore() {
   foreach(BufferInfo id, Client::allBufferInfos()) {
     emit requestBacklog(id, 100, -1);
   }
 }
 
 void QtopiaMainWin::connectedToCore() {
   foreach(BufferInfo id, Client::allBufferInfos()) {
     emit requestBacklog(id, 100, -1);
   }
+
+#ifdef DEBUGMODE
   // FIXME just for testing: select first available buffer
   if(Client::allBufferInfos().count() > 1) {
     Buffer *b = Client::buffer(Client::allBufferInfos()[1]);
     Client::bufferModel()->selectBuffer(b);
   }
   // FIXME just for testing: select first available buffer
   if(Client::allBufferInfos().count() > 1) {
     Buffer *b = Client::buffer(Client::allBufferInfos()[1]);
     Client::bufferModel()->selectBuffer(b);
   }
+#endif
 }
 
 void QtopiaMainWin::disconnectedFromCore() {
 }
 
 void QtopiaMainWin::disconnectedFromCore() {
@@ -121,7 +145,7 @@ AbstractUiMsg *QtopiaMainWin::layoutMsg(const Message &msg) {
 void QtopiaMainWin::showBuffer(Buffer *b) {
   mainWidget->setBuffer(b);
   bufferViewWidget->hide();
 void QtopiaMainWin::showBuffer(Buffer *b) {
   mainWidget->setBuffer(b);
   bufferViewWidget->hide();
-  //nickListWidget->
+  nickListWidget->setBuffer(b);
 
 }
 
 
 }
 
index 6f93f62..23981cc 100644 (file)
@@ -52,6 +52,9 @@ class QtopiaMainWin : public QMainWindow {
     void showBufferView();
     void showNickList();
 
     void showBufferView();
     void showNickList();
 
+  protected:
+    void closeEvent(QCloseEvent *);
+
   private:
     void init();
     void setupActions();
   private:
     void init();
     void setupActions();
index e1ca46d..a71b48d 100644 (file)
@@ -5,6 +5,6 @@
 [Desktop Entry]
 Comment[]=A Next-Gen IRC Client
 Exec=quasseltopia
 [Desktop Entry]
 Comment[]=A Next-Gen IRC Client
 Exec=quasseltopia
-Icon=/pics/quasselirc/qirc-icon.png
+Icon=quasselirc/qirc-icon
 Type=Application
 Name[]=QuasselTopia
 Type=Application
 Name[]=QuasselTopia
index 00027c6..a4c192a 100644 (file)
@@ -52,6 +52,9 @@
       <number>0</number>
      </property>
      <widget class="QWidget" name="page" >
       <number>0</number>
      </property>
      <widget class="QWidget" name="page" >
+      <property name="styleSheet" >
+       <string>background-color: rgba(220, 220, 255, 40%)</string>
+      </property>
       <layout class="QVBoxLayout" >
        <item>
         <widget class="QLabel" name="label" >
       <layout class="QVBoxLayout" >
        <item>
         <widget class="QLabel" name="label" >
@@ -59,9 +62,9 @@
           <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
 p, li { white-space: pre-wrap; }
 &lt;/style>&lt;/head>&lt;body style=" font-family:'Trebuchet MS'; font-size:10pt; font-weight:400; font-style:normal;">
           <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
 p, li { white-space: pre-wrap; }
 &lt;/style>&lt;/head>&lt;body style=" font-family:'Trebuchet MS'; font-size:10pt; font-weight:400; font-style:normal;">
-&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:29pt; color:#7fff00;">Quassel IRC&lt;/span>&lt;/p>
-&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:29pt; color:#7fff00;">&lt;span style=" font-size:10pt;">mobile edition&lt;/span>&lt;/p>
-&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:29pt; color:#483d8b;">&lt;span style=" font-size:6pt; color:#fff8dc;">Chat anywhere. Comfortably.&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:29pt; color:#00008b;">Quassel IRC&lt;/span>&lt;/p>
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:29pt; color:#7fff00;">&lt;span style=" font-size:10pt; color:#00008b;">mobile edition&lt;/span>&lt;/p>
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:29pt; color:#483d8b;">&lt;span style=" font-size:6pt; color:#000000;">Chat comfortably. Anywhere.&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
          </property>
          <property name="scaledContents" >
           <bool>true</bool>
          </property>
          <property name="scaledContents" >
           <bool>true</bool>
index 889ddae..2287049 100644 (file)
@@ -6,37 +6,23 @@
     <x>0</x>
     <y>0</y>
     <width>240</width>
     <x>0</x>
     <y>0</y>
     <width>240</width>
-    <height>286</height>
+    <height>285</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <string>Nicks in Channel</string>
   </property>
   <layout class="QVBoxLayout" >
    </rect>
   </property>
   <property name="windowTitle" >
    <string>Nicks in Channel</string>
   </property>
   <layout class="QVBoxLayout" >
-   <property name="leftMargin" >
-    <number>1</number>
-   </property>
-   <property name="topMargin" >
-    <number>1</number>
-   </property>
-   <property name="rightMargin" >
-    <number>1</number>
-   </property>
-   <property name="bottomMargin" >
-    <number>1</number>
-   </property>
    <item>
    <item>
-    <widget class="NickView" name="nickView" />
+    <widget class="QStackedWidget" name="stackedWidget" >
+     <property name="currentIndex" >
+      <number>0</number>
+     </property>
+     <widget class="QWidget" name="emptyPage" />
+    </widget>
    </item>
   </layout>
  </widget>
    </item>
   </layout>
  </widget>
- <customwidgets>
-  <customwidget>
-   <class>NickView</class>
-   <extends>QTreeView</extends>
-   <header>nickview.h</header>
-  </customwidget>
- </customwidgets>
  <resources/>
  <connections/>
 </ui>
  <resources/>
  <connections/>
 </ui>
index c5ab8fd..8d39122 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
 /***************************************************************************
- *   Copyright (C) 2005-07 by The Quassel Team                             *
+ *   Copyright (C) 2005-07 by the Quassel IRC Team                         *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
index dbfb61c..aa1ff85 100644 (file)
@@ -58,7 +58,7 @@ void InputLine::keyPressEvent(QKeyEvent * event) {
 
 bool InputLine::event(QEvent *e) {
   if(e->type() == QEvent::KeyPress) {
 
 bool InputLine::event(QEvent *e) {
   if(e->type() == QEvent::KeyPress) {
-    keyPressEvent(dynamic_cast<QKeyEvent*>(e));
+    keyPressEvent(static_cast<QKeyEvent*>(e));
     return true;
   }
   return QLineEdit::event(e);
     return true;
   }
   return QLineEdit::event(e);