• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修訂da1a7433001ec9902ff09e7892e46d75b591fd03 (tree)
時間2013-02-06 15:40:23
作者alucky4416 <alucky4416@user...>
Commiteralucky4416

Log Message

change: change to UTF-8, MainWinodow Display Text, IniFormat.

Change Summary

差異

--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -1,6 +1,7 @@
11 #include "mainwindow.h"
22 #include "ui_mainwindow.h"
33
4+#include <QTextCodec>
45 #include <QDir>
56 #include <QSettings>
67
@@ -16,6 +17,9 @@ MainWindow::MainWindow(QWidget *parent) :
1617 {
1718 ui->setupUi(this);
1819
20+ // set Codec
21+ QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); // source codec is UTF-8
22+
1923 QCoreApplication::setApplicationName("QtUSBRH-Logger-win32");
2024 QCoreApplication::setApplicationVersion("0.1");
2125
@@ -73,6 +77,7 @@ MainWindow::~MainWindow()
7377 void MainWindow::LoadSaveSetting(QString filepath, bool store)
7478 {
7579 QSettings settings(filepath, QSettings::IniFormat);
80+ settings.setIniCodec("UTF-8");
7681 if (store) { // Store(Save)
7782 settings.setValue("SETTING/SAVEPATH", logpath);
7883 } else { // Load
@@ -95,25 +100,25 @@ void MainWindow::slotGetData(QDateTime timestamp, double tmpr, double humid)
95100 tmpr_min = tmpr;
96101 time_min = timestamp;
97102 }
98- ui->label_Max->setText(QString("Max: %1 'C at ").arg(tmpr_max) + time_max.toString("yyyy/MM/dd hh:mm:ss"));
99- ui->label_Min->setText(QString("Min: %1 'C at ").arg(tmpr_min) + time_min.toString("yyyy/MM/dd hh:mm:ss"));
103+ ui->label_Max->setText(QString(tr("Max: %1 'C at ")).arg(tmpr_max) + time_max.toString("yyyy/MM/dd hh:mm:ss"));
104+ ui->label_Min->setText(QString(tr("Min: %1 'C at ")).arg(tmpr_min) + time_min.toString("yyyy/MM/dd hh:mm:ss"));
100105
101106 if (logging) {
102107 int lapsed_time = (QDateTime::currentMSecsSinceEpoch() - logstart_time.toMSecsSinceEpoch()) / 1000;
103108 if (lapsed_time < 60) { // 1 minute
104- ui->label_LogLapsedTime->setText(QString("Lapsed Time: %1 sec").arg(lapsed_time));
109+ ui->label_LogLapsedTime->setText(QString(tr("Lapsed Time: %1 sec")).arg(lapsed_time));
105110 } else if (lapsed_time < 3600) { // 1 hour
106- ui->label_LogLapsedTime->setText(QString("Lapsed Time: %1 min").arg(lapsed_time/60));
111+ ui->label_LogLapsedTime->setText(QString(tr("Lapsed Time: %1 min")).arg(lapsed_time/60));
107112 } else if (lapsed_time < 86400) { // 1 day
108- ui->label_LogLapsedTime->setText(QString("Lapsed Time: %1 hour").arg(lapsed_time/3600));
113+ ui->label_LogLapsedTime->setText(QString(tr("Lapsed Time: %1 hour")).arg(lapsed_time/3600));
109114 } else { // over 1 day
110- ui->label_LogLapsedTime->setText(QString("Lapsed Time: %1 day").arg(lapsed_time/86400));
115+ ui->label_LogLapsedTime->setText(QString(tr("Lapsed Time: %1 day")).arg(lapsed_time/86400));
111116 }
112117 }
113118 }
114119 void MainWindow::slotChangeLogFilename(QString filename)
115120 {
116- ui->statusBar->showMessage(QString("logfile: %1").arg(filename));
121+ ui->statusBar->showMessage(QString(tr("logfile: %1")).arg(filename));
117122 }
118123
119124 void MainWindow::slotLogStarted()
@@ -124,9 +129,9 @@ void MainWindow::slotLogStarted()
124129 void MainWindow::slotLogEnded(int status)
125130 {
126131 logging = false;
127- ui->pushButton_LogStart->setText("Log Start");
132+ ui->pushButton_LogStart->setText(tr("Log Start"));
128133
129- ui->label_LogState->setText("LogEnded: " + QDateTime::currentDateTime().toString("yyyy/MM/dd hh:mm:ss"));
134+ ui->label_LogState->setText(tr("LogEnded: ") + QDateTime::currentDateTime().toString("yyyy/MM/dd hh:mm:ss"));
130135 }
131136
132137
@@ -143,8 +148,8 @@ void MainWindow::on_pushButton_LogStart_clicked()
143148 emit LogStop();
144149
145150 logging = false;
146- ui->pushButton_LogStart->setText("Log Start");
147- ui->label_LogState->setText("LogEnded: " + QDateTime::currentDateTime().toString("yyyy/MM/dd hh:mm:ss"));
151+ ui->pushButton_LogStart->setText(tr("Log Start"));
152+ ui->label_LogState->setText(tr("LogEnded: ") + QDateTime::currentDateTime().toString("yyyy/MM/dd hh:mm:ss"));
148153 ui->label_LogLapsedTime->setText("");
149154 } else {
150155 // now idle..
@@ -156,9 +161,9 @@ void MainWindow::on_pushButton_LogStart_clicked()
156161 qDebug() << "logpath is " << logpath;
157162
158163 logging = true;
159- ui->pushButton_LogStart->setText("Log Stop");
164+ ui->pushButton_LogStart->setText(tr("Log Stop"));
160165 logstart_time = QDateTime::currentDateTime();
161- ui->label_LogState->setText("LogStarted: " + logstart_time.toString("yyyy/MM/dd hh:mm:ss"));
166+ ui->label_LogState->setText(tr("LogStarted: ") + logstart_time.toString("yyyy/MM/dd hh:mm:ss"));
162167
163168 // reset Max/Min
164169 tmpr_max = -1000.0;