mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-26 07:45:33 +01:00
Qt: Implement "Keep Window on top"
This commit is contained in:
parent
c1dccdc0e5
commit
caa18edc79
@ -165,7 +165,7 @@ void GeneralWidget::LoadSettings()
|
|||||||
// Render to Main Window
|
// Render to Main Window
|
||||||
m_render_main_window->setChecked(SConfig::GetInstance().bRenderToMain);
|
m_render_main_window->setChecked(SConfig::GetInstance().bRenderToMain);
|
||||||
// Keep Window on Top
|
// Keep Window on Top
|
||||||
m_keep_window_top->setChecked(SConfig::GetInstance().bKeepWindowOnTop);
|
m_keep_window_top->setChecked(Settings::Instance().IsKeepWindowOnTopEnabled());
|
||||||
// Autoadjust Window size
|
// Autoadjust Window size
|
||||||
m_autoadjust_window_size->setChecked(SConfig::GetInstance().bRenderWindowAutoSize);
|
m_autoadjust_window_size->setChecked(SConfig::GetInstance().bRenderWindowAutoSize);
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ void GeneralWidget::SaveSettings()
|
|||||||
// Render to Main Window
|
// Render to Main Window
|
||||||
SConfig::GetInstance().bRenderToMain = m_render_main_window->isChecked();
|
SConfig::GetInstance().bRenderToMain = m_render_main_window->isChecked();
|
||||||
// Keep Window on Top
|
// Keep Window on Top
|
||||||
SConfig::GetInstance().bKeepWindowOnTop = m_keep_window_top->isChecked();
|
Settings::Instance().SetKeepWindowOnTop(m_keep_window_top->isChecked());
|
||||||
// Autoadjust windowsize
|
// Autoadjust windowsize
|
||||||
SConfig::GetInstance().bRenderWindowAutoSize = m_autoadjust_window_size->isChecked();
|
SConfig::GetInstance().bRenderWindowAutoSize = m_autoadjust_window_size->isChecked();
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,9 @@ RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent)
|
|||||||
connect(&Settings::Instance(), &Settings::HideCursorChanged, this,
|
connect(&Settings::Instance(), &Settings::HideCursorChanged, this,
|
||||||
&RenderWidget::OnHideCursorChanged);
|
&RenderWidget::OnHideCursorChanged);
|
||||||
OnHideCursorChanged();
|
OnHideCursorChanged();
|
||||||
|
connect(&Settings::Instance(), &Settings::KeepWindowOnTopChanged, this,
|
||||||
|
&RenderWidget::OnKeepOnTopChanged);
|
||||||
|
OnKeepOnTopChanged(Settings::Instance().IsKeepWindowOnTopEnabled());
|
||||||
m_mouse_timer->start(MOUSE_HIDE_DELAY);
|
m_mouse_timer->start(MOUSE_HIDE_DELAY);
|
||||||
|
|
||||||
SetFillBackground(true);
|
SetFillBackground(true);
|
||||||
@ -70,6 +73,14 @@ void RenderWidget::OnHideCursorChanged()
|
|||||||
setCursor(Settings::Instance().GetHideCursor() ? Qt::BlankCursor : Qt::ArrowCursor);
|
setCursor(Settings::Instance().GetHideCursor() ? Qt::BlankCursor : Qt::ArrowCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RenderWidget::OnKeepOnTopChanged(bool top)
|
||||||
|
{
|
||||||
|
setWindowFlags(top ? windowFlags() | Qt::WindowStaysOnTopHint :
|
||||||
|
windowFlags() & ~Qt::WindowStaysOnTopHint);
|
||||||
|
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
|
||||||
void RenderWidget::HandleCursorTimer()
|
void RenderWidget::HandleCursorTimer()
|
||||||
{
|
{
|
||||||
if (isActiveWindow())
|
if (isActiveWindow())
|
||||||
|
@ -29,6 +29,7 @@ signals:
|
|||||||
private:
|
private:
|
||||||
void HandleCursorTimer();
|
void HandleCursorTimer();
|
||||||
void OnHideCursorChanged();
|
void OnHideCursorChanged();
|
||||||
|
void OnKeepOnTopChanged(bool top);
|
||||||
void SetFillBackground(bool fill);
|
void SetFillBackground(bool fill);
|
||||||
|
|
||||||
static constexpr int MOUSE_HIDE_DELAY = 3000;
|
static constexpr int MOUSE_HIDE_DELAY = 3000;
|
||||||
|
@ -130,6 +130,20 @@ bool Settings::GetHideCursor() const
|
|||||||
return SConfig::GetInstance().bHideCursor;
|
return SConfig::GetInstance().bHideCursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::SetKeepWindowOnTop(bool top)
|
||||||
|
{
|
||||||
|
if (IsKeepWindowOnTopEnabled() == top)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SConfig::GetInstance().bKeepWindowOnTop = top;
|
||||||
|
emit KeepWindowOnTopChanged(top);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Settings::IsKeepWindowOnTopEnabled() const
|
||||||
|
{
|
||||||
|
return SConfig::GetInstance().bKeepWindowOnTop;
|
||||||
|
}
|
||||||
|
|
||||||
int Settings::GetVolume() const
|
int Settings::GetVolume() const
|
||||||
{
|
{
|
||||||
return SConfig::GetInstance().m_Volume;
|
return SConfig::GetInstance().m_Volume;
|
||||||
|
@ -74,6 +74,8 @@ public:
|
|||||||
// Graphics
|
// Graphics
|
||||||
void SetHideCursor(bool hide_cursor);
|
void SetHideCursor(bool hide_cursor);
|
||||||
bool GetHideCursor() const;
|
bool GetHideCursor() const;
|
||||||
|
void SetKeepWindowOnTop(bool top);
|
||||||
|
bool IsKeepWindowOnTopEnabled() const;
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
int GetVolume() const;
|
int GetVolume() const;
|
||||||
@ -126,6 +128,7 @@ signals:
|
|||||||
void DefaultGameChanged(const QString&);
|
void DefaultGameChanged(const QString&);
|
||||||
void PathReloadRequested(const QString&);
|
void PathReloadRequested(const QString&);
|
||||||
void HideCursorChanged();
|
void HideCursorChanged();
|
||||||
|
void KeepWindowOnTopChanged(bool top);
|
||||||
void VolumeChanged(int volume);
|
void VolumeChanged(int volume);
|
||||||
void NANDRefresh();
|
void NANDRefresh();
|
||||||
void RegistersVisibilityChanged(bool visible);
|
void RegistersVisibilityChanged(bool visible);
|
||||||
|
@ -178,7 +178,7 @@ void InterfacePane::LoadConfig()
|
|||||||
{
|
{
|
||||||
const SConfig& startup_params = SConfig::GetInstance();
|
const SConfig& startup_params = SConfig::GetInstance();
|
||||||
m_checkbox_auto_window->setChecked(startup_params.bRenderWindowAutoSize);
|
m_checkbox_auto_window->setChecked(startup_params.bRenderWindowAutoSize);
|
||||||
m_checkbox_top_window->setChecked(startup_params.bKeepWindowOnTop);
|
m_checkbox_top_window->setChecked(Settings::Instance().IsKeepWindowOnTopEnabled());
|
||||||
m_checkbox_render_to_window->setChecked(startup_params.bRenderToMain);
|
m_checkbox_render_to_window->setChecked(startup_params.bRenderToMain);
|
||||||
m_checkbox_use_builtin_title_database->setChecked(startup_params.m_use_builtin_title_database);
|
m_checkbox_use_builtin_title_database->setChecked(startup_params.m_use_builtin_title_database);
|
||||||
m_checkbox_show_debugging_ui->setChecked(Settings::Instance().IsDebugModeEnabled());
|
m_checkbox_show_debugging_ui->setChecked(Settings::Instance().IsDebugModeEnabled());
|
||||||
@ -200,7 +200,7 @@ void InterfacePane::OnSaveConfig()
|
|||||||
{
|
{
|
||||||
SConfig& settings = SConfig::GetInstance();
|
SConfig& settings = SConfig::GetInstance();
|
||||||
settings.bRenderWindowAutoSize = m_checkbox_auto_window->isChecked();
|
settings.bRenderWindowAutoSize = m_checkbox_auto_window->isChecked();
|
||||||
settings.bKeepWindowOnTop = m_checkbox_top_window->isChecked();
|
Settings::Instance().SetKeepWindowOnTop(m_checkbox_top_window->isChecked());
|
||||||
settings.bRenderToMain = m_checkbox_render_to_window->isChecked();
|
settings.bRenderToMain = m_checkbox_render_to_window->isChecked();
|
||||||
settings.m_use_builtin_title_database = m_checkbox_use_builtin_title_database->isChecked();
|
settings.m_use_builtin_title_database = m_checkbox_use_builtin_title_database->isChecked();
|
||||||
Settings::Instance().SetDebugModeEnabled(m_checkbox_show_debugging_ui->isChecked());
|
Settings::Instance().SetDebugModeEnabled(m_checkbox_show_debugging_ui->isChecked());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user