diff --git a/src/lib/component/controller/ActivationController.cpp b/src/lib/component/controller/ActivationController.cpp index fa8c6b0d..b3f5c20a 100644 --- a/src/lib/component/controller/ActivationController.cpp +++ b/src/lib/component/controller/ActivationController.cpp @@ -166,7 +166,9 @@ void ActivationController::handleMessage(MessageResetZoom* message) MessageRefresh().refreshUiOnly().dispatch(); } - MessageStatus("Zoom: 100%").dispatch(); + std::stringstream text; + text << "Font size: " << fontSizeStd; + MessageStatus(text.str()).dispatch(); } void ActivationController::handleMessage(MessageZoom* message) @@ -176,7 +178,6 @@ void ActivationController::handleMessage(MessageZoom* message) ApplicationSettings* settings = ApplicationSettings::getInstance().get(); int fontSize = settings->getFontSize(); - int standardSize = settings->getFontSizeStd(); int maxSize = settings->getFontSizeMax(); int minSize = settings->getFontSizeMin(); @@ -189,11 +190,8 @@ void ActivationController::handleMessage(MessageZoom* message) settings->setFontSize(fontSize + (message->zoomIn ? 1 : -1)); settings->save(); - fontSize = settings->getFontSize(); - int zoom = (fontSize * 100) / standardSize; - std::stringstream text; - text << "Zoom: " << zoom << "%"; + text << "Font size: " << settings->getFontSize(); MessageStatus(text.str()).dispatch(); MessageRefresh().refreshUiOnly().dispatch(); diff --git a/src/lib/component/controller/StatusBarController.cpp b/src/lib/component/controller/StatusBarController.cpp index 07137bdb..f3ed6bbf 100644 --- a/src/lib/component/controller/StatusBarController.cpp +++ b/src/lib/component/controller/StatusBarController.cpp @@ -49,6 +49,11 @@ void StatusBarController::handleMessage(MessagePingReceived* message) void StatusBarController::handleMessage(MessageRefresh* message) { + if (message->uiOnly) + { + return; + } + getView()->setErrorCount(m_storageAccess->getErrorCount()); } diff --git a/src/lib_gui/qt/element/QtSearchBar.cpp b/src/lib_gui/qt/element/QtSearchBar.cpp index 3f7f5640..5c795db9 100644 --- a/src/lib_gui/qt/element/QtSearchBar.cpp +++ b/src/lib_gui/qt/element/QtSearchBar.cpp @@ -110,6 +110,8 @@ void QtSearchBar::refreshStyle() ResourcePaths::getGuiPath().str() + "search_view/images/home.png", "search/button" )); + + m_searchBox->refreshStyle(); } void QtSearchBar::homeButtonClicked() diff --git a/src/lib_gui/qt/element/QtSmartSearchBox.cpp b/src/lib_gui/qt/element/QtSmartSearchBox.cpp index 3e0d842d..b76776c8 100644 --- a/src/lib_gui/qt/element/QtSmartSearchBox.cpp +++ b/src/lib_gui/qt/element/QtSmartSearchBox.cpp @@ -172,6 +172,11 @@ void QtSmartSearchBox::findFulltext() setEditText(QChar(SearchMatch::FULLTEXT_SEARCH_CHARACTER)); } +void QtSmartSearchBox::refreshStyle() +{ + updateElements(); +} + bool QtSmartSearchBox::event(QEvent *event) { if (event->type() == QEvent::KeyPress) diff --git a/src/lib_gui/qt/element/QtSmartSearchBox.h b/src/lib_gui/qt/element/QtSmartSearchBox.h index c3361f20..fa1638ef 100644 --- a/src/lib_gui/qt/element/QtSmartSearchBox.h +++ b/src/lib_gui/qt/element/QtSmartSearchBox.h @@ -46,6 +46,8 @@ public: void setFocus(); void findFulltext(); + void refreshStyle(); + protected: virtual bool event(QEvent *event); virtual void resizeEvent(QResizeEvent* event); diff --git a/src/lib_gui/qt/graphics/QtGraphicsView.cpp b/src/lib_gui/qt/graphics/QtGraphicsView.cpp index a1ac679c..7dd51f86 100644 --- a/src/lib_gui/qt/graphics/QtGraphicsView.cpp +++ b/src/lib_gui/qt/graphics/QtGraphicsView.cpp @@ -43,6 +43,9 @@ QtGraphicsView::QtGraphicsView(QWidget* parent) m_timerStopper->setSingleShot(true); connect(m_timerStopper.get(), SIGNAL(timeout()), this, SLOT(stopTimer())); + m_zoomLabelTimer = std::make_shared(this); + connect(m_zoomLabelTimer.get(), SIGNAL(timeout()), this, SLOT(hideZoomLabel())); + m_exportGraphAction = new QAction(tr("Save as Image"), this); m_exportGraphAction->setStatusTip(tr("Save this graph as image file")); m_exportGraphAction->setToolTip(tr("Save this graph as image file")); @@ -58,6 +61,10 @@ QtGraphicsView::QtGraphicsView(QWidget* parent) m_bookmarkNodeAction->setToolTip(tr("Create a bookmark for this node")); connect(m_bookmarkNodeAction, SIGNAL(triggered()), this, SLOT(bookmarkNode())); + m_zoomState = new QPushButton(this); + m_zoomState->setObjectName("zoom_state"); + m_zoomState->hide(); + m_zoomInButton = new QPushButton(this); m_zoomInButton->setObjectName("zoom_in_button"); m_zoomInButton->setAutoRepeat(true); @@ -143,9 +150,7 @@ void QtGraphicsView::updateZoom(float delta) } double newZoom = m_zoomFactor * factor; - m_zoomFactor = qBound(0.1, newZoom, 100.0); - - updateTransform(); + setZoomFactor(qBound(0.1, newZoom, 100.0)); } void QtGraphicsView::refreshStyle() @@ -163,6 +168,7 @@ void QtGraphicsView::refreshStyle() void QtGraphicsView::resizeEvent(QResizeEvent* event) { + m_zoomState->setGeometry(QRect(31, event->size().height() - 27, 65, 19)); m_zoomInButton->setGeometry(QRect(8, event->size().height() - 50, 19, 19)); m_zoomOutButton->setGeometry(QRect(8, event->size().height() - 27, 19, 19)); @@ -218,7 +224,7 @@ void QtGraphicsView::keyPressEvent(QKeyEvent* event) m_right = true; break; case Qt::Key_0: - m_zoomFactor = 1.0f; + setZoomFactor(1.0f); updateTransform(); break; case Qt::Key_Shift: @@ -489,11 +495,28 @@ void QtGraphicsView::zoomOutPressed() updateZoom(m_zoomOutButtonSpeed); } +void QtGraphicsView::hideZoomLabel() +{ + m_zoomState->hide(); +} + bool QtGraphicsView::moves() const { return m_up || m_down || m_left || m_right; } +void QtGraphicsView::setZoomFactor(float zoomFactor) +{ + m_zoomFactor = zoomFactor; + + m_zoomState->setText(QString::number(int(m_zoomFactor * 100)) + "%"); + updateTransform(); + + m_zoomState->show(); + m_zoomLabelTimer->stop(); + m_zoomLabelTimer->start(1000); +} + void QtGraphicsView::updateTransform() { float zoomFactor = m_appZoomFactor * m_zoomFactor; diff --git a/src/lib_gui/qt/graphics/QtGraphicsView.h b/src/lib_gui/qt/graphics/QtGraphicsView.h index bb4fae2f..6ae608d7 100644 --- a/src/lib_gui/qt/graphics/QtGraphicsView.h +++ b/src/lib_gui/qt/graphics/QtGraphicsView.h @@ -59,9 +59,12 @@ private slots: void zoomInPressed(); void zoomOutPressed(); + void hideZoomLabel(); + private: bool moves() const; + void setZoomFactor(float zoomFactor); void updateTransform(); QPoint m_last; @@ -80,11 +83,13 @@ private: std::shared_ptr m_timer; std::shared_ptr m_timerStopper; + std::shared_ptr m_zoomLabelTimer; QAction* m_exportGraphAction; QAction* m_copyNodeNameAction; QAction* m_bookmarkNodeAction; + QPushButton* m_zoomState; QPushButton* m_zoomInButton; QPushButton* m_zoomOutButton;