Internal
Public Access
Add VNC-only scale-to-fit vs actual-size display toggle
VNC has no equivalent of RDP's MS-RDPEDISP to request a different resolution from the guest, so a high-resolution remote desktop previously always got shrunk to fit the window, making text illegible. Adds a per-tab "Display Mode" choice (tab-bar right-click) between the existing scale-to-fit behavior and a new actual-size mode that renders the framebuffer at its native pixel size inside a QScrollArea. Reuses VncDisplayWidget's existing scale-to-fit render math unchanged -- it degenerates to an exact 1:1 mapping once the widget is fixed to the remote's own size. Persisted like the terminal theme preference. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+33
-1
@@ -24,6 +24,7 @@
|
||||
#include <QComboBox>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QPushButton>
|
||||
#include <QScrollArea>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
#include <QToolButton>
|
||||
@@ -81,6 +82,7 @@ SessionTab::SessionTab(const Profile& profile,
|
||||
m_sshTerminal(nullptr),
|
||||
m_rdpDisplay(nullptr),
|
||||
m_vncDisplay(nullptr),
|
||||
m_vncScrollArea(nullptr),
|
||||
m_terminalOutput(nullptr),
|
||||
m_eventLog(nullptr),
|
||||
m_toggleEventsButton(nullptr),
|
||||
@@ -102,6 +104,10 @@ SessionTab::SessionTab(const Profile& profile,
|
||||
|
||||
setupUi();
|
||||
|
||||
if (m_vncDisplay != nullptr) {
|
||||
m_vncDisplay->setScaleToFit(preferences.vncScaleToFit);
|
||||
}
|
||||
|
||||
if (m_useKodoTermForSsh) {
|
||||
connect(m_sshTerminal,
|
||||
&KodoTerm::finished,
|
||||
@@ -457,6 +463,28 @@ bool SessionTab::supportsZoom() const
|
||||
return m_useKodoTermForSsh || m_terminalOutput != nullptr;
|
||||
}
|
||||
|
||||
bool SessionTab::supportsVncScaleToggle() const
|
||||
{
|
||||
return m_vncDisplay != nullptr;
|
||||
}
|
||||
|
||||
void SessionTab::setVncScaleToFit(bool scaleToFit)
|
||||
{
|
||||
if (m_vncDisplay == nullptr || m_vncDisplay->scaleToFit() == scaleToFit) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_vncDisplay->setScaleToFit(scaleToFit);
|
||||
appendEvent(scaleToFit ? QStringLiteral("Display mode set to scale to fit.")
|
||||
: QStringLiteral("Display mode set to actual size."));
|
||||
emit vncScaleModeChanged(scaleToFit);
|
||||
}
|
||||
|
||||
bool SessionTab::vncScaleToFit() const
|
||||
{
|
||||
return m_vncDisplay != nullptr ? m_vncDisplay->scaleToFit() : true;
|
||||
}
|
||||
|
||||
void SessionTab::zoomIn()
|
||||
{
|
||||
if (m_useKodoTermForSsh && m_sshTerminal != nullptr) {
|
||||
@@ -731,7 +759,11 @@ void SessionTab::setupUi()
|
||||
rootLayout->addWidget(m_rdpDisplay, 1);
|
||||
} else if (m_profile.protocol.compare(QStringLiteral("VNC"), Qt::CaseInsensitive) == 0) {
|
||||
m_vncDisplay = new VncDisplayWidget(this);
|
||||
rootLayout->addWidget(m_vncDisplay, 1);
|
||||
m_vncScrollArea = new QScrollArea(this);
|
||||
m_vncScrollArea->setWidget(m_vncDisplay);
|
||||
m_vncScrollArea->setWidgetResizable(true);
|
||||
m_vncScrollArea->setFrameShape(QFrame::NoFrame);
|
||||
rootLayout->addWidget(m_vncScrollArea, 1);
|
||||
} else {
|
||||
m_terminalOutput = new TerminalView(this);
|
||||
QFont fallbackFont = defaultTerminalFont();
|
||||
|
||||
Reference in New Issue
Block a user