-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.cpp
126 lines (110 loc) · 3.08 KB
/
main.cpp
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
#include "mainwindow.h"
#include <QApplication>
#include <clocale>
#include "steghide-src/common.h"
#include "steghide-src/Session.h"
#include "steghide-src/SteghideError.h"
#ifdef WIN32 // locale support on Windows
#include <windows.h>
typedef struct struct_LCIDENTRY {
LCID localeID ;
char language[3] ;
} LCIDENTRY ;
LCIDENTRY LCIDTable[] = {
// french
{ 0x040c, "fr" }, // France
{ 0x080c, "fr" }, // Belgium
{ 0x0c0c, "fr" }, // Canada
{ 0x100c, "fr" }, // Switzerland
{ 0x140c, "fr" }, // Luxembourg
{ 0x180c, "fr" }, // Monaco
// german
{ 0x0407, "de" }, // Germany
{ 0x0807, "de" }, // Switzerland
{ 0x0c07, "de" }, // Austria
{ 0x1007, "de" }, // Luxembourg
{ 0x1407, "de" }, // Liechtenstein
// spanish
{ 0x040a, "es" }, // Spain - Traditional
{ 0x080a, "es" }, // Mexico
{ 0x0c0a, "es" }, // Spain - Modern Sort
{ 0x100a, "es" }, // Guatemala
{ 0x140a, "es" }, // Costa Rica
{ 0x180a, "es" }, // Panama
{ 0x1c0a, "es" }, // Dominican Republic
{ 0x200a, "es" }, // Venezuela
{ 0x240a, "es" }, // Colombia
{ 0x280a, "es" }, // Peru
{ 0x2c0a, "es" }, // Argentinia
{ 0x300a, "es" }, // Ecuador
{ 0x340a, "es" }, // Chile
{ 0x380a, "es" }, // Uruguay
{ 0x3c0a, "es" }, // Paraguay
{ 0x400a, "es" }, // Bolivia
{ 0x440a, "es" }, // El Salvador
{ 0x480a, "es" }, // Honduras
{ 0x4c0a, "es" }, // Nicaragua
{ 0x500a, "es" }, // Puerto Rico
// romanian
{ 0x0418, "ro" }, // Romanian
{ 0x0818, "ro" }, // Romanian (Moldova)
// end of LCIDTable
{ 0x0000, "__" }
} ;
#undef LOCALEDIR
#define LOCALEDIR "./locale/"
#endif // WIN32
static void gettext_init (void) ;
int main(int argc, char *argv[])
{
if(argc==1){
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
else{
try {
gettext_init() ;
Args = Arguments (argc, argv) ;
Args.parse() ;
Session s ;
s.run() ;
}
catch (SteghideError& e) {
e.printMessage() ;
exit(EXIT_FAILURE) ;
}
exit(EXIT_SUCCESS) ;
}
}
static void gettext_init (void)
{
#ifndef DEBUG
/* initialize gettext */
setlocale (LC_ALL, "") ;
bindtextdomain (PACKAGE, LOCALEDIR) ;
bind_textdomain_codeset (PACKAGE, "ISO-8859-1") ;
textdomain (PACKAGE) ;
#ifdef WIN32
/* using the Windows API to find out which language should be used
(as there is no environment variable indicating the language) */
{
LCID localeID = GetThreadLocale () ;
int i = 0 ;
while (LCIDTable[i].localeID != 0x0000) {
if (localeID == LCIDTable[i].localeID) {
setenv ("LANG", LCIDTable[i].language, 1) ;
/* Make Change known (see gettext manual) */
{
extern int _nl_msg_cat_cntr ;
++_nl_msg_cat_cntr;
}
break ;
}
i++ ;
}
}
#endif // ndef WIN32
#endif // ndef DEBUG
}