[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:23:17 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=5a10bc9

The following commit has been merged in the master branch:
commit 5a10bc9d98a4871b6feaa3c8f487dbcfc06e5d80
Author: Dan Vrátil <dvratil at redhat.com>
Date:   Tue Feb 12 15:22:29 2013 +0100

    Zoom in/out using Ctrl+Scroll or menu actions
    
    BUG: 314946
    REVIEW: 108921
    FIXED-IN: 0.6
---
 app/chat-window.cpp      | 37 +++++++++++++++++++++++++++++++++++++
 app/chat-window.h        |  4 ++++
 lib/adium-theme-view.cpp | 23 +++++++++++++++++++++++
 lib/adium-theme-view.h   |  4 ++++
 lib/chat-widget.cpp      | 11 +++++++++++
 lib/chat-widget.h        |  7 +++++++
 6 files changed, 86 insertions(+)

diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index 8e68532..c79e3aa 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -73,6 +73,10 @@ ChatWindow::ChatWindow()
     //that data are available when we need them later in desktopSharingCapability()
     (void) s_krfbAvailableChecker.operator->();
 
+    KConfig config(QLatin1String("ktelepathyrc"));
+    KConfigGroup group = config.group("Appearance");
+    m_zoomFactor = group.readEntry("zoomFactor", (qreal) 1.0);
+
     //setup actions
     KStandardAction::close(this,SLOT(closeCurrentTab()),actionCollection());
     KStandardAction::quit(KApplication::instance(), SLOT(quit()), actionCollection());
@@ -87,6 +91,9 @@ ChatWindow::ChatWindow()
     KStandardAction::findNext(this, SLOT(onFindNextText()), actionCollection())->setEnabled(false);
     KStandardAction::findPrev(this, SLOT(onFindPreviousText()), actionCollection())->setEnabled(false);
 
+    KStandardAction::zoomIn(this, SLOT(onZoomIn()), actionCollection());
+    KStandardAction::zoomOut(this, SLOT(onZoomOut()), actionCollection());
+
     // create custom actions
     setupCustomActions();
 
@@ -202,6 +209,7 @@ void ChatWindow::addTab(ChatTab *tab)
     kDebug();
 
     setupChatTabSignals(tab);
+    tab->setZoomFactor(m_zoomFactor);
 
     m_tabWidget->addTab(tab, tab->icon(), tab->title());
     m_tabWidget->setCurrentWidget(tab);
@@ -619,6 +627,7 @@ void ChatWindow::setupChatTabSignals(ChatTab *chatTab)
     connect(chatTab, SIGNAL(contactPresenceChanged(KTp::Presence)), this, SLOT(onTabStateChanged()));
     connect(chatTab->chatSearchBar(), SIGNAL(enableSearchButtonsSignal(bool)), this, SLOT(onEnableSearchActions(bool)));
     connect(chatTab, SIGNAL(contactBlockStatusChanged(bool)), this, SLOT(toggleBlockButton(bool)));
+    connect(chatTab, SIGNAL(zoomFactorChanged(qreal)), this, SLOT(onZoomFactorChanged(qreal)));
 }
 
 void ChatWindow::setupCustomActions()
@@ -887,5 +896,33 @@ bool ChatWindow::hasUnreadMessages() const
     return false;
 }
 
+void ChatWindow::onZoomIn()
+{
+    onZoomFactorChanged(m_zoomFactor + 0.1);
+}
+
+void ChatWindow::onZoomOut()
+{
+    onZoomFactorChanged(m_zoomFactor - 0.1);
+}
+
+void ChatWindow::onZoomFactorChanged(qreal zoom)
+{
+    m_zoomFactor = zoom;
+
+    for (int i = 0; i < m_tabWidget->count(); i++) {
+        ChatWidget *widget = qobject_cast<ChatWidget*>(m_tabWidget->widget(i));
+        if (!widget) {
+            continue;
+        }
+
+        widget->setZoomFactor(zoom);
+    }
+
+    KConfig config(QLatin1String("ktelepathyrc"));
+    KConfigGroup group = config.group("Appearance");
+    group.writeEntry("zoomFactor", m_zoomFactor);
+
+}
 
 #include "chat-window.moc"
diff --git a/app/chat-window.h b/app/chat-window.h
index 38329bb..018e91a 100644
--- a/app/chat-window.h
+++ b/app/chat-window.h
@@ -103,6 +103,9 @@ private Q_SLOTS:
     void toggleBlockButton(bool contactIsBlocked);              /** Toggle block/unblock action according to the flag */
     void updateAccountIcon();                                   /** Update account icon fake action */
     void onAddEmoticon(const QString& emoticon);                /** Add the corresponding emoticon*/
