Make the chatwidget remember column sizes. This should make EgS happy :)
authorManuel Nickschas <sputnick@quassel-irc.org>
Fri, 14 Dec 2007 18:12:37 +0000 (18:12 +0000)
committerManuel Nickschas <sputnick@quassel-irc.org>
Fri, 14 Dec 2007 18:12:37 +0000 (18:12 +0000)
src/qtui/chatwidget.cpp
src/qtui/guisettings.cpp
src/uisupport/uisettings.cpp [new file with mode: 0644]
src/uisupport/uisettings.h [new file with mode: 0644]
src/uisupport/uisupport.pri

index b0a06e3..b44e90c 100644 (file)
@@ -22,7 +22,7 @@
 #include "chatwidget.h"
 #include "chatline-old.h"
 #include "qtui.h"
 #include "chatwidget.h"
 #include "chatline-old.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 {
index c647d6f..af38427 100644 (file)
  *   Free Software Foundation, Inc.,                                       *
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
  *   Free Software Foundation, Inc.,                                       *
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
+
+#include "guisettings.h"
+
+GuiSettings::GuiSettings() : ClientSettings("GUI") {
+
+
+}
diff --git a/src/uisupport/uisettings.cpp b/src/uisupport/uisettings.cpp
new file mode 100644 (file)
index 0000000..2851644
--- /dev/null
@@ -0,0 +1,34 @@
+/***************************************************************************
+ *   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  *
+ *   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) version 3.                                           *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#include "uisettings.h"
+
+UiSettings::UiSettings() : ClientSettings("UI") {
+
+
+}
+
+void UiSettings::setValue(const QString &key, const QVariant &data) {
+  setLocalValue(key, data);
+}
+
+QVariant UiSettings::value(const QString &key, const QVariant &def) {
+  return localValue(key, def);
+}
diff --git a/src/uisupport/uisettings.h b/src/uisupport/uisettings.h
new file mode 100644 (file)
index 0000000..282190d
--- /dev/null
@@ -0,0 +1,50 @@
+/***************************************************************************
+ *   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  *
+ *   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) version 3.                                           *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#ifndef _UISETTINGS_H_
+#define _UISETTINGS_H_
+
+#include "clientsettings.h"
+
+class UiSettings : public ClientSettings {
+
+  public:
+    UiSettings();
+
+    void setValue(const QString &key, const QVariant &data);
+    QVariant value(const QString &key, const QVariant &def = QVariant());
+
+
+};
+
+/*
+class GuiProfile : public ClientSettings {
+
+  public:
+    GuiProfile();
+
+    static QStringList availableProfiles();
+    static GuiProfile *profile(QString name);
+
+    
+
+};
+*/
+#endif
index 9ed3309..0a8cb81 100644 (file)
@@ -1,8 +1,8 @@
 DEPMOD = common client
 QT_MOD = core gui network
 
 DEPMOD = common client
 QT_MOD = core gui network
 
-SRCS += bufferview.cpp bufferviewfilter.cpp inputline.cpp nickview.cpp tabcompleter.cpp uistyle.cpp
-HDRS += bufferview.h bufferviewfilter.h inputline.h nickview.h tabcompleter.h uistyle.h
+SRCS += bufferview.cpp bufferviewfilter.cpp inputline.cpp nickview.cpp tabcompleter.cpp uisettings.cpp uistyle.cpp
+HDRS += bufferview.h bufferviewfilter.h inputline.h nickview.h tabcompleter.h uisettings.h uistyle.h
 
 FORMNAMES = 
 
 
 FORMNAMES =