Changeset - c6033ffac487
[Not reviewed]
default
0 2 0
Hasan Yavuz Ă–ZDERYA - 11 years ago 2015-03-08 08:12:49
hy@ozderya.net
inverted functionality of the Start button, pause makes more sense
2 files changed with 9 insertions and 6 deletions:
0 comments (0 inline, 0 general)
mainwindow.cpp
Show inline comments
 
@@ -147,49 +147,49 @@ void MainWindow::selectPort(QString port
 

	
 
void MainWindow::selectBaudRate(QString baudRate)
 
{
 
    if (serialPort.isOpen())
 
    {
 
        if (!serialPort.setBaudRate(baudRate.toInt()))
 
        {
 
            qDebug() << "Set baud rate failed during select: "
 
                     << serialPort.error();
 
        }
 
        else
 
        {
 
            qDebug() << "Baud rate changed: " << serialPort.baudRate();
 
        }
 
    }
 
}
 

	
 
void MainWindow::onPortToggled(bool open)
 
{
 
    ui->pbOpenPort->setChecked(open);
 
}
 

	
 
void MainWindow::onDataReady()
 
{
 
    if (ui->actionStart->isChecked())
 
    if (!ui->actionPause->isChecked())
 
    {
 
        QByteArray data = serialPort.readAll();
 
        addData((unsigned char)(data[0]));
 
    }
 
}
 

	
 
void MainWindow::onPortError(QSerialPort::SerialPortError error)
 
{
 
    switch(error)
 
    {
 
        case QSerialPort::NoError :
 
            break;
 
        case QSerialPort::ResourceError :
 
            qDebug() << "Port error: resource unavaliable; most likely device removed.";
 
            if (serialPort.isOpen())
 
            {
 
                qDebug() << "Closing port on resource error: " << serialPort.portName();
 
                togglePort();
 
            }
 
            loadPortList();
 
            break;
 
        default:
 
            qDebug() << "Unhandled port error: " << error;
 
            break;
mainwindow.ui
Show inline comments
 
@@ -386,88 +386,91 @@
 
             <enum>Qt::Vertical</enum>
 
            </property>
 
            <property name="sizeHint" stdset="0">
 
             <size>
 
              <width>20</width>
 
              <height>40</height>
 
             </size>
 
            </property>
 
           </spacer>
 
          </item>
 
         </layout>
 
        </item>
 
       </layout>
 
      </widget>
 
     </widget>
 
    </item>
 
   </layout>
 
  </widget>
 
  <widget class="QMenuBar" name="menuBar">
 
   <property name="geometry">
 
    <rect>
 
     <x>0</x>
 
     <y>0</y>
 
     <width>653</width>
 
     <height>23</height>
 
     <height>20</height>
 
    </rect>
 
   </property>
 
   <widget class="QMenu" name="menuFile">
 
    <property name="title">
 
     <string>File</string>
 
    </property>
 
    <addaction name="actionFileLoadProfile"/>
 
    <addaction name="actionFileSaveProfile"/>
 
   </widget>
 
   <widget class="QMenu" name="menuHelp">
 
    <property name="title">
 
     <string>Help</string>
 
    </property>
 
    <addaction name="actionHelpDataFormats"/>
 
    <addaction name="actionHelpAbout"/>
 
   </widget>
 
   <addaction name="menuFile"/>
 
   <addaction name="menuHelp"/>
 
  </widget>
 
  <widget class="QToolBar" name="mainToolBar">
 
   <attribute name="toolBarArea">
 
    <enum>TopToolBarArea</enum>
 
   </attribute>
 
   <attribute name="toolBarBreak">
 
    <bool>false</bool>
 
   </attribute>
 
   <addaction name="actionStart"/>
 
   <addaction name="actionPause"/>
 
   <addaction name="actionClear"/>
 
  </widget>
 
  <widget class="QStatusBar" name="statusBar"/>
 
  <action name="actionStart">
 
  <action name="actionPause">
 
   <property name="checkable">
 
    <bool>true</bool>
 
   </property>
 
   <property name="checked">
 
    <bool>true</bool>
 
    <bool>false</bool>
 
   </property>
 
   <property name="text">
 
    <string>Start</string>
 
    <string>Pause</string>
 
   </property>
 
   <property name="toolTip">
 
    <string>Pause Plotting</string>
 
   </property>
 
  </action>
 
  <action name="actionClear">
 
   <property name="text">
 
    <string>Clear</string>
 
   </property>
 
  </action>
 
  <action name="actionHelpDataFormats">
 
   <property name="text">
 
    <string>Data Formats</string>
 
   </property>
 
  </action>
 
  <action name="actionHelpAbout">
 
   <property name="text">
 
    <string>About</string>
 
   </property>
 
  </action>
 
  <action name="actionFileLoadProfile">
 
   <property name="text">
 
    <string>Load Profile</string>
 
   </property>
 
  </action>
 
  <action name="actionFileSaveProfile">
 
   <property name="text">
0 comments (0 inline, 0 general)