Revert "fixing BR #264 (core crash after join)"
authorMarcus Eggenberger <egs@quassel-irc.org>
Sun, 10 Aug 2008 11:58:40 +0000 (13:58 +0200)
committerMarcus Eggenberger <egs@quassel-irc.org>
Sun, 10 Aug 2008 11:58:40 +0000 (13:58 +0200)
This reverts commit ce4dc5d6d32af97589c15529f67f15218c381488.

src/core/ircserverhandler.cpp
src/qtui/chatlinemodelitem.cpp
src/qtui/chatlinemodelitem.h

index b6879bb..58a2302 100644 (file)
@@ -216,12 +216,6 @@ void IrcServerHandler::handleMode(const QString &prefix, const QList<QByteArray>
     emit displayMsg(Message::Mode, BufferInfo::ChannelBuffer, serverDecode(params[0]), serverDecode(params).join(" "), prefix);
 
     IrcChannel *channel = network()->ircChannel(params[0]);
     emit displayMsg(Message::Mode, BufferInfo::ChannelBuffer, serverDecode(params[0]), serverDecode(params).join(" "), prefix);
 
     IrcChannel *channel = network()->ircChannel(params[0]);
-    if(!channel) {
-      // we received mode information for a channel we're not in. that means probably we've just been kicked out or something like that
-      // anyways: we don't have a place to store the data --> discard the info.
-      return;
-    }
-
     QString modes = params[1];
     bool add = true;
     int paramOffset = 2;
     QString modes = params[1];
     bool add = true;
     int paramOffset = 2;
index 9b9e71c..84832cd 100644 (file)
 #include "qtui.h"
 #include "uistyle.h"
 
 #include "qtui.h"
 #include "uistyle.h"
 
-// This Struct is taken from Harfbuzz. We use it only to calc it's size.
-// we use a shared memory region so we do not have to malloc a buffer area for every line
-typedef struct {
-    /*HB_LineBreakType*/ unsigned lineBreakType  :2;
-    /*HB_Bool*/ unsigned whiteSpace              :1;     /* A unicode whitespace character, except NBSP, ZWNBSP */
-    /*HB_Bool*/ unsigned charStop                :1;     /* Valid cursor position (for left/right arrow) */
-    /*HB_Bool*/ unsigned wordBoundary            :1;
-    /*HB_Bool*/ unsigned sentenceBoundary        :1;
-    unsigned unused                  :2;
-} HB_CharAttributes_Dummy;
-
-unsigned char *ChatLineModelItem::TextBoundaryFinderBuffer = (unsigned char *)malloc(512 * sizeof(HB_CharAttributes_Dummy));
-int ChatLineModelItem::TextBoundaryFinderBufferSize = 512 * (sizeof(HB_CharAttributes_Dummy) / sizeof(unsigned char));
-
-ChatLineModelItem::ChatLineModelItem(const Message &msg)
-  : MessageModelItem(msg)
-{
+ChatLineModelItem::ChatLineModelItem(const Message &msg) : MessageModelItem(msg) {
   QtUiStyle::StyledMessage m = QtUi::style()->styleMessage(msg);
 
   _timestamp.plainText = m.timestamp.plainText;
   QtUiStyle::StyledMessage m = QtUi::style()->styleMessage(msg);
 
   _timestamp.plainText = m.timestamp.plainText;
@@ -58,49 +42,40 @@ ChatLineModelItem::ChatLineModelItem(const Message &msg)
 
 
 QVariant ChatLineModelItem::data(int column, int role) const {
 
 
 QVariant ChatLineModelItem::data(int column, int role) const {
-  const ChatLinePart *part = 0;
+  const ChatLinePart *part;
 
   switch(column) {
 
   switch(column) {
-  case ChatLineModel::TimestampColumn:
-    part = &_timestamp;
-    break;
-  case ChatLineModel::SenderColumn:
-    part = &_sender;
-    break;
-  case ChatLineModel::ContentsColumn:
-    part = &_contents;
-    break;
-  default:
-    return MessageModelItem::data(column, role);
+    case ChatLineModel::TimestampColumn: part = &_timestamp; break;
+    case ChatLineModel::SenderColumn:    part = &_sender; break;
+    case ChatLineModel::ContentsColumn:      part = &_contents; break;
+    default: return MessageModelItem::data(column, role);
   }
 
   switch(role) {
   }
 
   switch(role) {
-  case ChatLineModel::DisplayRole:
-    return part->plainText;
-  case ChatLineModel::FormatRole:
-    return QVariant::fromValue<UiStyle::FormatList>(part->formatList);
-  case ChatLineModel::WrapListRole:
-    if(column != ChatLineModel::ContentsColumn)
-      return QVariant();
-    return QVariant::fromValue<ChatLineModel::WrapList>(_wrapList);
+    case ChatLineModel::DisplayRole:
+      return part->plainText;
+    case ChatLineModel::FormatRole:
+      return QVariant::fromValue<UiStyle::FormatList>(part->formatList);
+    case ChatLineModel::WrapListRole:
+      if(column != ChatLineModel::ContentsColumn) return QVariant();
+      return QVariant::fromValue<ChatLineModel::WrapList>(_wrapList);
   }
   }
+
   return MessageModelItem::data(column, role);
 }
 
   return MessageModelItem::data(column, role);
 }
 
-void ChatLineModelItem::computeWrapList() {
-  if(_contents.plainText.isEmpty())
-    return;
+bool ChatLineModelItem::setData(int column, const QVariant &value, int role) {
+  return false;
+}
 
 
+void ChatLineModelItem::computeWrapList() {
   enum Mode { SearchStart, SearchEnd };
 
   QList<ChatLineModel::Word> wplist;  // use a temp list which we'll later copy into a QVector for efficiency
   enum Mode { SearchStart, SearchEnd };
 
   QList<ChatLineModel::Word> wplist;  // use a temp list which we'll later copy into a QVector for efficiency
-  // QTextBoundaryFinder finder(QTextBoundaryFinder::Word, _contents.plainText);
-  QTextBoundaryFinder finder(QTextBoundaryFinder::Word, _contents.plainText.unicode(), _contents.plainText.length(), TextBoundaryFinderBuffer, TextBoundaryFinderBufferSize);
-
+  QTextBoundaryFinder finder(QTextBoundaryFinder::Word, _contents.plainText);
   int idx;
   int oldidx = 0;
   int idx;
   int oldidx = 0;
-  bool wordStart = false;
-  bool wordEnd = false;
+  bool wordStart = false; bool wordEnd = false;
   Mode mode = SearchEnd;
   ChatLineModel::Word word;
   word.start = 0;
   Mode mode = SearchEnd;
   ChatLineModel::Word word;
   word.start = 0;
index a2ef9b9..a4df520 100644 (file)
 #define CHATLINEMODELITEM_H_
 
 #include <QVector>
 #define CHATLINEMODELITEM_H_
 
 #include <QVector>
+#include <QPair>
 
 #include "chatlinemodel.h"
 #include "uistyle.h"
 
 class ChatLineModelItem : public MessageModelItem {
 
 #include "chatlinemodel.h"
 #include "uistyle.h"
 
 class ChatLineModelItem : public MessageModelItem {
-public:
-  ChatLineModelItem(const Message &);
 
 
-  virtual QVariant data(int column, int role) const;
-  virtual inline bool setData(int column, const QVariant &value, int role) { return false; }
+  public:
 
 
-private:
-  void computeWrapList();
+    ChatLineModelItem(const Message &);
+    //virtual ~ChatLineModelItem() {};
 
 
-  struct ChatLinePart {
-    QString plainText;
-    UiStyle::FormatList formatList;
-  };
-  ChatLinePart _timestamp, _sender, _contents;
+    virtual QVariant data(int column, int role) const;
+    virtual bool setData(int column, const QVariant &value, int role);
 
 
-  ChatLineModel::WrapList _wrapList;
+  private:
+    void computeWrapList();
 
 
-  static unsigned char *TextBoundaryFinderBuffer;
-  static int TextBoundaryFinderBufferSize;
+    struct ChatLinePart {
+      QString plainText;
+      UiStyle::FormatList formatList;
+    };
+    ChatLinePart _timestamp, _sender, _contents;
+
+    ChatLineModel::WrapList _wrapList;
 };
 
 #endif
 };
 
 #endif