From adc222822ec7d872f2bcc0ca384e6ec5fd777287 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Wed, 28 Nov 2007 23:02:13 +0000 Subject: [PATCH] Now QuasselTopia can actually send text, not only receive! Also added a "fancy" welcome screen. Ah well. We need an artist. --- src/qtopia/mainwidget.cpp | 24 ++++++++++------ src/qtopia/mainwidget.h | 4 +++ src/qtopia/ui/mainwidget.ui | 55 +++++++++++++++++++++++++++++++------ 3 files changed, 65 insertions(+), 18 deletions(-) diff --git a/src/qtopia/mainwidget.cpp b/src/qtopia/mainwidget.cpp index 0c9a1ee8..520ba766 100644 --- a/src/qtopia/mainwidget.cpp +++ b/src/qtopia/mainwidget.cpp @@ -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 * @@ -25,13 +25,8 @@ 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(); } diff --git a/src/qtopia/mainwidget.h b/src/qtopia/mainwidget.h index 64c25961..360af068 100644 --- a/src/qtopia/mainwidget.h +++ b/src/qtopia/mainwidget.h @@ -36,10 +36,14 @@ class MainWidget : public QWidget { public slots: void setBuffer(Buffer *); + private slots: + void enterPressed(); + private: Ui::MainWidget ui; QHash chatWidgets; + Buffer *currentBuffer; }; diff --git a/src/qtopia/ui/mainwidget.ui b/src/qtopia/ui/mainwidget.ui index 6c669d0f..00027c63 100644 --- a/src/qtopia/ui/mainwidget.ui +++ b/src/qtopia/ui/mainwidget.ui @@ -5,26 +5,33 @@ 0 0 - 291 - 358 + 240 + 320 Form - + 0 - + + 0 + + + 0 + + + 0 + + 0 - - 3 - 5 + 0 0 @@ -44,11 +51,32 @@ 0 - + + + + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Trebuchet MS'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:29pt; color:#7fff00;">Quassel IRC</span></p> +<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;"><span style=" font-size:10pt;">mobile edition</span></p> +<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;"><span style=" font-size:6pt; color:#fff8dc;">Chat anywhere. Comfortably.</span></p></body></html> + + + true + + + Qt::AlignCenter + + + + + - + @@ -58,7 +86,16 @@ QPushButton
topicbar.h
+ + InputLine + QLineEdit +
inputline.h
+
+ + inputLine + topicBar + -- 2.20.1