Internal
Public Access
Session UX: inline password prompt and terminal font size controls
Replace the modal RDP/SSH password dialog with an inline prompt bar embedded in the session tab instead of a separate popup window. Add per-tab terminal font size controls (increase/decrease/reset/set exact point size) via the tab context menu, with the chosen size persisted across sessions. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <QAction>
|
||||
#include <QColor>
|
||||
#include <QInputDialog>
|
||||
#include <QMenu>
|
||||
#include <QMenuBar>
|
||||
#include <QPalette>
|
||||
@@ -105,6 +106,18 @@ SessionWindow::SessionWindow(const Profile& profile, QWidget* parent)
|
||||
clearAction = menu.addAction(QStringLiteral("Clear"));
|
||||
}
|
||||
|
||||
QAction* zoomInAction = nullptr;
|
||||
QAction* zoomOutAction = nullptr;
|
||||
QAction* resetZoomAction = nullptr;
|
||||
QAction* setFontSizeAction = nullptr;
|
||||
if (tab->supportsZoom()) {
|
||||
menu.addSeparator();
|
||||
zoomInAction = menu.addAction(QStringLiteral("Increase Font Size"));
|
||||
zoomOutAction = menu.addAction(QStringLiteral("Decrease Font Size"));
|
||||
resetZoomAction = menu.addAction(QStringLiteral("Reset Font Size"));
|
||||
setFontSizeAction = menu.addAction(QStringLiteral("Set Font Size..."));
|
||||
}
|
||||
|
||||
QAction* chosen = menu.exec(m_tabs->tabBar()->mapToGlobal(pos));
|
||||
if (chosen == disconnectAction) {
|
||||
tab->disconnectSession();
|
||||
@@ -120,6 +133,27 @@ SessionWindow::SessionWindow(const Profile& profile, QWidget* parent)
|
||||
tab->clearEvents();
|
||||
} else if (clearAction != nullptr && chosen == clearAction) {
|
||||
tab->clearTerminal();
|
||||
} else if (zoomInAction != nullptr && chosen == zoomInAction) {
|
||||
tab->zoomIn();
|
||||
} else if (zoomOutAction != nullptr && chosen == zoomOutAction) {
|
||||
tab->zoomOut();
|
||||
} else if (resetZoomAction != nullptr && chosen == resetZoomAction) {
|
||||
tab->resetZoom();
|
||||
} else if (setFontSizeAction != nullptr && chosen == setFontSizeAction) {
|
||||
bool accepted = false;
|
||||
const int currentSize =
|
||||
tab->terminalFontPointSize() > 0 ? tab->terminalFontPointSize() : 10;
|
||||
const int newSize = QInputDialog::getInt(this,
|
||||
QStringLiteral("Set Font Size"),
|
||||
QStringLiteral("Font size (points):"),
|
||||
currentSize,
|
||||
6,
|
||||
72,
|
||||
1,
|
||||
&accepted);
|
||||
if (accepted) {
|
||||
tab->setTerminalFontPointSize(newSize);
|
||||
}
|
||||
} else {
|
||||
for (QAction* themeAction : themeActions) {
|
||||
if (chosen == themeAction) {
|
||||
@@ -185,6 +219,16 @@ void SessionWindow::addSessionTab(const Profile& profile)
|
||||
: themeName.trimmed();
|
||||
saveUiPreferences();
|
||||
});
|
||||
connect(tab,
|
||||
&SessionTab::terminalFontSizeChanged,
|
||||
this,
|
||||
[this](int pointSize) {
|
||||
if (pointSize <= 0) {
|
||||
return;
|
||||
}
|
||||
m_preferences.terminalFontPointSize = pointSize;
|
||||
saveUiPreferences();
|
||||
});
|
||||
connect(tab,
|
||||
&SessionTab::eventsPanelVisibilityChanged,
|
||||
this,
|
||||
@@ -216,6 +260,8 @@ void SessionWindow::loadUiPreferences()
|
||||
}
|
||||
m_preferences.eventsPanelExpanded =
|
||||
settings.value(QStringLiteral("session/eventsPanelExpanded"), false).toBool();
|
||||
m_preferences.terminalFontPointSize =
|
||||
settings.value(QStringLiteral("session/terminalFontPointSize"), 0).toInt();
|
||||
}
|
||||
|
||||
void SessionWindow::saveUiPreferences() const
|
||||
@@ -225,4 +271,6 @@ void SessionWindow::saveUiPreferences() const
|
||||
m_preferences.terminalThemeName);
|
||||
settings.setValue(QStringLiteral("session/eventsPanelExpanded"),
|
||||
m_preferences.eventsPanelExpanded);
|
||||
settings.setValue(QStringLiteral("session/terminalFontPointSize"),
|
||||
m_preferences.terminalFontPointSize);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user