X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatwidget.cpp;h=098961d84b51a72434ffff60a6df9ae6a2ac548d;hp=5a3ab40354b8145fae5b765380b9055c76a4acc8;hb=8699dd758516d0ded076811e8ea656adc95e69d0;hpb=9fd4619e9aca7d53d7c5df156a0b25956a1bf682;ds=sidebyside diff --git a/src/qtui/chatwidget.cpp b/src/qtui/chatwidget.cpp index 5a3ab403..098961d8 100644 --- a/src/qtui/chatwidget.cpp +++ b/src/qtui/chatwidget.cpp @@ -1,11 +1,11 @@ /*************************************************************************** - * Copyright (C) 2005-07 by The Quassel Team * + * Copyright (C) 2005-08 by the Quassel Project * * 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. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -19,10 +19,10 @@ ***************************************************************************/ #include "util.h" -#include "style.h" #include "chatwidget.h" -#include "chatline.h" - +#include "chatline-old.h" +#include "qtui.h" +#include "uisettings.h" ChatWidget::ChatWidget(QWidget *parent) : QAbstractScrollArea(parent) { //setAutoFillBackground(false); @@ -50,8 +50,11 @@ void ChatWidget::init(QString netname, QString bufname) { bufferName = bufname; setBackgroundRole(QPalette::Base); setFont(QFont("Fixed")); - tsWidth = 90; - senderWidth = 100; + UiSettings s; + QVariant tsDef = s.value("DefaultTimestampColumnWidth", 90); + QVariant senderDef = s.value("DefaultSenderColumnWidth", 100); + tsWidth = s.value(QString("%1/%2/TimestampColumnWidth").arg(netname, bufname), tsDef).toInt(); + senderWidth = s.value(QString("%1/%2/SenderColumnWidth").arg(netname, bufname), senderDef).toInt(); computePositions(); adjustScrollBar(); verticalScrollBar()->setValue(verticalScrollBar()->maximum()); @@ -72,6 +75,11 @@ ChatWidget::~ChatWidget() { //foreach(ChatLine *l, lines) { // delete l; //} + UiSettings s; + s.setValue("DefaultTimestampColumnWidth", tsWidth); // FIXME stupid dirty quicky + s.setValue("DefaultSenderColumnWidth", senderWidth); + s.setValue(QString("%1/%2/TimestampColumnWidth").arg(networkName, bufferName), tsWidth); + s.setValue(QString("%1/%2/SenderColumnWidth").arg(networkName, bufferName), senderWidth); } QSize ChatWidget::sizeHint() const { @@ -233,10 +241,10 @@ void ChatWidget::setContents(QList list) { //!\brief Computes the different x position vars for given tsWidth and senderWidth. void ChatWidget::computePositions() { - senderX = tsWidth + Style::sepTsSender(); - textX = senderX + senderWidth + Style::sepSenderText(); - tsGrabPos = tsWidth + (int)Style::sepTsSender()/2; - senderGrabPos = senderX + senderWidth + (int)Style::sepSenderText()/2; + senderX = tsWidth + QtUi::style()->sepTsSender(); + textX = senderX + senderWidth + QtUi::style()->sepSenderText(); + tsGrabPos = tsWidth + (int)QtUi::style()->sepTsSender()/2; + senderGrabPos = senderX + senderWidth + (int)QtUi::style()->sepSenderText()/2; textWidth = viewport()->size().width() - textX; } @@ -460,15 +468,15 @@ void ChatWidget::handleMouseMoveEvent(const QPoint &_pos) { break; } // Pass 2: Some mouse modes need work after being set... - if(mouseMode == DragTsSep && x < size().width() - Style::sepSenderText() - senderWidth - 10) { + if(mouseMode == DragTsSep && x < size().width() - QtUi::style()->sepSenderText() - senderWidth - 10) { // Drag first column separator - int foo = Style::sepTsSender()/2; + int foo = QtUi::style()->sepTsSender()/2; tsWidth = qMax(x, foo) - foo; computePositions(); layout(); } else if(mouseMode == DragTextSep && x < size().width() - 10) { // Drag second column separator - int foo = tsWidth + Style::sepTsSender() + Style::sepSenderText()/2; + int foo = tsWidth + QtUi::style()->sepTsSender() + QtUi::style()->sepSenderText()/2; senderWidth = qMax(x, foo) - foo; computePositions(); layout(); @@ -534,8 +542,8 @@ QString ChatWidget::selectionToString() { if(selectionMode == LinesSelected) { QString result; for(int l = selectionStart; l <= selectionEnd; l++) { - result += QString("[%1] %2 %3\n").arg(lines[l]->timeStamp().toLocalTime().toString("hh:mm:ss")) - .arg(lines[l]->sender()).arg(lines[l]->text()); + result += QString("[%1] %2 %3\n").arg(lines[l]->timestamp().toLocalTime().toString("hh:mm:ss")) + . arg(lines[l]->sender()).arg(lines[l]->text()); } return result; }