Changeset 66 in projects


Ignore:
Timestamp:
Jan 15, 2013, 3:48:24 PM (7 years ago)
Author:
sven
Message:

Uralt-Veraenderungen, noch auf Festplatte gefunden

Location:
punch-card-project/trunk/punch-card-editor/src/driver/documation-m200-client
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • punch-card-project/trunk/punch-card-editor/src/driver/documation-m200-client/client.cc

    r59 r66  
    109109        //   !!!
    110110
    111         qDebug() << "Open port: " << port.open(QIODevice::ReadWrite | QIODevice::Text);
    112 
    113         qDebug() << "Open mode:" << port.openMode();
     111        if(port.open(QIODevice::ReadWrite | QIODevice::Text)) {
     112            qDebug() << "Successfully opened port with mode: " << port.openMode();
     113        } else {
     114            debug("Failed to open port! Exiting!");
     115            return;
     116        }
    114117
    115118        port.putChar( M200_CLIENT_BINARY );
     
    135138
    136139                if(abort) {
    137                         qDebug("Returning from thread main loop");
     140                        qDebug("Client Thread exiting");
    138141                        return;
    139142                }
  • punch-card-project/trunk/punch-card-editor/src/driver/documation-m200-client/client.h

    r59 r66  
    3939        Card processCard();
    4040
     41private:
     42        void debug(QString text) {
     43            emit recievedResponse("debug", text);
     44        }
     45
    4146signals:
    4247        void recievedResponse(QString code, QString comment);
  • punch-card-project/trunk/punch-card-editor/src/driver/documation-m200-client/controller.cc

    r59 r66  
    44#include <QHBoxLayout>
    55#include <QVBoxLayout>
     6#include <QGridLayout>
    67#include <QPushButton>
    78
     
    2728        // now going to fire up working thread
    2829        connect(worker, SIGNAL(recievedResponse(QString, QString)), this, SLOT(logResponse(QString,QString)), Qt::QueuedConnection);
     30        connect(worker, SIGNAL(finished()), this, SLOT(setButtonsDisabled()));
     31        connect(worker, SIGNAL(started()), this, SLOT(setButtonsEnabled()));
    2932
    3033        qDebug("Starting worker thread");
     
    3538QWidget* Controller::createButtonBar() {
    3639        QWidget* box = new QWidget(this);
    37         QHBoxLayout* layout = new QHBoxLayout(box);
     40        QGridLayout* layout = new QGridLayout(box);
    3841
    3942        start_button = new QPushButton(tr("Start"), box);
    4043        connect(start_button, SIGNAL(clicked()), worker, SLOT(fire_start()));
     44        start_button->setStatusTip(tr("Start the punch card reader cycle (read in cards)"));
     45        layout->addWidget(start_button, 0, 0);
    4146
    4247        stop_button = new QPushButton(tr("Stop"), box);
    4348        connect(stop_button, SIGNAL(clicked()), worker, SLOT(fire_stop()));
     49        stop_button->setStatusTip(tr("Immediately stop the punch card reader cycle"));
     50        layout->addWidget(stop_button, 0, 1);
    4451
    4552        ping_button = new QPushButton(tr("Ping"), box);
    4653        connect(ping_button, SIGNAL(clicked()), worker, SLOT(fire_ping()));
     54        ping_button->setStatusTip(tr("Ping the microcontroller (should output data in the message window if connected)"));
     55        ping_button->setAutoRepeat(true);
     56        layout->addWidget(ping_button, 1, 0);
    4757
    4858        reset_button = new QPushButton(tr("Reset"), box);
    4959        connect(reset_button, SIGNAL(clicked()), worker, SLOT(fire_reset()));
     60        reset_button->setStatusTip(tr("Completely reset the microcontroller. Only for bad errors, use with care"));
     61        layout->addWidget(reset_button, 1, 1);
    5062
    5163        QWidget* clear_log = new QPushButton(tr("Clear log"), box);
    5264        connect(clear_log, SIGNAL(clicked()), log, SLOT(clear()));
     65        clear_log->setStatusTip(tr("Clear the Log window (the white pane on the right)"));
     66        layout->addWidget(clear_log, 2, 0);
    5367
    5468        quit_button = new QPushButton(tr("Quit Client"), box);
    5569        quit_button->setToolTip("Suspend or restart Client Thread");
    56         connect(reset_button, SIGNAL(clicked()), this, SLOT(client_toggle_run()));
     70        connect(quit_button, SIGNAL(clicked()), this, SLOT(client_toggle_run()));
     71        quit_button->setStatusTip(tr("Disconnect from microcontroller and quit client"));
     72        layout->addWidget(quit_button, 2, 1);
    5773
    5874        box->setLayout(layout);
     
    6278void Controller::client_toggle_run() {
    6379        // when user clicks quit_button
    64         bool on = worker->isRunning();
     80        bool on = worker->isRunning();
     81        qDebug() << "Client toggle run, isRunning= " << on;
    6582
    6683        if(on) {
     
    7188        }
    7289
    73         start_button->setEnabled(on);
    74         stop_button->setEnabled(on);
    75         ping_button->setEnabled(on);
    76         reset_button->setEnabled(on);
    77         quit_button->setText(on ? tr("Quit Client") : tr("Restart Client"));
     90        // um Button-Status kuemmern sich signals/slots
     91}
     92
     93void Controller::setButtonsDisabled() {
     94    start_button->setEnabled(false);
     95    stop_button->setEnabled(false);
     96    ping_button->setEnabled(false);
     97    reset_button->setEnabled(false);
     98    quit_button->setText(tr("Restart Client"));
     99}
     100
     101void Controller::setButtonsEnabled() {
     102    start_button->setEnabled(true);
     103    stop_button->setEnabled(true);
     104    ping_button->setEnabled(true);
     105    reset_button->setEnabled(true);
     106    quit_button->setText(tr("Quit Client"));
    78107}
    79108
  • punch-card-project/trunk/punch-card-editor/src/driver/documation-m200-client/controller.h

    r59 r66  
    4141        void logResponse(QString code, QString comment);
    4242        void client_toggle_run();
     43        void setButtonsDisabled();
     44        void setButtonsEnabled();
    4345};
    4446
Note: See TracChangeset for help on using the changeset viewer.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License