Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benjamin Allred
crown-core
Commits
ac6f6d80
Commit
ac6f6d80
authored
13 years ago
by
Wladimir J. van der Laan
Browse files
Options
Download
Plain Diff
Merge pull request #826 from laanwj/2012_02_fixminimizetotray
Fix Minimize to the tray instead of the taskbar (rework)
parents
36eaf84b
b028a089
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/qt/bitcoingui.cpp
+23
-11
src/qt/bitcoingui.cpp
src/qt/bitcoingui.h
+4
-0
src/qt/bitcoingui.h
with
27 additions
and
11 deletions
+27
-11
src/qt/bitcoingui.cpp
View file @
ac6f6d80
...
...
@@ -56,6 +56,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
QMainWindow
(
parent
),
clientModel
(
0
),
walletModel
(
0
),
dummyWidget
(
0
),
encryptWalletAction
(
0
),
changePassphraseAction
(
0
),
aboutQtAction
(
0
),
...
...
@@ -85,6 +86,9 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
// Create the tray icon (or setup the dock icon)
createTrayIcon
();
// Dummy widget used when restoring window state after minimization
dummyWidget
=
new
QWidget
();
// Create tabs
overviewPage
=
new
OverviewPage
();
...
...
@@ -162,6 +166,7 @@ BitcoinGUI::~BitcoinGUI()
#ifdef Q_WS_MAC
delete
appMenuBar
;
#endif
delete
dummyWidget
;
}
void
BitcoinGUI
::
createActions
()
...
...
@@ -205,17 +210,17 @@ void BitcoinGUI::createActions()
#endif
tabGroup
->
addAction
(
messageAction
);
connect
(
overviewAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
show
()));
connect
(
overviewAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
show
Normal
()));
connect
(
overviewAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoOverviewPage
()));
connect
(
historyAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
show
()));
connect
(
historyAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
show
Normal
()));
connect
(
historyAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoHistoryPage
()));
connect
(
addressBookAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
show
()));
connect
(
addressBookAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
show
Normal
()));
connect
(
addressBookAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoAddressBookPage
()));
connect
(
receiveCoinsAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
show
()));
connect
(
receiveCoinsAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
show
Normal
()));
connect
(
receiveCoinsAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoReceiveCoinsPage
()));
connect
(
sendCoinsAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
show
()));
connect
(
sendCoinsAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
show
Normal
()));
connect
(
sendCoinsAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoSendCoinsPage
()));
connect
(
messageAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
show
()));
connect
(
messageAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
show
Normal
()));
connect
(
messageAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
gotoMessagePage
()));
quitAction
=
new
QAction
(
QIcon
(
":/icons/quit"
),
tr
(
"E&xit"
),
this
);
...
...
@@ -405,10 +410,17 @@ void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
// Click on system tray icon triggers "open bitcoin"
openBitcoinAction
->
trigger
();
}
}
#endif
void
BitcoinGUI
::
showNormal
()
{
// Reparent window to the desktop (in case it was hidden on minimize)
if
(
parent
()
!=
NULL
)
setParent
(
NULL
,
Qt
::
Window
);
QMainWindow
::
showNormal
();
}
void
BitcoinGUI
::
optionsClicked
()
{
if
(
!
clientModel
||
!
clientModel
->
getOptionsModel
())
...
...
@@ -550,13 +562,13 @@ void BitcoinGUI::changeEvent(QEvent *e)
{
if
(
isMinimized
())
{
hide
();
e
->
ignore
();
// Hiding the window from taskbar
setParent
(
dummyWidget
,
Qt
::
SubWindow
);
return
;
}
else
{
show
();
e
->
accept
();
showNormal
();
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/qt/bitcoingui.h
View file @
ac6f6d80
...
...
@@ -58,6 +58,8 @@ private:
QStackedWidget
*
centralWidget
;
QWidget
*
dummyWidget
;
OverviewPage
*
overviewPage
;
QWidget
*
transactionsPage
;
AddressBookPage
*
addressBookPage
;
...
...
@@ -131,6 +133,8 @@ public slots:
void
gotoMessagePage
();
void
gotoMessagePage
(
QString
);
void
showNormal
();
private
slots
:
/** Switch to overview (home) page */
void
gotoOverviewPage
();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help