diff options
-rw-r--r-- | Swift/QtUI/QtChatView.cpp | 9 | ||||
-rw-r--r-- | Swift/QtUI/QtHistoryWindow.cpp | 8 | ||||
-rw-r--r-- | Swift/QtUI/QtHistoryWindow.h | 6 | ||||
-rw-r--r-- | Swift/QtUI/QtUIFactory.cpp | 10 | ||||
-rw-r--r-- | Swift/QtUI/QtUIFactory.h | 3 | ||||
-rw-r--r-- | Swift/QtUI/QtUISettingConstants.cpp | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtUISettingConstants.h | 1 |
7 files changed, 38 insertions, 0 deletions
diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp index d399c4f..b2a1754 100644 --- a/Swift/QtUI/QtChatView.cpp +++ b/Swift/QtUI/QtChatView.cpp @@ -111,6 +111,15 @@ void QtChatView::addMessageTop(boost::shared_ptr<ChatSnippet> snippet) { if (lastElement_.isNull()) { lastElement_ = firstElement_; } + + if (fontSizeSteps_ != 0) { + double size = 1.0 + 0.2 * fontSizeSteps_; + QString sizeString(QString().setNum(size, 'g', 3) + "em"); + const QWebElementCollection spans = firstElement_.findAll("span.swift_resizable"); + foreach (QWebElement span, spans) { + span.setStyleProperty("font-size", sizeString); + } + } } QWebElement QtChatView::snippetToDOM(boost::shared_ptr<ChatSnippet> snippet) { diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp index a9a8997..b3603a8 100644 --- a/Swift/QtUI/QtHistoryWindow.cpp +++ b/Swift/QtUI/QtHistoryWindow.cpp @@ -58,6 +58,7 @@ QtHistoryWindow::QtHistoryWindow(SettingsProvider* settings, UIEventStream* even connect(conversation_, SIGNAL(scrollRequested(int)), this, SLOT(handleScrollRequested(int))); connect(conversation_, SIGNAL(scrollReachedTop()), this, SLOT(handleScrollReachedTop())); connect(conversation_, SIGNAL(scrollReachedBottom()), this, SLOT(handleScrollReachedBottom())); + connect(conversation_, SIGNAL(fontResized(int)), this, SLOT(handleFontResized(int))); connect(ui_.searchBox_->lineEdit(), SIGNAL(returnPressed()), this, SLOT(handleReturnPressed())); connect(ui_.calendarWidget_, SIGNAL(clicked(const QDate&)), this, SLOT(handleCalendarClicked(const QDate&))); connect(ui_.previousButton_, SIGNAL(clicked(bool)), this, SLOT(handlePreviousButtonClicked())); @@ -68,6 +69,7 @@ QtHistoryWindow::~QtHistoryWindow() { disconnect(conversation_, SIGNAL(scrollRequested(int)), this, SLOT(handleScrollRequested(int))); disconnect(conversation_, SIGNAL(scrollReachedTop()), this, SLOT(handleScrollReachedTop())); disconnect(conversation_, SIGNAL(scrollReachedBottom()), this, SLOT(handleScrollReachedBottom())); + disconnect(conversation_, SIGNAL(fontResized(int)), this, SLOT(handleFontResized(int))); disconnect(ui_.searchBox_->lineEdit(), SIGNAL(returnPressed()), this, SLOT(handleReturnPressed())); disconnect(ui_.calendarWidget_, SIGNAL(clicked(const QDate&)), this, SLOT(handleCalendarClicked(const QDate&))); disconnect(ui_.previousButton_, SIGNAL(clicked(bool)), this, SLOT(handlePreviousButtonClicked())); @@ -181,4 +183,10 @@ void QtHistoryWindow::handlePreviousButtonClicked() { onPreviousButtonClicked(); } +void QtHistoryWindow::handleFontResized(int fontSizeSteps) { + conversation_->resizeFont(fontSizeSteps); + + emit fontResized(fontSizeSteps); +} + } diff --git a/Swift/QtUI/QtHistoryWindow.h b/Swift/QtUI/QtHistoryWindow.h index cfd558a..cdffe69 100644 --- a/Swift/QtUI/QtHistoryWindow.h +++ b/Swift/QtUI/QtHistoryWindow.h @@ -30,6 +30,12 @@ namespace Swift { void closeEvent(QCloseEvent* event); void showEvent(QShowEvent* event); + signals: + void fontResized(int); + + public slots: + void handleFontResized(int fontSizeSteps); + protected slots: void handleScrollRequested(int pos); void handleScrollReachedTop(); diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp index 7963205..2197ec6 100644 --- a/Swift/QtUI/QtUIFactory.cpp +++ b/Swift/QtUI/QtUIFactory.cpp @@ -33,6 +33,7 @@ namespace Swift { QtUIFactory::QtUIFactory(SettingsProviderHierachy* settings, QtSettingsProvider* qtOnlySettings, QtChatTabs* tabs, QSplitter* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, TimerFactory* timerFactory, bool startMinimized, bool emoticonsExist) : settings(settings), qtOnlySettings(qtOnlySettings), tabs(tabs), netbookSplitter(netbookSplitter), systemTray(systemTray), chatWindowFactory(chatWindowFactory), timerFactory_(timerFactory), lastMainWindow(NULL), loginWindow(NULL), startMinimized(startMinimized), emoticonsExist_(emoticonsExist) { chatFontSize = settings->getSetting(QtUISettingConstants::CHATWINDOW_FONT_SIZE); + historyFontSize_ = settings->getSetting(QtUISettingConstants::HISTORYWINDOW_FONT_SIZE); } XMLConsoleWidget* QtUIFactory::createXMLConsoleWidget() { @@ -51,10 +52,19 @@ HistoryWindow* QtUIFactory::createHistoryWindow(UIEventStream* uiEventStream) { if (!tabs->isVisible()) { tabs->show(); } + + connect(window, SIGNAL(fontResized(int)), this, SLOT(handleHistoryWindowFontResized(int))); + + window->handleFontResized(historyFontSize_); window->show(); return window; } +void QtUIFactory::handleHistoryWindowFontResized(int size) { + historyFontSize_ = size; + settings->storeSetting(QtUISettingConstants::HISTORYWINDOW_FONT_SIZE, size); +} + FileTransferListWidget* QtUIFactory::createFileTransferListWidget() { QtFileTransferListWidget* widget = new QtFileTransferListWidget(); tabs->addTab(widget); diff --git a/Swift/QtUI/QtUIFactory.h b/Swift/QtUI/QtUIFactory.h index b30eecb..1b2431f 100644 --- a/Swift/QtUI/QtUIFactory.h +++ b/Swift/QtUI/QtUIFactory.h @@ -24,6 +24,7 @@ namespace Swift { class QtChatWindowFactory; class QtChatWindow; class TimerFactory; + class historyWindow_; class QtUIFactory : public QObject, public UIFactory { Q_OBJECT @@ -48,6 +49,7 @@ namespace Swift { private slots: void handleLoginWindowGeometryChanged(); void handleChatWindowFontResized(int); + void handleHistoryWindowFontResized(int); private: SettingsProviderHierachy* settings; @@ -62,6 +64,7 @@ namespace Swift { std::vector<QPointer<QtChatWindow> > chatWindows; bool startMinimized; int chatFontSize; + int historyFontSize_; bool emoticonsExist_; }; } diff --git a/Swift/QtUI/QtUISettingConstants.cpp b/Swift/QtUI/QtUISettingConstants.cpp index 81022ec..68001d7 100644 --- a/Swift/QtUI/QtUISettingConstants.cpp +++ b/Swift/QtUI/QtUISettingConstants.cpp @@ -13,5 +13,6 @@ const SettingsProvider::Setting<std::string> QtUISettingConstants::CLICKTHROUGH_ const SettingsProvider::Setting<int> QtUISettingConstants::CURRENT_ROSTER_TAB("currentRosterTab", 0); const SettingsProvider::Setting<bool> QtUISettingConstants::SHOW_NICK_IN_ROSTER_HEADER("showNickInRosterHeader", true); const SettingsProvider::Setting<int> QtUISettingConstants::CHATWINDOW_FONT_SIZE("chatWindowFontSize", 0); +const SettingsProvider::Setting<int> QtUISettingConstants::HISTORYWINDOW_FONT_SIZE("historyWindowFontSize", 0); const SettingsProvider::Setting<bool> QtUISettingConstants::SHOW_EMOTICONS("showEmoticons", true); } diff --git a/Swift/QtUI/QtUISettingConstants.h b/Swift/QtUI/QtUISettingConstants.h index 2740abb..8ac835f 100644 --- a/Swift/QtUI/QtUISettingConstants.h +++ b/Swift/QtUI/QtUISettingConstants.h @@ -16,6 +16,7 @@ namespace Swift { static const SettingsProvider::Setting<int> CURRENT_ROSTER_TAB; static const SettingsProvider::Setting<bool> SHOW_NICK_IN_ROSTER_HEADER; static const SettingsProvider::Setting<int> CHATWINDOW_FONT_SIZE; + static const SettingsProvider::Setting<int> HISTORYWINDOW_FONT_SIZE; static const SettingsProvider::Setting<bool> SHOW_EMOTICONS; }; } |