Now QuasselTopia can actually send text, not only receive!
authorManuel Nickschas <sputnick@quassel-irc.org>
Wed, 28 Nov 2007 23:02:13 +0000 (23:02 +0000)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 28 Nov 2007 23:02:13 +0000 (23:02 +0000)
Also added a "fancy" welcome screen. Ah well. We need an artist.

src/qtopia/mainwidget.cpp
src/qtopia/mainwidget.h
src/qtopia/ui/mainwidget.ui

index 0c9a1ee..520ba76 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-07 by The Quassel IRC Development 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  *
 
 MainWidget::MainWidget(QWidget *parent) : QWidget(parent) {
   ui.setupUi(this);
-
-//  ui.bufferLeft->setIcon(QIcon(":icon/left"));
-//  ui.bufferRight->setIcon(QIcon(":icon/right"));
-  //ui.bufferLeft->setIconSize(QSize(10, 10));
-  //ui.bufferRight->setIconSize(QSize(10, 10));
-  //ui.bufferLeft->setMaximumSize(QSize(10,10));
-  //ui.bufferRight->setMaximumSize(QSize(10,10));
+  connect(ui.inputLine, SIGNAL(returnPressed()), this, SLOT(enterPressed()));
+  currentBuffer = 0;
 }
 
 MainWidget::~MainWidget() {
@@ -66,7 +61,18 @@ void MainWidget::setBuffer(Buffer *buf) {
     //connect(buf, SIGNAL(ownNickSet(QString)), this, SLOT(setOwnNick(QString)));
     ui.stack->addWidget(chatWidget);
     chatWidgets.insert(buf, chatWidget);
-    ui.stack->addWidget(chatWidget);
+    chatWidget->setFocusProxy(ui.inputLine);
   } else chatWidget = chatWidgets[buf];
   ui.stack->setCurrentWidget(chatWidget);
+  ui.inputLine->setFocus();
+  currentBuffer = buf;
+}
+
+void MainWidget::enterPressed() {
+  QStringList lines = ui.inputLine->text().split('\n', QString::SkipEmptyParts);
+  foreach(QString msg, lines) {
+    if(msg.isEmpty()) continue;
+    if(currentBuffer) currentBuffer->processUserInput(msg);
+  }
+  ui.inputLine->clear();
 }
index 64c2596..360af06 100644 (file)
@@ -36,10 +36,14 @@ class MainWidget : public QWidget {
   public slots:
     void setBuffer(Buffer *);
 
+  private slots:
+    void enterPressed();
+
   private:
     Ui::MainWidget ui;
     QHash<Buffer *, ChatWidget *> chatWidgets;
 
+    Buffer *currentBuffer;
 
 };
 
index 6c669d0..00027c6 100644 (file)
@@ -5,26 +5,33 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>291</width>
-    <height>358</height>
+    <width>240</width>
+    <height>320</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <string>Form</string>
   </property>
   <layout class="QVBoxLayout" >
-   <property name="margin" >
+   <property name="spacing" >
     <number>0</number>
    </property>
-   <property name="spacing" >
+   <property name="leftMargin" >
+    <number>0</number>
+   </property>
+   <property name="topMargin" >
+    <number>0</number>
+   </property>
+   <property name="rightMargin" >
+    <number>0</number>
+   </property>
+   <property name="bottomMargin" >
     <number>0</number>
    </property>
    <item>
     <widget class="TopicBar" name="topicBar" >
      <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>3</hsizetype>
-       <vsizetype>5</vsizetype>
+      <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
      <property name="currentIndex" >
       <number>0</number>
      </property>
-     <widget class="QWidget" name="page" />
+     <widget class="QWidget" name="page" >
+      <layout class="QVBoxLayout" >
+       <item>
+        <widget class="QLabel" name="label" >
+         <property name="text" >
+          <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>
+         </property>
+         <property name="scaledContents" >
+          <bool>true</bool>
+         </property>
+         <property name="alignment" >
+          <set>Qt::AlignCenter</set>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
     </widget>
    </item>
    <item>
-    <widget class="QLineEdit" name="inputLine" />
+    <widget class="InputLine" name="inputLine" />
    </item>
   </layout>
  </widget>
    <extends>QPushButton</extends>
    <header>topicbar.h</header>
   </customwidget>
+  <customwidget>
+   <class>InputLine</class>
+   <extends>QLineEdit</extends>
+   <header>inputline.h</header>
+  </customwidget>
  </customwidgets>
+ <tabstops>
+  <tabstop>inputLine</tabstop>
+  <tabstop>topicBar</tabstop>
+ </tabstops>
  <resources/>
  <connections/>
 </ui>