• R/O
  • SSH
  • HTTPS

qrobosdk: コミット


コミットメタ情報

リビジョン1979 (tree)
日時2012-04-06 01:26:14
作者satofumi

ログメッセージ

add sample directory

変更サマリ

差分

--- trunk/widgets/SerialConnectionWidget/SerialConnectionWidgetSample.cpp (revision 1978)
+++ trunk/widgets/SerialConnectionWidget/SerialConnectionWidgetSample.cpp (nonexistent)
@@ -1,95 +0,0 @@
1-/*!
2- \file
3- \brief SerialConnectionWidget の動作確認ウィジット
4-
5- \author Satofumi KAMIMURA
6-
7- $Id$
8-*/
9-
10-#include "SerialConnectionWidgetSample.h"
11-#include "SerialConnectionWidget.h"
12-#include <QShortcut>
13-#include <cstdio>
14-
15-using namespace qrk;
16-using namespace std;
17-
18-
19-struct SerialConnectionWidgetSample::pImpl
20-{
21- SerialConnectionWidgetSample* widget_;
22- SerialConnectionWidget connection_widget_;
23-
24- vector<string> devices_;
25- size_t last_index_;
26-
27-
28- pImpl(SerialConnectionWidgetSample* widget)
29- : widget_(widget), connection_widget_(widget), last_index_(0)
30- {
31- }
32-
33-
34- void initializeForm(void)
35- {
36- // ウィジット
37- widget_->connection_dummy_label_->hide();
38- widget_->main_layout_->addWidget(&connection_widget_);
39-
40- // コンポーネント
41- connect(&connection_widget_,
42- SIGNAL(connectRequest(bool, const std::string&)),
43- widget_, SLOT(connectPressed(bool, const std::string&)));
44- connect(&connection_widget_, SIGNAL(rescanRequest()),
45- widget_, SLOT(rescanPressed()));
46-
47- // Ctrl-q で終了させる
48- (void) new QShortcut(Qt::CTRL + Qt::Key_Q, widget_, SLOT(close()));
49- }
50-
51-
52- void addDevice(void)
53- {
54- char buffer[13];
55- snprintf(buffer, 13, "%d", last_index_++);
56-
57- devices_.push_back("device: " + string(buffer));
58- connection_widget_.setDevices(devices_);
59- }
60-};
61-
62-
63-SerialConnectionWidgetSample::SerialConnectionWidgetSample(QWidget* parent)
64- : QWidget(parent), pimpl(new pImpl(this))
65-{
66- setupUi(this);
67- pimpl->initializeForm();
68-}
69-
70-
71-SerialConnectionWidgetSample::~SerialConnectionWidgetSample(void)
72-{
73-}
74-
75-
76-void SerialConnectionWidgetSample::connectPressed(bool connection,
77- const string& device)
78-{
79- if (connection) {
80- fprintf(stderr, "connect request: %s\n", device.c_str());
81-
82- } else {
83- fprintf(stderr, "disconnect request\n");
84- }
85-
86- // 接続、切断、の要求を成功扱いにする
87- pimpl->connection_widget_.setConnected(connection);
88-}
89-
90-
91-void SerialConnectionWidgetSample::rescanPressed(void)
92-{
93- fprintf(stderr, "rescan pressed.\n");
94- pimpl->addDevice();
95-}
Deleted: svn:keywords
## -1 +0,0 ##
-Id Date Author Rev URL
\ No newline at end of property
--- trunk/widgets/SerialConnectionWidget/SerialConnectionWidgetSample.h (revision 1978)
+++ trunk/widgets/SerialConnectionWidget/SerialConnectionWidgetSample.h (nonexistent)
@@ -1,39 +0,0 @@
1-#ifndef QRK_SERIAL_CONNECTION_WIDGET_SAMPLE_H
2-#define QRK_SERIAL_CONNECTION_WIDGET_SAMPLE_H
3-
4-/*!
5- \file
6- \brief SerialConnectionWidget の動作確認ウィジット
7-
8- \author Satofumi KAMIMURA
9-
10- $Id$
11-*/
12-
13-#include "ui_SerialConnectionWidgetSampleForm.h"
14-#include <memory>
15-
16-
17-class SerialConnectionWidgetSample
18- : public QWidget, private Ui::SerialConnectionWidgetSampleForm
19-{
20- Q_OBJECT;
21-
22-public:
23- SerialConnectionWidgetSample(QWidget* parent = 0);
24- ~SerialConnectionWidgetSample(void);
25-
26-private slots:
27- void connectPressed(bool connection, const std::string& device);
28- void rescanPressed(void);
29-
30-private:
31- SerialConnectionWidgetSample(const SerialConnectionWidgetSample& rhs);
32- SerialConnectionWidgetSample& operator
33- = (const SerialConnectionWidgetSample& rhs);
34-
35- struct pImpl;
36- std::auto_ptr<pImpl> pimpl;
37-};
38-
39-#endif /* !QRK_SERIAL_CONNECTION_WIDGET_SAMPLE_H */
Deleted: svn:keywords
## -1 +0,0 ##
-Id Date Author Rev URL
\ No newline at end of property
--- trunk/widgets/SerialConnectionWidget/sample/SerialConnectionWidgetSample.cpp (nonexistent)
+++ trunk/widgets/SerialConnectionWidget/sample/SerialConnectionWidgetSample.cpp (revision 1979)
@@ -0,0 +1,95 @@
1+/*!
2+ \file
3+ \brief SerialConnectionWidget の動作確認ウィジット
4+
5+ \author Satofumi KAMIMURA
6+
7+ $Id$
8+*/
9+
10+#include "SerialConnectionWidgetSample.h"
11+#include "SerialConnectionWidget.h"
12+#include <QShortcut>
13+#include <cstdio>
14+
15+using namespace qrk;
16+using namespace std;
17+
18+
19+struct SerialConnectionWidgetSample::pImpl
20+{
21+ SerialConnectionWidgetSample* widget_;
22+ SerialConnectionWidget connection_widget_;
23+
24+ vector<string> devices_;
25+ size_t last_index_;
26+
27+
28+ pImpl(SerialConnectionWidgetSample* widget)
29+ : widget_(widget), connection_widget_(widget), last_index_(0)
30+ {
31+ }
32+
33+
34+ void initializeForm(void)
35+ {
36+ // ウィジット
37+ widget_->connection_dummy_label_->hide();
38+ widget_->main_layout_->addWidget(&connection_widget_);
39+
40+ // コンポーネント
41+ connect(&connection_widget_,
42+ SIGNAL(connectRequest(bool, const std::string&)),
43+ widget_, SLOT(connectPressed(bool, const std::string&)));
44+ connect(&connection_widget_, SIGNAL(rescanRequest()),
45+ widget_, SLOT(rescanPressed()));
46+
47+ // Ctrl-q で終了させる
48+ (void) new QShortcut(Qt::CTRL + Qt::Key_Q, widget_, SLOT(close()));
49+ }
50+
51+
52+ void addDevice(void)
53+ {
54+ char buffer[13];
55+ snprintf(buffer, 13, "%d", last_index_++);
56+
57+ devices_.push_back("device: " + string(buffer));
58+ connection_widget_.setDevices(devices_);
59+ }
60+};
61+
62+
63+SerialConnectionWidgetSample::SerialConnectionWidgetSample(QWidget* parent)
64+ : QWidget(parent), pimpl(new pImpl(this))
65+{
66+ setupUi(this);
67+ pimpl->initializeForm();
68+}
69+
70+
71+SerialConnectionWidgetSample::~SerialConnectionWidgetSample(void)
72+{
73+}
74+
75+
76+void SerialConnectionWidgetSample::connectPressed(bool connection,
77+ const string& device)
78+{
79+ if (connection) {
80+ fprintf(stderr, "connect request: %s\n", device.c_str());
81+
82+ } else {
83+ fprintf(stderr, "disconnect request\n");
84+ }
85+
86+ // 接続、切断、の要求を成功扱いにする
87+ pimpl->connection_widget_.setConnected(connection);
88+}
89+
90+
91+void SerialConnectionWidgetSample::rescanPressed(void)
92+{
93+ fprintf(stderr, "rescan pressed.\n");
94+ pimpl->addDevice();
95+}
Added: svn:keywords
## -0,0 +1 ##
+Id Date Author Rev URL
\ No newline at end of property
--- trunk/widgets/SerialConnectionWidget/sample/SerialConnectionWidgetSample.h (nonexistent)
+++ trunk/widgets/SerialConnectionWidget/sample/SerialConnectionWidgetSample.h (revision 1979)
@@ -0,0 +1,39 @@
1+#ifndef QRK_SERIAL_CONNECTION_WIDGET_SAMPLE_H
2+#define QRK_SERIAL_CONNECTION_WIDGET_SAMPLE_H
3+
4+/*!
5+ \file
6+ \brief SerialConnectionWidget の動作確認ウィジット
7+
8+ \author Satofumi KAMIMURA
9+
10+ $Id$
11+*/
12+
13+#include "ui_SerialConnectionWidgetSampleForm.h"
14+#include <memory>
15+
16+
17+class SerialConnectionWidgetSample
18+ : public QWidget, private Ui::SerialConnectionWidgetSampleForm
19+{
20+ Q_OBJECT;
21+
22+public:
23+ SerialConnectionWidgetSample(QWidget* parent = 0);
24+ ~SerialConnectionWidgetSample(void);
25+
26+private slots:
27+ void connectPressed(bool connection, const std::string& device);
28+ void rescanPressed(void);
29+
30+private:
31+ SerialConnectionWidgetSample(const SerialConnectionWidgetSample& rhs);
32+ SerialConnectionWidgetSample& operator
33+ = (const SerialConnectionWidgetSample& rhs);
34+
35+ struct pImpl;
36+ std::auto_ptr<pImpl> pimpl;
37+};
38+
39+#endif /* !QRK_SERIAL_CONNECTION_WIDGET_SAMPLE_H */
Added: svn:keywords
## -0,0 +1 ##
+Id Date Author Rev URL
\ No newline at end of property
旧リポジトリブラウザで表示