mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed proper handling of language parameter at startup
This commit is contained in:
parent
9210e52aae
commit
142a8e2503
@ -251,7 +251,7 @@ void GenCertDialog::initKeyList()
|
|||||||
|
|
||||||
void GenCertDialog::mouseMoveEvent(QMouseEvent *e)
|
void GenCertDialog::mouseMoveEvent(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
std::cerr << "Mouse : " << e->x() << ", " << e->y() << std::endl;
|
//std::cerr << "Mouse : " << e->x() << ", " << e->y() << std::endl;
|
||||||
|
|
||||||
QDialog::mouseMoveEvent(e) ;
|
QDialog::mouseMoveEvent(e) ;
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@
|
|||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QCheckBox" name="useLocalServer">
|
<widget class="QCheckBox" name="useLocalServer">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>When checked, this instance receives new parameters (like RsLink or RsFile) and avoid new one.</string>
|
<string><html><head/><body><p>When checked, this retroshare instance will accept calls by your operating system to open Retroshare collection files, and download links.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use Local Server to get new arguments.</string>
|
<string>Use Local Server to get new arguments.</string>
|
||||||
|
@ -120,13 +120,13 @@ static void showHelp(const argstream& as)
|
|||||||
"+================================================================+"
|
"+================================================================+"
|
||||||
<< std::endl ;
|
<< std::endl ;
|
||||||
|
|
||||||
std::cerr << as.usage(true) << std::endl;
|
std::cerr << as.usage(false) << std::endl;
|
||||||
|
|
||||||
char *argv[1];
|
char *argv[1];
|
||||||
int argc=0;
|
int argc=0;
|
||||||
QApplication dummyApp (argc, argv); // needed for QMessageBox
|
QApplication dummyApp (argc, argv); // needed for QMessageBox
|
||||||
QMessageBox box;
|
QMessageBox box;
|
||||||
QString text = QString::fromUtf8(as.usage(true,false).c_str());
|
QString text = QString::fromUtf8(as.usage(false,false).c_str());
|
||||||
QFont font("Courier New",10,50,false);
|
QFont font("Courier New",10,50,false);
|
||||||
font.setStyleHint(QFont::TypeWriter,QFont::PreferMatch);
|
font.setStyleHint(QFont::TypeWriter,QFont::PreferMatch);
|
||||||
font.setStyle(QFont::StyleNormal);
|
font.setStyle(QFont::StyleNormal);
|
||||||
@ -212,6 +212,31 @@ static void sendArgsToRunningInstance(const QStringList& args)
|
|||||||
newArgs.detach();
|
newArgs.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool setLanguage(const std::string& language)
|
||||||
|
{
|
||||||
|
if(!language.empty())
|
||||||
|
{
|
||||||
|
if(!LanguageSupport::translate(QString::fromStdString(language)))
|
||||||
|
{
|
||||||
|
RsErr() << "Language \"" << language << "\" is not supported." ;
|
||||||
|
|
||||||
|
QString s;
|
||||||
|
for(QString ss:LanguageSupport::languageCodes())
|
||||||
|
s += ss + ", " ;
|
||||||
|
|
||||||
|
RsErr() << "Possible choices are: " << s.toStdString();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LanguageSupport::translate(LanguageSupport::defaultLanguageCode());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void displayWarningAboutDSAKeys()
|
static void displayWarningAboutDSAKeys()
|
||||||
{
|
{
|
||||||
std::map<std::string,std::vector<std::string> > unsupported_keys;
|
std::map<std::string,std::vector<std::string> > unsupported_keys;
|
||||||
@ -348,21 +373,21 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||||||
as >> option( 's',"stderr" ,conf.outStderr ,"output to stderr instead of log file " )
|
as >> option( 's',"stderr" ,conf.outStderr ,"output to stderr instead of log file " )
|
||||||
>> option( 'u',"udp" ,conf.udpListenerOnly ,"Only listen to UDP " )
|
>> option( 'u',"udp" ,conf.udpListenerOnly ,"Only listen to UDP " )
|
||||||
>> option( 'R',"reset" ,conf.optResetParams ,"reset retroshare parameters " )
|
>> option( 'R',"reset" ,conf.optResetParams ,"reset retroshare parameters " )
|
||||||
>> parameter('c',"base-dir" ,conf.optBaseDir ,"directory" ,"Set base directory " ,false)
|
>> parameter('c',"base-dir" ,conf.optBaseDir ,"directory" ,"Set base directory " ,false)
|
||||||
>> parameter('l',"log-file" ,logfilename ,"logfile" ,"Set Log filename " ,false)
|
>> parameter('l',"log-file" ,logfilename ,"logfile" ,"Set Log filename " ,false)
|
||||||
>> parameter('d',"debug-level" ,loglevel ,"level (debug,info,notice,warn,error,off)","Set debug level " ,false)
|
>> parameter('d',"debug-level" ,loglevel ,"level (debug,info,notice,warn,error,off)","Set debug level " ,false)
|
||||||
>> parameter('i',"ip-address" ,conf.forcedInetAddress ,"nnn.nnn.nnn.nnn" ,"Force IP address " ,false)
|
>> parameter('i',"ip-address" ,conf.forcedInetAddress ,"nnn.nnn.nnn.nnn" ,"Force IP address " ,false)
|
||||||
>> parameter('p',"port" ,conf.forcedPort ,"port" ,"Set listenning port " ,false)
|
>> parameter('p',"port" ,conf.forcedPort ,"port" ,"Set listenning port " ,false)
|
||||||
>> parameter('o',"opmode" ,conf.opModeStr ,"opmode (Full, NoTurtle, Gaming, Minimal)","Set mode" ,false)
|
>> parameter('o',"opmode" ,conf.opModeStr ,"opmode (Full, NoTurtle, Gaming, Minimal)","Set mode" ,false)
|
||||||
>> parameter('t',"tor" ,conf.userSuppliedTorExecutable,"tor" ,"supply full tor executable path " ,false)
|
>> parameter('t',"tor" ,conf.userSuppliedTorExecutable,"path" ,"supply full tor executable path " ,false)
|
||||||
>> parameter('g',"style" ,guistyle ,"style " ,"" ,false)
|
>> parameter('g',"style" ,guistyle ,"style (fusion,windows,gtk2,breeze)" ,"set GUI style" ,false)
|
||||||
>> parameter('k',"style" ,guistylesheetfile ,"style sheet file" ,"gui stylesheet file" ,false)
|
>> parameter('k',"style" ,guistylesheetfile ,"file" ,"gui stylesheet file" ,false)
|
||||||
>> parameter('L',"lang" ,language ,"langage" ,"language string" ,false)
|
>> parameter('L',"lang" ,language ,"langage (fr,cn,...)" ,"set language" ,false)
|
||||||
>> parameter('r',"link" ,rslink ,"retroshare link" ,"retroshare link to open (passed to running server)" ,false)
|
>> parameter('r',"link" ,rslink ,"retroshare link" ,"retroshare link to open (passed to running server)" ,false)
|
||||||
>> parameter('f',"rsfile" ,rsfile ,"rsfile" ,"rscollection file to open (passed to running server)" ,false);
|
>> parameter('f',"rsfile" ,rsfile ,"rsfile" ,"rscollection file to open (passed to running server)" ,false);
|
||||||
#ifdef RS_JSONAPI
|
#ifdef RS_JSONAPI
|
||||||
as >> parameter('J', "jsonApiPort" ,conf.jsonApiPort ,"jsonApiPort" ,"Enable JSON API on the specified port" ,false)
|
as >> parameter('J', "jsonApiPort" ,conf.jsonApiPort ,"jsonApiPort" ,"Enable JSON API on the specified port" ,false)
|
||||||
>> parameter('P', "jsonApiBindAddress",conf.jsonApiBindAddress ,"jsonApiBindAddress" ,"JSON API Bind Address " ,false);
|
>> parameter('P', "jsonApiBindAddress",conf.jsonApiBindAddress ,"jsonApiBindAddress" ,"JSON API Bind Address " ,false);
|
||||||
#endif // ifdef RS_JSONAPI
|
#endif // ifdef RS_JSONAPI
|
||||||
|
|
||||||
#ifdef LOCALNET_TESTING
|
#ifdef LOCALNET_TESTING
|
||||||
@ -420,7 +445,9 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||||||
{
|
{
|
||||||
QApplication dummyApp (argc, argv); // needed for QMessageBox
|
QApplication dummyApp (argc, argv); // needed for QMessageBox
|
||||||
/* Translate into the desired language */
|
/* Translate into the desired language */
|
||||||
LanguageSupport::translate(LanguageSupport::defaultLanguageCode());
|
|
||||||
|
if(!setLanguage(language))
|
||||||
|
return 1;
|
||||||
|
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setText(QObject::tr("This version of RetroShare is using OpenPGP-SDK. As a side effect, it's not using the system shared PGP keyring, but has it's own keyring shared by all RetroShare instances. <br><br>You do not appear to have such a keyring, although PGP keys are mentioned by existing RetroShare accounts, probably because you just changed to this new version of the software."));
|
msgBox.setText(QObject::tr("This version of RetroShare is using OpenPGP-SDK. As a side effect, it's not using the system shared PGP keyring, but has it's own keyring shared by all RetroShare instances. <br><br>You do not appear to have such a keyring, although PGP keys are mentioned by existing RetroShare accounts, probably because you just changed to this new version of the software."));
|
||||||
@ -451,7 +478,9 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||||||
/* Error occured */
|
/* Error occured */
|
||||||
QApplication dummyApp (argc, argv); // needed for QMessageBox
|
QApplication dummyApp (argc, argv); // needed for QMessageBox
|
||||||
/* Translate into the desired language */
|
/* Translate into the desired language */
|
||||||
LanguageSupport::translate(LanguageSupport::defaultLanguageCode());
|
|
||||||
|
if(!setLanguage(language))
|
||||||
|
return 1;
|
||||||
|
|
||||||
displayWarningAboutDSAKeys();
|
displayWarningAboutDSAKeys();
|
||||||
|
|
||||||
@ -479,10 +508,16 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||||||
in this case it can be use only for default values */
|
in this case it can be use only for default values */
|
||||||
RshareSettings::Create ();
|
RshareSettings::Create ();
|
||||||
|
|
||||||
|
if(LanguageSupport::isValidLanguageCode(QString::fromStdString(language)))
|
||||||
|
conf.language = QString::fromStdString(language);
|
||||||
|
|
||||||
/* Setup The GUI Stuff */
|
/* Setup The GUI Stuff */
|
||||||
//Rshare rshare(args, argc, argv, QString::fromUtf8(RsAccounts::ConfigDirectory().c_str()));
|
//Rshare rshare(args, argc, argv, QString::fromUtf8(RsAccounts::ConfigDirectory().c_str()));
|
||||||
RsApplication rshare(conf);
|
RsApplication rshare(conf);
|
||||||
|
|
||||||
|
if(!setLanguage(language))
|
||||||
|
return 1;
|
||||||
|
|
||||||
/* Start RetroShare */
|
/* Start RetroShare */
|
||||||
QString sDefaultGXSIdToCreate = "";
|
QString sDefaultGXSIdToCreate = "";
|
||||||
switch (initResult) {
|
switch (initResult) {
|
||||||
|
Loading…
Reference in New Issue
Block a user