Fix license headers: Quassel IRC Team -> Quassel Project, 2007 -> 2008
[quassel.git] / src / qtui / chatwidget.cpp
index 68d63da..098961d 100644 (file)
@@ -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     *
  *   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        *
  *                                                                         *
  *   This program is distributed in the hope that it will be useful,       *
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
@@ -20,9 +20,9 @@
 
 #include "util.h"
 #include "chatwidget.h"
 
 #include "util.h"
 #include "chatwidget.h"
-#include "chatline.h"
+#include "chatline-old.h"
 #include "qtui.h"
 #include "qtui.h"
-
+#include "uisettings.h"
 
 ChatWidget::ChatWidget(QWidget *parent) : QAbstractScrollArea(parent) {
   //setAutoFillBackground(false);
 
 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"));
   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());
   computePositions();
   adjustScrollBar();
   verticalScrollBar()->setValue(verticalScrollBar()->maximum());
@@ -72,6 +75,11 @@ ChatWidget::~ChatWidget() {
   //foreach(ChatLine *l, lines) {
   //  delete l;
   //}
   //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 {
 }
 
 QSize ChatWidget::sizeHint() const {
@@ -534,8 +542,8 @@ QString ChatWidget::selectionToString() {
   if(selectionMode == LinesSelected) {
     QString result;
     for(int l = selectionStart; l <= selectionEnd; l++) {
   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;
   }
     }
     return result;
   }