[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r2985: If the current message log layout is right-to-left (e.g. if (vidalia/trunk/src/vidalia/log)
Author: edmanm
Date: 2008-08-17 20:22:21 -0400 (Sun, 17 Aug 2008)
New Revision: 2985
Added:
vidalia/trunk/src/vidalia/log/logmessagecolumndelegate.cpp
vidalia/trunk/src/vidalia/log/logmessagecolumndelegate.h
Modified:
vidalia/trunk/src/vidalia/log/logtreewidget.cpp
Log:
If the current message log layout is right-to-left (e.g. if the user's
translation is Farsi), then use a custom item delegate for the log message
column whose sole purpose is to keep Qt from screwing with the message text.
Fixes ticket #396.
Added: vidalia/trunk/src/vidalia/log/logmessagecolumndelegate.cpp
===================================================================
--- vidalia/trunk/src/vidalia/log/logmessagecolumndelegate.cpp (rev 0)
+++ vidalia/trunk/src/vidalia/log/logmessagecolumndelegate.cpp 2008-08-18 00:22:21 UTC (rev 2985)
@@ -0,0 +1,38 @@
+/*
+** This file is part of Vidalia, and is subject to the license terms in the
+** LICENSE file, found in the top level directory of this distribution. If you
+** did not receive the LICENSE file with this file, you may obtain it from the
+** Vidalia source package distributed by the Vidalia Project at
+** http://www.vidalia-project.net/. No part of Vidalia, including this file,
+** may be copied, modified, propagated, or distributed except according to the
+** terms described in the LICENSE file.
+*/
+
+/*
+** \file logmessagecolumndelegate.cpp
+** \version $Id$
+** \brief Delegate responsible for rendering the log message column
+*/
+
+#include "logmessagecolumndelegate.h"
+
+
+/** Default constructor. */
+LogMessageColumnDelegate::LogMessageColumnDelegate(QObject *parent)
+ : QItemDelegate(parent)
+{
+}
+
+/** Overrides the default paint() method so that we can prevent Qt from
+ * munging Tor's log messages when using a Right-to-Left layout (e.g. when
+ * viewing Vidalia in Farsi). */
+void
+LogMessageColumnDelegate::paint(QPainter *painter,
+ const QStyleOptionViewItem &option,
+ const QModelIndex &index) const
+{
+ QStyleOptionViewItem styleOption = option;
+ styleOption.direction = Qt::LeftToRight;
+
+ QItemDelegate::paint(painter, styleOption, index);
+}
Property changes on: vidalia/trunk/src/vidalia/log/logmessagecolumndelegate.cpp
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: vidalia/trunk/src/vidalia/log/logmessagecolumndelegate.h
===================================================================
--- vidalia/trunk/src/vidalia/log/logmessagecolumndelegate.h (rev 0)
+++ vidalia/trunk/src/vidalia/log/logmessagecolumndelegate.h 2008-08-18 00:22:21 UTC (rev 2985)
@@ -0,0 +1,37 @@
+/*
+** This file is part of Vidalia, and is subject to the license terms in the
+** LICENSE file, found in the top level directory of this distribution. If you
+** did not receive the LICENSE file with this file, you may obtain it from the
+** Vidalia source package distributed by the Vidalia Project at
+** http://www.vidalia-project.net/. No part of Vidalia, including this file,
+** may be copied, modified, propagated, or distributed except according to the
+** terms described in the LICENSE file.
+*/
+
+/*
+** \file logmessagecolumndelegate.h
+** \version $Id$
+** \brief Delegate responsible for rendering the log message column
+*/
+
+#ifndef _LOGMESSAGECOLUMNDELEGATE_H
+#define _LOGMESSAGECOLUMNDELEGATE_H
+
+#include <QItemDelegate>
+
+
+class LogMessageColumnDelegate : public QItemDelegate
+{
+public:
+ /** Default constructor. */
+ LogMessageColumnDelegate(QObject *parent = 0);
+
+ /** Overrides the default paint() method so that we can prevent Qt from
+ * munging Tor's log messages when using a Right-to-Left layout (e.g. when
+ * viewing Vidalia in Farsi). */
+ virtual void paint(QPainter *painter,
+ const QStyleOptionViewItem &option,
+ const QModelIndex &index) const;
+};
+
+#endif
Property changes on: vidalia/trunk/src/vidalia/log/logmessagecolumndelegate.h
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: vidalia/trunk/src/vidalia/log/logtreewidget.cpp
===================================================================
--- vidalia/trunk/src/vidalia/log/logtreewidget.cpp 2008-08-17 22:01:27 UTC (rev 2984)
+++ vidalia/trunk/src/vidalia/log/logtreewidget.cpp 2008-08-18 00:22:21 UTC (rev 2985)
@@ -18,6 +18,7 @@
#include "logtreewidget.h"
#include "logheaderview.h"
+#include "logmessagecolumndelegate.h"
/** Default constructor. */
@@ -26,6 +27,13 @@
{
setHeader(new LogHeaderView(this));
+ /* Tor's log messages are always in English, so stop Qt from futzing with
+ * the message text if we're currently using a non-English RTL layout. */
+ if (layoutDirection() == Qt::RightToLeft) {
+ setItemDelegateForColumn(LogTreeWidget::MessageColumn,
+ new LogMessageColumnDelegate(this));
+ }
+
/* Explicitly default to sorting messages chronologically */
sortItems(LogTreeWidget::TimeColumn, Qt::AscendingOrder);