Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
feather/src/main.cpp at master · feather-wallet/feather · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
feather-wallet
feather
Repository navigation
Code
Issues
82
(82)
Pull requests
12
(12)
Actions
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
feather
/
src
/
main.cpp
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
224 lines (182 loc) · 7.16 KB
master
Breadcrumbs
feather
/
src
/
main.cpp
Copy path
Top
File metadata and controls
Code
Blame
224 lines (182 loc) · 7.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
//
SPDX-License-Identifier: BSD-3-Clause
//
SPDX-FileCopyrightText: The Monero Project
#
include
<
QSslSocket
>
#
include
"
Application.h
"
#
include
"
constants.h
"
#
include
"
utils/EventFilter.h
"
#
include
"
WindowManager.h
"
#
include
"
config.h
"
#
include
<
wallet/api/wallet2_api.h
>
#
include
"
libwalletqt/Wallet.h
"
#
include
"
libwalletqt/WalletManager.h
"
#
include
"
version.h
"
#
if
defined(Q_OS_LINUX) && defined(STACK_TRACE)
#
define
BOOST_STACKTRACE_LINK
#
include
<
signal.h
>
#
include
<
boost/stacktrace.hpp
>
#
include
<
fstream
>
#
endif
#
if
defined(Q_OS_WIN)
#
include
<
windows.h
>
#
include
<
vfw.h
>
#
endif
#
if
defined(Q_OS_LINUX) && defined(STATIC)
Q_IMPORT_PLUGIN
(QXcbIntegrationPlugin)
Q_IMPORT_PLUGIN
(QComposePlatformInputContextPlugin)
//
Needed for dead keys on Linux
Q_IMPORT_PLUGIN
(QWaylandIntegrationPlugin)
Q_IMPORT_PLUGIN
(QWaylandXdgShellIntegrationPlugin)
Q_IMPORT_PLUGIN
(QWaylandBradientDecorationPlugin)
#
endif
#
if
defined(Q_OS_MAC) && defined(STATIC)
Q_IMPORT_PLUGIN
(QDarwinCameraPermissionPlugin)
#
endif
#
if
defined(Q_OS_LINUX) && defined(STACK_TRACE)
void
signal_handler
(
int
signum) {
::signal
(signum,
SIG_DFL
);
std::stringstream keyStream;
keyStream <<
boost::stacktrace::stacktrace
();
std::cout << keyStream.
str
();
//
Write stack trace to disk
if
(
conf
()->
get
(Config::writeStackTraceToDisk).
toBool
()) {
QString crashLogPath{
Config::defaultConfigDir
().
path
() +
"
/crash_report.txt
"
};
std::ofstream
out
(crashLogPath.
toStdString
());
out <<
QString
(
"
Version: %1
\n
"
).
arg
(
FEATHER_VERSION
).
toStdString
();
out <<
QString
(
"
OS: %1
\n
"
).
arg
(
QSysInfo::prettyProductName
()).
toStdString
();
out << keyStream.
str
();
out.
close
();
}
::raise
(
SIGABRT
);
}
#
endif
int
main
(
int
argc,
char
*argv[])
{
Q_INIT_RESOURCE
(assets);
#
if
defined(Q_OS_LINUX) && defined(STACK_TRACE)
::signal
(
SIGSEGV
, &signal_handler);
::signal
(
SIGABRT
, &signal_handler);
#
endif
#
if
defined(HAS_TOR_BIN)
Q_INIT_RESOURCE
(assets_tor);
#
endif
#
ifdef
_WIN32
if
(
AttachConsole
(
ATTACH_PARENT_PROCESS
)) {
freopen
(
"
CONOUT$
"
,
"
w
"
, stdout);
freopen
(
"
CONOUT$
"
,
"
w
"
, stderr);
}
#
endif
#
if
defined(Q_OS_LINUX)
//
PassThrough results in muddy text
QApplication::setHighDpiScaleFactorRoundingPolicy
(Qt::HighDpiScaleFactorRoundingPolicy::Round);
#
endif
Application
app
(argc, argv);
QApplication::setApplicationName
(
"
FeatherWallet
"
);
QApplication::setApplicationVersion
(
FEATHER_VERSION
);
QCommandLineParser parser;
parser.
setApplicationDescription
(
"
Feather - a free Monero desktop wallet
"
);
QCommandLineOption helpOption = parser.
addHelpOption
();
QCommandLineOption versionOption = parser.
addVersionOption
();
QCommandLineOption
useLocalTorOption
(
"
use-local-tor
"
,
"
Use system wide installed Tor instead of the bundled.
"
);
parser.
addOption
(useLocalTorOption);
QCommandLineOption
quietModeOption
(
"
quiet
"
,
"
Limit console output
"
);
parser.
addOption
(quietModeOption);
QCommandLineOption
stagenetOption
(
"
stagenet
"
,
"
Stagenet is for development purposes only.
"
);
parser.
addOption
(stagenetOption);
QCommandLineOption
testnetOption
(
"
testnet
"
,
"
Testnet is for development purposes only.
"
);
parser.
addOption
(testnetOption);
parser.
process
(app);
if
(parser.
isSet
(versionOption) || parser.
isSet
(helpOption)) {
return
EXIT_SUCCESS
;
}
if
(app.
isAlreadyRunning
()) {
qWarning
() <<
"
Another instance of Feather is already running
"
;
return
EXIT_SUCCESS
;
}
bool
stagenet = parser.
isSet
(stagenetOption);
bool
testnet = parser.
isSet
(testnetOption);
bool
quiet = parser.
isSet
(quietModeOption);
//
Setup networkType
if
(stagenet)
constants::networkType = NetworkType::
STAGENET
;
else
if
(testnet)
constants::networkType = NetworkType::
TESTNET
;
else
constants::networkType = NetworkType::
MAINNET
;
QApplication::setQuitOnLastWindowClosed
(
false
);
QApplication::setDesktopSettingsAware
(
true
);
//
use system font
//
Setup config directories
QString configDir =
Config::defaultConfigDir
().
path
();
QString config_dir_tor =
QString
(
"
%1/%2
"
).
arg
(configDir,
"
tor
"
);
QString config_dir_tordata =
QString
(
"
%1/%2
"
).
arg
(configDir,
"
tor/data
"
);
QStringList
createDirs
({configDir, config_dir_tor, config_dir_tordata});
for
(
const
auto
&d: createDirs) {
if
(!
Utils::dirExists
(d)) {
qDebug
() <<
QString
(
"
Creating directory: %1
"
).
arg
(d);
if
(!
QDir
().
mkpath
(d)) {
qCritical
() <<
"
Could not create directory
"
<< d;
}
}
}
//
Setup logging
QString logPath =
QString
(
"
%1/libwallet.log
"
).
arg
(configDir);
Monero::Utils::onStartup
();
Monero::Wallet::init
(
"
"
,
"
feather
"
, logPath.
toStdString
(),
true
);
bool
logLevelFromEnv;
int
logLevel =
qEnvironmentVariableIntValue
(
"
MONERO_LOG_LEVEL
"
, &logLevelFromEnv);
if
(logLevelFromEnv) {
conf
()->
set
(Config::logLevel, logLevel);
}
else
{
logLevel =
conf
()->
get
(Config::logLevel).
toInt
();
}
if
(parser.
isSet
(
"
quiet
"
) ||
conf
()->
get
(Config::disableLogging).
toBool
()) {
qWarning
() <<
"
Logging is disabled
"
;
WalletManager::instance
()->
setLogLevel
(-
1
);
}
else
if
(logLevel >=
0
&& logLevel <= Monero::WalletManagerFactory::LogLevel_Max) {
Monero::WalletManagerFactory::setLogLevel
(logLevel);
}
//
Setup wallet directory
QString walletDir =
conf
()->
get
(Config::walletDirectory).
toString
();
if
(walletDir.
isEmpty
() ||
Utils::isPortableMode
()) {
walletDir =
Utils::defaultWalletDir
();
conf
()->
set
(Config::walletDirectory, walletDir);
}
if
(!
QDir
().
mkpath
(walletDir))
qCritical
() <<
"
Unable to create dir:
"
<< walletDir;
if
(parser.
isSet
(
"
use-local-tor
"
))
conf
()->
set
(Config::useLocalTor,
true
);
conf
()->
set
(Config::restartRequired,
false
);
if
(!quiet) {
QList<QPair<QString, QString>> info;
info.
emplace_back
(
"
Feather
"
,
FEATHER_VERSION
);
info.
emplace_back
(
"
Monero
"
,
MONERO_VERSION
);
info.
emplace_back
(
"
Qt
"
,
QT_VERSION_STR
);
info.
emplace_back
(
"
Tor
"
,
TOR_VERSION
);
info.
emplace_back
(
"
SSL
"
,
QSslSocket::sslLibraryVersionString
());
info.
emplace_back
(
"
Mode
"
, stagenet ?
"
Stagenet
"
: (testnet ?
"
Testnet
"
:
"
Mainnet
"
));
for
(
const
auto
&k: info) {
qWarning
().
nospace
().
noquote
() <<
QString
(
"
%1: %2
"
).
arg
(k.
first
, k.
second
);
}
}
#
if
defined(Q_OS_MAC)
//
For some odd reason, if we don't do this, QPushButton's
//
need to be clicked *twice* in order to fire ?!
QFont fontDef =
QApplication::font
();
fontDef.
setPointSize
(fontDef.
pointSize
() +
1
);
QApplication::setFont
(fontDef);
#
endif
qInstallMessageHandler
(Utils::applicationLogHandler);
qRegisterMetaType<QVector<QString>>();
qRegisterMetaType<TxProofResult>(
"
TxProofResult
"
);
qRegisterMetaType<QPair<
bool
,
bool
>>();
EventFilter filter;
app.
installEventFilter
(&filter);
auto
*pool =
QThreadPool::globalInstance
();
if
(pool->
maxThreadCount
() <
8
) {
pool->
setMaxThreadCount
(
8
);
}
auto
wm =
windowManager
();
wm->
setEventFilter
(&filter);
int
exitCode =
Application::exec
();
qDebug
() <<
"
Application::exec() returned
"
;
return
exitCode;
}
You can’t perform that action at this time.