Changeset 192e299 in thomson for elec/CrO2/software/gui.cpp


Ignore:
Timestamp:
Feb 3, 2012, 7:37:06 PM (12 years ago)
Author:
Adrien Destugues <pulkomandy@…>
Branches:
main
Children:
c2a9854
Parents:
f9263dd
Message:

Cleanup.

git-svn-id: svn://localhost/thomson@15 85ae3b6b-dc8f-4344-a89d-598714f2e4e5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • elec/CrO2/software/gui.cpp

    rf9263dd r192e299  
    1414
    1515        // Start status poller "thread"
    16         int pollStatus(Ihandle* ih)
    17         {
     16int pollStatus(Ihandle* ih)
     17{
     18        try {
    1819                Ihandle* motoron = (Ihandle*)IupGetAttribute(ih, "target");
    1920
     
    2324                else
    2425                        IupSetAttribute(motoron, "VALUE", "1"); // motor ON
    25                 return IUP_DEFAULT;
     26        } catch(const char*) {
     27                // Silently ignore exception if device is not available - not a good
     28                // idea to handle it from a timer...
     29                // Keep the timer running so it starts working when the device is
     30                // plugged
    2631        }
     32        return IUP_DEFAULT;
     33}
    2734
    2835void startPolling(Ihandle* target) {
     
    3744
    3845/* UI */
    39 
    40 int Gui::menu_exit()
    41 {
    42         return IUP_CLOSE;
    43 }
    4446
    4547Gui::Gui(int* argc, char*** argv)
     
    6668        );
    6769
    68 
    6970        // CONTROL
    7071        Ihandle* motoron = IupProgressBar();
     
    8182        IupSetAttribute(blocklist, "EXPAND", "VERTICAL");
    8283
     84        Ihandle* playToggle = IupToggle("play", NULL);
     85        Callback<Gui, int>::create(playToggle, "ACTION", this, &Gui::setPlaying);
     86
    8387        Ihandle* tabs = IupTabs(
    8488                IupVbox(
     
    8993                        ),
    9094                        IupHbox(
    91                                 IupToggle("play",NULL),
     95                                playToggle,
    9296                                IupToggle("REC",NULL),
    9397                                NULL
     
    136140}
    137141
     142
    138143int Gui::menu_open()
    139144{
     
    147152        return IUP_DEFAULT;
    148153}
     154
     155int Gui::menu_exit()
     156{
     157        return IUP_CLOSE;
     158}
     159
     160int Gui::setPlaying(int state)
     161{
     162        if (state == 0)
     163        {
     164                // pause
     165        } else {
     166                // play
     167                Device::getDevice().write(*file);
     168        }
     169
     170        return IUP_DEFAULT;
     171}
Note: See TracChangeset for help on using the changeset viewer.