• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags

Frequently used words (click to add to your profile)

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

QSerialPortTerminalにKOZOS用XMODEM送信機能追加


Commit MetaInfo

Revisionff29a4733bdb1be644aab51fa6a955ad46ddbd12 (tree)
Zeit2012-05-19 00:07:23
Autorarakaki <alucky4416@user...>
Commiterarakaki

Log Message

ADD: Select OtherPort

Ändern Zusammenfassung

Diff

--- a/src/QSerialPortTerminal/ui/QSerialPortTerminal.cpp
+++ b/src/QSerialPortTerminal/ui/QSerialPortTerminal.cpp
@@ -28,15 +28,20 @@ QSerialPortTerminal::QSerialPortTerminal( QWidget* parent )
2828 comboBoxPortName->addItem("COM6", QVariant::fromValue(QString("COM6")));
2929 comboBoxPortName->addItem("COM7", QVariant::fromValue(QString("COM7")));
3030 comboBoxPortName->addItem("COM8", QVariant::fromValue(QString("COM8")));
31+ comboBoxPortName->addItem("Other", QVariant::fromValue(QString("Other")));
3132 comboBoxPortName->setCurrentIndex(0); //COM1
33+ lineEditOtherPort->setText("COM");
3234 #endif
3335
3436 #ifdef _TTY_POSIX_
3537 comboBoxPortName->addItem("ttyS0", QVariant::fromValue(QString("/dev/ttyS0")));
3638 comboBoxPortName->addItem("ttyS1", QVariant::fromValue(QString("/dev/ttyS1")));
3739 comboBoxPortName->addItem("ttyUSB0", QVariant::fromValue(QString("/dev/ttyUSB0")));
40+ comboBoxPortName->addItem("Other", QVariant::fromValue(QString("Other")));
3841 comboBoxPortName->setCurrentIndex(0); //ttyS0
42+ lineEditOtherPort->setText("/dev/");
3943 #endif
44+ lineEditOtherPort->setEnabled(false);
4045
4146 comboBoxBaudRate->addItem("110", QVariant::fromValue(BAUD110));
4247 comboBoxBaudRate->addItem("300", QVariant::fromValue(BAUD300));
@@ -78,6 +83,7 @@ QSerialPortTerminal::QSerialPortTerminal( QWidget* parent )
7883 connect(pushButtonSend, SIGNAL(clicked()), this, SLOT(slot_sendPort()));
7984 connect(pushButtonSendFile, SIGNAL(clicked()), this, SLOT(slot_sendPortToFile()));
8085 connect(pushButtonClear, SIGNAL(clicked()), this, SLOT(slot_clear()));
86+ connect(comboBoxPortName, SIGNAL(currentIndexChanged(int)), this, SLOT(slot_chgPort(int)));
8187
8288 /*Codecs list*/
8389 QMap<QString, QTextCodec *> codecMap;
@@ -144,6 +150,20 @@ void QSerialPortTerminal::updatetextEditReceive()
144150
145151 void QSerialPortTerminal::slot_openPort()
146152 {
153+ //Settings parameters
154+ QVariant temp;
155+
156+ if (comboBoxPortName->currentIndex()+1 == comboBoxPortName->count()) { // select Other?
157+ if (lineEditOtherPort->text().isEmpty()) {
158+ QMessageBox::warning(this, tr("QSerialPortTerminal"), tr("Other Port name is empty."));
159+ return;
160+ }
161+ serialPort->setPort(lineEditOtherPort->text()); //Port
162+ } else {
163+ temp = comboBoxPortName->itemData(comboBoxPortName->currentIndex());
164+ serialPort->setPort(temp.value<QString>()); //Port
165+ }
166+
147167 groupBoxSettings->setEnabled(false);
148168 pushButtonOpen->setEnabled(false);
149169 pushButtonClose->setEnabled(true);
@@ -153,12 +173,6 @@ void QSerialPortTerminal::slot_openPort()
153173 if (serialPort->isOpen())
154174 serialPort->close();
155175
156- //Settings parameters
157- QVariant temp;
158-
159- temp = comboBoxPortName->itemData(comboBoxPortName->currentIndex());
160- serialPort->setPort(temp.value<QString>()); //Port
161-
162176 temp = comboBoxBaudRate->itemData(comboBoxBaudRate->currentIndex());
163177 serialPort->setBaudRate(temp.value<BaudRateType>()); //BaudRate
164178
@@ -237,6 +251,14 @@ void QSerialPortTerminal::slot_clear()
237251 {
238252 textEditReceive->clear();
239253 }
254+void QSerialPortTerminal::slot_chgPort(int index)
255+{
256+ if (index+1 == comboBoxPortName->count()) { // Other?
257+ lineEditOtherPort->setEnabled(true);
258+ } else {
259+ lineEditOtherPort->setEnabled(false);
260+ }
261+}
240262
241263 void QSerialPortTerminal::slot_sendPortToFile()
242264 {
--- a/src/QSerialPortTerminal/ui/QSerialPortTerminal.h
+++ b/src/QSerialPortTerminal/ui/QSerialPortTerminal.h
@@ -31,6 +31,7 @@ private slots:
3131 void slot_closePort();
3232 void slot_sendPort();
3333 void slot_clear();
34+ void slot_chgPort(int);
3435 void slot_sendPortToFile();
3536 void slot_stopSendPortToFile();
3637
--- a/src/QSerialPortTerminal/ui/QSerialPortTerminal.ui
+++ b/src/QSerialPortTerminal/ui/QSerialPortTerminal.ui
@@ -6,8 +6,8 @@
66 <rect>
77 <x>0</x>
88 <y>0</y>
9- <width>613</width>
10- <height>352</height>
9+ <width>670</width>
10+ <height>407</height>
1111 </rect>
1212 </property>
1313 <property name="windowTitle">
@@ -39,7 +39,7 @@
3939 <item row="0" column="1">
4040 <widget class="QComboBox" name="comboBoxPortName"/>
4141 </item>
42- <item row="1" column="0">
42+ <item row="2" column="0">
4343 <widget class="QLabel" name="labelBaudRate">
4444 <property name="sizePolicy">
4545 <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
@@ -52,10 +52,10 @@
5252 </property>
5353 </widget>
5454 </item>
55- <item row="1" column="1">
55+ <item row="2" column="1">
5656 <widget class="QComboBox" name="comboBoxBaudRate"/>
5757 </item>
58- <item row="2" column="0">
58+ <item row="3" column="0">
5959 <widget class="QLabel" name="labelData">
6060 <property name="sizePolicy">
6161 <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
@@ -68,10 +68,10 @@
6868 </property>
6969 </widget>
7070 </item>
71- <item row="2" column="1">
71+ <item row="3" column="1">
7272 <widget class="QComboBox" name="comboBoxDataBits"/>
7373 </item>
74- <item row="3" column="0">
74+ <item row="4" column="0">
7575 <widget class="QLabel" name="labelParity">
7676 <property name="sizePolicy">
7777 <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
@@ -84,10 +84,10 @@
8484 </property>
8585 </widget>
8686 </item>
87- <item row="3" column="1">
87+ <item row="4" column="1">
8888 <widget class="QComboBox" name="comboBoxParity"/>
8989 </item>
90- <item row="4" column="0">
90+ <item row="5" column="0">
9191 <widget class="QLabel" name="labelStop">
9292 <property name="sizePolicy">
9393 <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
@@ -100,10 +100,10 @@
100100 </property>
101101 </widget>
102102 </item>
103- <item row="4" column="1">
103+ <item row="5" column="1">
104104 <widget class="QComboBox" name="comboBoxStopBits"/>
105105 </item>
106- <item row="5" column="0">
106+ <item row="6" column="0">
107107 <widget class="QLabel" name="labelFlowControl">
108108 <property name="sizePolicy">
109109 <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
@@ -116,9 +116,38 @@
116116 </property>
117117 </widget>
118118 </item>
119- <item row="5" column="1">
119+ <item row="6" column="1">
120120 <widget class="QComboBox" name="comboBoxFlowControl"/>
121121 </item>
122+ <item row="1" column="0">
123+ <widget class="QLabel" name="labelOtherPort">
124+ <property name="sizePolicy">
125+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
126+ <horstretch>0</horstretch>
127+ <verstretch>0</verstretch>
128+ </sizepolicy>
129+ </property>
130+ <property name="text">
131+ <string> Other : </string>
132+ </property>
133+ </widget>
134+ </item>
135+ <item row="1" column="1">
136+ <widget class="QLineEdit" name="lineEditOtherPort">
137+ <property name="enabled">
138+ <bool>false</bool>
139+ </property>
140+ <property name="sizePolicy">
141+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
142+ <horstretch>0</horstretch>
143+ <verstretch>0</verstretch>
144+ </sizepolicy>
145+ </property>
146+ <property name="text">
147+ <string>/dev/</string>
148+ </property>
149+ </widget>
150+ </item>
122151 </layout>
123152 </widget>
124153 </item>
@@ -225,6 +254,11 @@
225254 </item>
226255 <item>
227256 <widget class="QTextEdit" name="textEditReceive">
257+ <property name="font">
258+ <font>
259+ <pointsize>10</pointsize>
260+ </font>
261+ </property>
228262 <property name="readOnly">
229263 <bool>true</bool>
230264 </property>