From 74ae1c41fcc42d21775b0b95541f17b0e7e67b51 Mon Sep 17 00:00:00 2001 From: Max-Wilhelm Bruker Date: Sun, 23 Aug 2009 17:06:12 +0200 Subject: [PATCH] chat improvements --- cockatrice/src/chatwidget.cpp | 19 ++++-- cockatrice/translations/cockatrice_de.ts | 73 ++++++++++++------------ cockatrice/translations/cockatrice_en.ts | 73 +++++++++++------------- 3 files changed, 83 insertions(+), 82 deletions(-) diff --git a/cockatrice/src/chatwidget.cpp b/cockatrice/src/chatwidget.cpp index ae8350fd..d42e7ef1 100644 --- a/cockatrice/src/chatwidget.cpp +++ b/cockatrice/src/chatwidget.cpp @@ -6,6 +6,7 @@ ChannelWidget::ChannelWidget(Client *_client, const QString &_name, bool readOnl : QWidget(parent), client(_client), name(_name), virtualChannel(_virtualChannel) { playerList = new QListWidget; + playerList->setFixedWidth(100); textEdit = new QTextEdit; textEdit->setReadOnly(true); @@ -22,7 +23,6 @@ ChannelWidget::ChannelWidget(Client *_client, const QString &_name, bool readOnl QHBoxLayout *hbox = new QHBoxLayout; hbox->addLayout(vbox); hbox->addWidget(playerList); - playerList->setFixedWidth(100); setLayout(hbox); } @@ -76,6 +76,8 @@ ChatWidget::ChatWidget(Client *_client, QWidget *parent) : QWidget(parent), client(_client) { channelList = new QTreeWidget; + channelList->setRootIsDecorated(false); + channelList->setFixedWidth(200); joinButton = new QPushButton; connect(joinButton, SIGNAL(clicked()), this, SLOT(joinClicked())); @@ -103,8 +105,8 @@ void ChatWidget::retranslateUi() QTreeWidgetItem *header = channelList->headerItem(); Q_ASSERT(header != 0); header->setText(0, tr("Channel")); - header->setText(1, tr("Description")); - header->setText(2, tr("Players")); + header->setText(1, tr("Players")); + header->setTextAlignment(1, Qt::AlignRight); } void ChatWidget::enableChat() @@ -136,12 +138,17 @@ void ChatWidget::chatEvent(const ChatEventData &data) for (int i = 0; i < channelList->topLevelItemCount(); ++i) { QTreeWidgetItem *twi = channelList->topLevelItem(i); if (twi->text(0) == msg[0]) { - twi->setText(1, msg[1]); - twi->setText(2, msg[2]); + twi->setToolTip(0, msg[1]); + twi->setText(1, msg[2]); return; } } - channelList->addTopLevelItem(new QTreeWidgetItem(QStringList() << msg[0] << msg[1] << msg[2])); + QTreeWidgetItem *twi = new QTreeWidgetItem(QStringList() << msg[0] << msg[2]); + twi->setTextAlignment(1, Qt::AlignRight); + twi->setToolTip(0, msg[1]); + channelList->addTopLevelItem(twi); + channelList->resizeColumnToContents(0); + channelList->resizeColumnToContents(1); if (msg[3] == "1") joinChannel(msg[0]); break; diff --git a/cockatrice/translations/cockatrice_de.ts b/cockatrice/translations/cockatrice_de.ts index 0255789e..834020f2 100644 --- a/cockatrice/translations/cockatrice_de.ts +++ b/cockatrice/translations/cockatrice_de.ts @@ -55,22 +55,22 @@ CardInfoWidget - + Name: Name: - + Mana cost: Manakosten: - + Card type: Kartentyp: - + P / T: S/W: @@ -86,12 +86,12 @@ ChannelWidget - + %1 has joined the channel. - %1hat den Raum betreten. + %1 hat den Raum betreten. - + %1 has left the channel. %1 hat den Raum verlassen. @@ -99,22 +99,21 @@ ChatWidget - + Joi&n Teil&nehmen - + Channel Raum - Description - Beschreibung + Beschreibung - + Players Spielerzahl @@ -572,32 +571,32 @@ GameSelector - + C&reate Spiel e&rstellen - + &Join &Teilnehmen - + Error Fehler - + XXX XXX - + Join game Spiel beitreten - + Password: Passwort: @@ -695,97 +694,97 @@ MainWindow - + Error Fehler - + Server timeout Server Zeitüberschreitung - + &Connect... &Verbinden... - + &Disconnect Verbindung &trennen - + &Restart game... Spiel neu sta&rten... - + F2 F2 - + &Leave game Spiel ver&lassen - + &Deck editor &Deck-Editor - + &Full screen &Vollbild - + Ctrl+F Ctrl+F - + &Settings... &Einstellungen... - + &Exit &Beenden - + Close most recent zone view Letzte Zonenansicht schließen - + Esc Esc - + &Game Spi&el - + &Actions &Aktionen - + &Card &Karte - + &Say: &Sagen: - + Cockatrice Cockatrice diff --git a/cockatrice/translations/cockatrice_en.ts b/cockatrice/translations/cockatrice_en.ts index 63903b19..c021d286 100644 --- a/cockatrice/translations/cockatrice_en.ts +++ b/cockatrice/translations/cockatrice_en.ts @@ -32,22 +32,22 @@ CardInfoWidget - + Name: - + Mana cost: - + Card type: - + P / T: @@ -55,12 +55,12 @@ ChannelWidget - + %1 has joined the channel. - + %1 has left the channel. @@ -68,22 +68,17 @@ ChatWidget - + Joi&n - + Channel - - Description - - - - + Players @@ -478,32 +473,32 @@ GameSelector - + C&reate - + &Join - + Error - + XXX - + Join game - + Password: @@ -601,97 +596,97 @@ MainWindow - + Error - + Server timeout - + &Connect... - + &Disconnect - + &Restart game... - + F2 - + &Leave game - + &Deck editor - + &Full screen - + Ctrl+F - + &Settings... - + &Exit - + Close most recent zone view - + Esc - + &Game - + &Actions - + &Card - + &Say: - + Cockatrice