diff options
Diffstat (limited to 'ui/qt/main_window_slots.cpp')
-rw-r--r-- | ui/qt/main_window_slots.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index ea5fc246de..b58e7e1caf 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -1677,6 +1677,36 @@ void MainWindow::on_actionEditPreferences_triggered() // View Menu +void MainWindow::zoomText() +{ + // Scale by 10%, rounding to nearest half point, minimum 1 point. + // XXX Small sizes repeat. It might just be easier to create a map of multipliers. + mono_font_ = QFont(wsApp->monospaceFont()); + qreal zoom_size = wsApp->monospaceFont().pointSize() * 2 * qPow(1.1, recent.gui_zoom_level); + zoom_size = qRound(zoom_size) / 2.0; + zoom_size = qMax(zoom_size, 1.0); + mono_font_.setPointSizeF(zoom_size); + emit monospaceFontChanged(mono_font_); +} + +void MainWindow::on_actionViewZoomIn_triggered() +{ + recent.gui_zoom_level++; + zoomText(); +} + +void MainWindow::on_actionViewZoomOut_triggered() +{ + recent.gui_zoom_level--; + zoomText(); +} + +void MainWindow::on_actionViewNormalSize_triggered() +{ + recent.gui_zoom_level = 0; + zoomText(); +} + void MainWindow::on_actionViewColorizePacketList_triggered(bool checked) { recent.packet_list_colorize = checked; color_filters_enable(checked); @@ -1684,6 +1714,13 @@ void MainWindow::on_actionViewColorizePacketList_triggered(bool checked) { packet_list_->update(); } +void MainWindow::on_actionViewResizeColumns_triggered() +{ + for (int col = 0; col < packet_list_->packetListModel()->columnCount(); col++) { + packet_list_->resizeColumnToContents(col); + } +} + void MainWindow::on_actionViewReload_triggered() { cf_reload(&cfile); |