Skip to content

Commit cb45158

Browse files
committed
touching up for new release
1 parent c1c5075 commit cb45158

File tree

3 files changed

+35
-24
lines changed

3 files changed

+35
-24
lines changed

apps/cmstapp/code/control_box/controlbox.cpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,20 @@ ControlBox::ControlBox(const QCommandLineParser& parser, QWidget *parent)
171171
// Even then the fix may not work, but for now keep it in.
172172
b_usexfce = parser.isSet("use-xfce");
173173

174-
// set counter update params from command line options if available
175-
// otherwise, default params specified in main.cpp are used
176-
wifi_interval = parser.value("wifi-scan-rate").toUInt(); // number of seconds between wifi scans
177-
counter_accuracy = parser.value("counter-update-kb").toUInt(); // number of kb for counter updates
178-
counter_period = parser.value("counter-update-rate").toUInt(); // number of seconds for counter updates
174+
// set counter update params from command line options if available otherwise
175+
// default params specified in main.cpp are used. Set a minimum value for
176+
// each to maintain program response.
177+
uint minval = 10;
178+
uint setval = parser.value("wifi-scan-rate").toUInt();
179+
wifi_interval = setval > minval ? setval : minval; // number of seconds between wifi scans
180+
181+
minval = 256;
182+
setval = parser.value("counter-update-kb").toUInt();
183+
counter_accuracy = setval > minval ? setval : minval; // number of kb for counter updates
184+
185+
minval = 5;
186+
setval = parser.value("counter-update-rate").toUInt();
187+
counter_period = setval > minval ? setval : minval; // number of seconds for counter updates
179188

180189
// connect counter signal to the counterUpdated slot before we register the counter, assuming counters are not disabled
181190
if (! parser.isSet("disable-counters"))
@@ -1402,7 +1411,8 @@ void ControlBox::assemblePage3()
14021411

14031412
// initilize the table
14041413
ui.tableWidget_wifi->clearContents();
1405-
int rowcount=0;
1414+
ui.tableWidget_wifi->setRowCount(0);
1415+
int rowcount = 0;
14061416

14071417
// Make sure we got the services_list before we try to work with it.
14081418
if ( (q8_errors & CMST::Err_Services) != 0x00 ) return;

apps/cmstapp/code/main.cpp

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ void signalhandler(int sig) {
4848
return;
4949
}
5050

51-
52-
// uncomment to install translation code
53-
#define USE_TRANSLATIONS
54-
5551
int main(int argc, char *argv[])
5652
{
5753
QApplication::setApplicationName(LONG_NAME);
@@ -110,19 +106,24 @@ int main(int argc, char *argv[])
110106
// QT5.4 keep the command line option so users start up commands don't break, but make it a NOP.
111107
QCommandLineOption useXFCE(QStringList() << "use-xfce", QCoreApplication::translate("main.cpp", "Use XFCE specific code.") );
112108
parser.addOption(useXFCE);
113-
114-
#ifdef USE_TRANSLATIONS
115-
QTranslator qtTranslator;
116-
qtTranslator.load("qt_" + QLocale::system().name(),
117-
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
118-
app.installTranslator(&qtTranslator);
119-
120-
QTranslator cmstTranslator;
121-
if (cmstTranslator.load("cmst_" + QLocale::system().name(), ":/translations/translations" ) ) {
122-
app.installTranslator(&cmstTranslator);
123-
}
124-
#endif
125-
109+
110+
// Setup translations
111+
QTranslator qtTranslator;
112+
qtTranslator.load("qt_" + QLocale::system().name(),
113+
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
114+
app.installTranslator(&qtTranslator);
115+
116+
QTranslator cmstTranslator;
117+
if (cmstTranslator.load("cmst_" + QLocale::system().name(), ":/translations/translations" ) ) {
118+
app.installTranslator(&cmstTranslator);
119+
}
120+
// else use en_US as it contains Connman strings properized and some singular/plural strings
121+
else if (cmstTranslator.load("cmst_en_US", ":/translations/translations" ) ) {
122+
app.installTranslator(&cmstTranslator);
123+
}
124+
125+
126+
// Make sure all the command lines can be parsed
126127
parser.process(app);
127128
QStringList sl = parser.unknownOptionNames();
128129
if (sl.size() > 0 ) parser.showHelp(1);

text/changelog.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<b><center>Change Log</center></b>
33
<br><b>In Progress</b>
44
<ul>
5-
<li>Adding translations (Russian in progress).</li>
5+
<li>Adding translations (Russian Complete).</li>
66
</ul>
77
<br><b>2014.11.24</b>
88
<ul>

0 commit comments

Comments
 (0)