+    void onZoomIn();
+    void onZoomOut();
+    void onZoomFactorChanged(qreal zoom);
 
 protected Q_SLOTS:
     void showSettingsDialog();
@@ -168,6 +171,7 @@ private:
 
     Sonnet::DictionaryComboBox *m_spellDictCombo;
     QLabel *m_accountIconLabel;
+    qreal m_zoomFactor;
 };
 
 #endif // CHATWINDOW_H
diff --git a/lib/adium-theme-view.cpp b/lib/adium-theme-view.cpp
index 7fa3b06..12e0b02 100644
--- a/lib/adium-theme-view.cpp
+++ b/lib/adium-theme-view.cpp
@@ -68,6 +68,9 @@ AdiumThemeView::AdiumThemeView(QWidget *parent)
             this, SLOT(onOpenLinkActionTriggered()));
 
     connect(this, SIGNAL(linkClicked(QUrl)), this, SLOT(onLinkClicked(QUrl)));
+
+    QWebSettings *ws = settings();
+    ws->setAttribute(QWebSettings::ZoomTextOnly, true);
 }
 
 void AdiumThemeView::load(ChatType chatType) {
@@ -133,6 +136,26 @@ void AdiumThemeView::contextMenuEvent(QContextMenuEvent *event)
     }
 }
 
+void AdiumThemeView::wheelEvent(QWheelEvent* event)
+{
+    // Zoom text on Ctrl + Scroll
+    if (event->modifiers() & Qt::CTRL) {
+        qreal factor = zoomFactor();
+        if (event->delta() > 0) {
+            factor += 0.1;
+        } else if (event->delta() < 0) {
+            factor -= 0.1;
+        }
+        setZoomFactor(factor);
+        Q_EMIT zoomFactorChanged(factor);
+
+        event->accept();
+        return;
+    }
+
+    QWebView::wheelEvent(event);
+}
+
 void AdiumThemeView::initialise(const AdiumThemeHeaderInfo &chatInfo)
 {
     QString headerHtml;
diff --git a/lib/adium-theme-view.h b/lib/adium-theme-view.h
index 6b78f7f..732cf71 100644
--- a/lib/adium-theme-view.h
+++ b/lib/adium-theme-view.h
@@ -96,6 +96,10 @@ public Q_SLOTS:
 
 protected:
     virtual void contextMenuEvent(QContextMenuEvent *event);
+    virtual void wheelEvent(QWheelEvent *event);
+
+Q_SIGNALS:
+    void zoomFactorChanged(qreal zoomFactor);
 
 private:
     ChatWindowStyle *m_chatStyle;
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index 5146433..60efede 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -133,6 +133,7 @@ ChatWidget::ChatWidget(const Tp::TextChannelPtr & channel, const Tp::AccountPtr
 
     /* Prepare the chat area */
     connect(d->ui.chatArea, SIGNAL(loadFinished(bool)), SLOT(chatViewReady()), Qt::QueuedConnection);
+    connect(d->ui.chatArea, SIGNAL(zoomFactorChanged(qreal)), SIGNAL(zoomFactorChanged(qreal)));
     initChatArea();
 
     loadSpellCheckingOption();
@@ -1019,6 +1020,16 @@ void ChatWidget::clear()
     initChatArea();
 }
 
+void ChatWidget::setZoomFactor(qreal zoomFactor)
+{
+    d->ui.chatArea->setZoomFactor(zoomFactor);
+}
+
+qreal ChatWidget::zoomFactor() const
+{
+    return d->ui.chatArea->zoomFactor();
+}
+
 void ChatWidget::initChatArea()
 {
     d->ui.chatArea->load((d->isGroupChat ? AdiumThemeView::GroupChat : AdiumThemeView::SingleUserChat));
diff --git a/lib/chat-widget.h b/lib/chat-widget.h
index 80b92d4..2c85f3b 100644
--- a/lib/chat-widget.h
+++ b/lib/chat-widget.h
@@ -95,6 +95,10 @@ public:
 
     void clear();
 
+    qreal zoomFactor() const;
+
+    void setZoomFactor(qreal zoomFactor);
+
 public Q_SLOTS:
     /** toggle the search bar visibility */
     void toggleSearchBar() const;
@@ -165,6 +169,9 @@ Q_SIGNALS:
     /** Emitted when a notification for the chat window has been activated*/
     void notificationClicked();
 
+    /** Emitted when zoom level in chat view changes */
+    void zoomFactorChanged(qreal zoomFactor);
+
 private Q_SLOTS:
     /** received when user changes search criteria or when searching for text */
     void findTextInChat(const QString &text, QWebPage::FindFlags flags);

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list