aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp7
-rw-r--r--src/makefile.unix4
-rw-r--r--src/net.cpp19
-rw-r--r--src/qt/bitcoingui.cpp32
-rw-r--r--src/qt/bitcoingui.h4
5 files changed, 45 insertions, 21 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 3ca0dcf251..bb549ec42b 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -20,6 +20,7 @@ Q_IMPORT_PLUGIN(qcncodecs)
Q_IMPORT_PLUGIN(qjpcodecs)
Q_IMPORT_PLUGIN(qtwcodecs)
Q_IMPORT_PLUGIN(qkrcodecs)
+Q_IMPORT_PLUGIN(qtaccessiblewidgets)
#endif
using namespace std;
@@ -208,7 +209,7 @@ bool AppInit2(int argc, char* argv[])
#ifdef GUI
" -server \t\t " + _("Accept command line and JSON-RPC commands\n") +
#endif
-#ifndef WIN32
+#if !defined(WIN32) && !defined(GUI)
" -daemon \t\t " + _("Run in the background as a daemon and accept commands\n") +
#endif
" -testnet \t\t " + _("Use the test network\n") +
@@ -247,7 +248,7 @@ bool AppInit2(int argc, char* argv[])
fTestNet = GetBoolArg("-testnet");
fDebug = GetBoolArg("-debug");
-#ifndef WIN32
+#if !defined(WIN32) && !defined(GUI)
fDaemon = GetBoolArg("-daemon");
#else
fDaemon = false;
@@ -278,7 +279,7 @@ bool AppInit2(int argc, char* argv[])
}
#endif
-#ifndef WIN32
+#if !defined(WIN32) && !defined(GUI)
if (fDaemon)
{
// Daemonize
diff --git a/src/makefile.unix b/src/makefile.unix
index 53948bcba6..e75dda514f 100644
--- a/src/makefile.unix
+++ b/src/makefile.unix
@@ -7,7 +7,7 @@ USE_UPNP:=0
DEFS=-DNOPCH
DEFS += $(addprefix -I,$(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH))
-LIBS += $(addprefix -l,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH))
+LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH))
LMODE = dynamic
LMODE2 = dynamic
@@ -21,7 +21,7 @@ else
endif
# for boost 1.37, add -mt to the boost libraries
-LIBS= \
+LIBS += \
-Wl,-B$(LMODE) \
-l boost_system$(BOOST_LIB_SUFFIX) \
-l boost_filesystem$(BOOST_LIB_SUFFIX) \
diff --git a/src/net.cpp b/src/net.cpp
index b9597d92b9..b314405efc 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -931,13 +931,17 @@ void ThreadSocketHandler2(void* parg)
struct sockaddr_in sockaddr;
socklen_t len = sizeof(sockaddr);
SOCKET hSocket = accept(hListenSocket, (struct sockaddr*)&sockaddr, &len);
- CAddress addr(sockaddr);
+ CAddress addr;
int nInbound = 0;
+ if (hSocket != INVALID_SOCKET)
+ addr = CAddress(sockaddr);
+
CRITICAL_BLOCK(cs_vNodes)
BOOST_FOREACH(CNode* pnode, vNodes)
if (pnode->fInbound)
nInbound++;
+
if (hSocket == INVALID_SOCKET)
{
if (WSAGetLastError() != WSAEWOULDBLOCK)
@@ -1478,9 +1482,13 @@ void ThreadOpenConnections2(void* parg)
int64 nStart = GetTime();
loop
{
- // Limit outbound connections
vnThreadsRunning[1]--;
Sleep(500);
+ vnThreadsRunning[1]++;
+ if (fShutdown)
+ return;
+
+ // Limit outbound connections
loop
{
int nOutbound = 0;
@@ -1492,13 +1500,12 @@ void ThreadOpenConnections2(void* parg)
nMaxOutboundConnections = min(nMaxOutboundConnections, (int)GetArg("-maxconnections", 125));
if (nOutbound < nMaxOutboundConnections)
break;
+ vnThreadsRunning[1]--;
Sleep(2000);
+ vnThreadsRunning[1]++;
if (fShutdown)
return;
}
- vnThreadsRunning[1]++;
- if (fShutdown)
- return;
bool fAddSeeds = false;
@@ -1895,7 +1902,7 @@ bool StopNode()
fShutdown = true;
nTransactionsUpdated++;
int64 nStart = GetTime();
- while (vnThreadsRunning[0] > 0 || vnThreadsRunning[2] > 0 || vnThreadsRunning[3] > 0 || vnThreadsRunning[4] > 0
+ while (vnThreadsRunning[0] > 0 || vnThreadsRunning[1] > 0 || vnThreadsRunning[2] > 0 || vnThreadsRunning[3] > 0 || vnThreadsRunning[4] > 0
#ifdef USE_UPNP
|| vnThreadsRunning[5] > 0
#endif
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 5d9c0d9f00..cfcff136e0 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -55,6 +55,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
QMainWindow(parent),
clientModel(0),
walletModel(0),
+ dummyWidget(0),
encryptWalletAction(0),
changePassphraseAction(0),
aboutQtAction(0),
@@ -84,6 +85,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();
@@ -157,6 +161,7 @@ BitcoinGUI::~BitcoinGUI()
#ifdef Q_WS_MAC
delete appMenuBar;
#endif
+ delete dummyWidget;
}
void BitcoinGUI::createActions()
@@ -193,15 +198,15 @@ void BitcoinGUI::createActions()
sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
tabGroup->addAction(sendCoinsAction);
- connect(overviewAction, SIGNAL(triggered()), this, SLOT(show()));
+ connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
- connect(historyAction, SIGNAL(triggered()), this, SLOT(show()));
+ connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
- connect(addressBookAction, SIGNAL(triggered()), this, SLOT(show()));
+ connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
- connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(show()));
+ connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
- connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(show()));
+ connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormal()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
@@ -379,10 +384,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())
@@ -524,13 +536,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();
}
}
}
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index a0905e44ad..48eac2aa33 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -57,6 +57,8 @@ private:
QStackedWidget *centralWidget;
+ QWidget *dummyWidget;
+
OverviewPage *overviewPage;
QWidget *transactionsPage;
AddressBookPage *addressBookPage;
@@ -124,6 +126,8 @@ public slots:
*/
void askFee(qint64 nFeeRequired, bool *payFee);
+ void showNormal();
+
private slots:
/** Switch to overview (home) page */
void gotoOverviewPage();