Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F629632
main.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
main.cpp
View Options
#include
"MainWindow.h"
#include
<QApplication>
#include
"ApplicationGlobal.h"
#include
"MySettings.h"
#include
"main.h"
#include
<string>
#include
<QMessageBox>
#include
<QDir>
#include
<QDebug>
#include
<QProxyStyle>
#include
<QTranslator>
#include
"webclient.h"
#include
"win32/win32.h"
#include
"common/misc.h"
#include
"../darktheme/src/DarkStyle.h"
#include
<QStandardPaths>
#include
"common/joinpath.h"
ApplicationGlobal
*
global
=
0
;
ApplicationSettings
ApplicationSettings::defaultSettings
()
{
ApplicationSettings
s
;
s
.
proxy_server
=
"http://squid:3128/"
;
return
s
;
}
static
bool
isHighDpiScalingEnabled
(
int
argc
,
char
*
argv
[])
{
MySettings
s
;
s
.
beginGroup
(
"UI"
);
QVariant
v
=
s
.
value
(
"EnableHighDpiScaling"
);
return
v
.
isNull
()
||
v
.
toBool
();
}
int
main
(
int
argc
,
char
*
argv
[])
{
putenv
((
char
*
)
"UNICODEMAP_JP=cp932"
);
ApplicationGlobal
g
;
global
=
&
g
;
global
->
organization_name
=
ORGANIZATION_NAME
;
global
->
application_name
=
APPLICATION_NAME
;
global
->
generic_config_dir
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericConfigLocation
);
global
->
app_config_dir
=
global
->
generic_config_dir
/
global
->
organization_name
/
global
->
application_name
;
global
->
config_file_path
=
joinpath
(
global
->
app_config_dir
,
global
->
application_name
+
".ini"
);
if
(
!
QFileInfo
(
global
->
app_config_dir
).
isDir
())
{
QDir
().
mkpath
(
global
->
app_config_dir
);
}
if
(
isHighDpiScalingEnabled
(
argc
,
argv
)){
#if (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
qDebug
()
<<
"High DPI scaling is not supported"
;
#else
QCoreApplication
::
setAttribute
(
Qt
::
AA_EnableHighDpiScaling
);
#endif
}
QApplication
a
(
argc
,
argv
);
a
.
setOrganizationName
(
global
->
organization_name
);
a
.
setApplicationName
(
global
->
application_name
);
{
MySettings
s
;
s
.
beginGroup
(
"UI"
);
QString
theme
=
s
.
value
(
"Theme"
).
toString
();
if
(
theme
.
compare
(
"dark"
,
Qt
::
CaseInsensitive
)
==
0
)
{
global
->
theme
=
createDarkTheme
();
}
else
{
global
->
theme
=
createStandardTheme
();
}
}
QApplication
::
setStyle
(
global
->
theme
->
newStyle
());
if
(
QApplication
::
queryKeyboardModifiers
()
&
Qt
::
ShiftModifier
)
{
global
->
start_with_shift_key
=
true
;
}
WebClient
::
initialize
();
bool
f_open_here
=
false
;
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
std
::
string
arg
=
argv
[
i
];
if
(
arg
==
"--open-here"
)
{
f_open_here
=
true
;
}
}
if
(
global
->
app_config_dir
.
isEmpty
())
{
QMessageBox
::
warning
(
0
,
qApp
->
applicationName
(),
"Preparation of data storage folder failed."
);
return
1
;
}
QTranslator
translator
;
{
#if defined(Q_OS_MACX)
QString
path
=
"../Resources/Guitar_ja"
;
#else
QString
path
=
"Guitar_ja"
;
#endif
translator
.
load
(
path
,
a
.
applicationDirPath
());
a
.
installTranslator
(
&
translator
);
}
MainWindow
w
;
global
->
panel_bg_color
=
w
.
palette
().
color
(
QPalette
::
Background
);
w
.
setWindowIcon
(
QIcon
(
":/image/guitar.png"
));
w
.
show
();
w
.
shown
();
if
(
f_open_here
)
{
QString
dir
=
QDir
::
current
().
absolutePath
();
w
.
autoOpenRepository
(
dir
);
}
return
a
.
exec
();
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sun, Nov 15, 7:23 AM (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
152153
Default Alt Text
main.cpp (2 KB)
Attached To
Mode
R77 Guitar
Attached
Detach File
Event Timeline