• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Revision0dc915c540f335c325e243fc39316fde9a76f6da (tree)
Time2013-01-29 19:14:21
Authoryoshihiro.arakaki <alucky4416@user...>
Commiteryoshihiro.arakaki

Log Message

Feature: LoadSave IniFile(LogFilePath).

Change Summary

Incremental Difference

--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -1,6 +1,9 @@
11 #include "mainwindow.h"
22 #include "ui_mainwindow.h"
33
4+#include <QDir>
5+#include <QSettings>
6+
47 #include <QMessageBox>
58 #include <QDebug>
69
@@ -13,6 +16,13 @@ MainWindow::MainWindow(QWidget *parent) :
1316 {
1417 ui->setupUi(this);
1518
19+ QCoreApplication::setApplicationName("QtUSBRH-Logger-win32");
20+ QCoreApplication::setApplicationVersion("0.1");
21+
22+ IniFilepath = QCoreApplication::applicationDirPath() + QDir::separator() + QCoreApplication::applicationName() + ".ini";
23+ // Load Setting
24+ LoadSaveSetting(IniFilepath, false);
25+
1626 ui->lcdTempr->display(0.0);
1727 ui->lcdHumid->display(0.0);
1828
@@ -43,6 +53,10 @@ MainWindow::MainWindow(QWidget *parent) :
4353
4454 MainWindow::~MainWindow()
4555 {
56+ // Save Setting
57+ LoadSaveSetting(IniFilepath, true);
58+
59+ // stop daqTh
4660 daqTh->stop();
4761 daqTh->wait();
4862 delete daqTh;
@@ -50,6 +64,17 @@ MainWindow::~MainWindow()
5064 delete ui;
5165 }
5266
67+void MainWindow::LoadSaveSetting(QString filepath, bool store)
68+{
69+ QSettings settings(filepath, QSettings::IniFormat);
70+ if (store) { // Store(Save)
71+ settings.setValue("SETTING/SAVEPATH", logpath);
72+ } else { // Load
73+ logpath = settings.value("SETTING/SAVEPATH", QString("")).toString();
74+ }
75+}
76+
77+
5378 void MainWindow::slotGetData(QDateTime timestamp, double tmpr, double humid)
5479 {
5580 // qDebug() << "timestamp=" << timestamp << ", Tempr=" << tmpr << ", humid=" << humid;
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -38,6 +38,9 @@ private slots:
3838 private:
3939 Ui::MainWindow *ui;
4040
41+ QString IniFilepath;
42+ void LoadSaveSetting(QString inifilepath, bool store);
43+
4144 bool logging; // Log Status, true is logging
4245 DAQThread *daqTh;
4346