Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gui: Make main Gridcoin window geometry save unique to datadir location #2661

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,14 @@ BitcoinGUI::BitcoinGUI(QWidget* parent)
, nWeight(0)
{
QSettings settings;
if (!restoreGeometry(settings.value("MainWindowGeometry").toByteArray())) {

QString window_geometry_key = "MainWindowGeometry";

if (GetDataDir() != GetDefaultDataDir()) {
window_geometry_key += "_" + QString().fromStdString(SanitizeString(GetDataDir().string()));
}

if (!restoreGeometry(settings.value(window_geometry_key).toByteArray())) {
// Restore failed (perhaps missing setting), center the window
setGeometry(QStyle::alignedRect(Qt::LeftToRight,Qt::AlignCenter,QDesktopWidget().availableGeometry(this).size()
* 0.4,QDesktopWidget().availableGeometry(this)));
Expand Down Expand Up @@ -236,7 +243,14 @@ BitcoinGUI::BitcoinGUI(QWidget* parent)
BitcoinGUI::~BitcoinGUI()
{
QSettings settings;
settings.setValue("MainWindowGeometry", saveGeometry());

QString window_geometry_key = "MainWindowGeometry";

if (GetDataDir() != GetDefaultDataDir()) {
window_geometry_key += "_" + QString().fromStdString(SanitizeString(GetDataDir().string()));
}

settings.setValue(window_geometry_key, saveGeometry());
if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu)
trayIcon->hide();
#ifdef Q_OS_MAC
Expand Down