Changeset 10540


Ignore:
Timestamp:
05/03/11 18:26:51 (14 years ago)
Author:
tbretz
Message:
Send SetThreshold if a value is changed.
Location:
trunk/FACT++/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/gui/MainWindow.cc

    r10528 r10540  
    1010
    1111using namespace std;
     12
     13namespace Dim
     14{
     15static bool SendCommand(const char *command)
     16{
     17    return DimClient::sendCommand(command, NULL, 0);
     18}
     19
     20template<typename T>
     21static bool SendCommand(const char *command, const T &t)
     22{
     23    return DimClient::sendCommand(command, (void*)&t, sizeof(t));
     24}
     25}
    1226
    1327MainWindow::MainWindow(QWidget *p) : QMainWindow(p)
     
    6781}
    6882
     83
    6984void MainWindow::on_fShutdown_clicked()
    7085{
    71     DimClient::sendCommand("DIS_DNS/KILL_SERVERS", NULL, 0);
     86    Dim::SendCommand("DIS_DNS/KILL_SERVERS");
    7287}
    7388
     
    7590void MainWindow::on_fShutdownAll_clicked()
    7691{
    77     DimClient::sendCommand("DIS_DNS/KILL_SERVERS", NULL, 0);
    78     DimClient::sendCommand("DIS_DNS/EXIT",         1);
     92    Dim::SendCommand("DIS_DNS/KILL_SERVERS");
     93    Dim::SendCommand("DIS_DNS/EXIT", int(1));
    7994}
    8095
     
    106121}
    107122
     123void MainWindow::on_fThresholdVal_valueChanged(int v)
     124{
     125    fThresholdVolt->setValue(2500./4095*v);
     126
     127    const int32_t d[2] = { fThresholdIdx->value(), v };
     128    Dim::SendCommand("FTM_CONTROL/SET_THRESHOLD", d);
     129}
     130
    108131
    109132void MainWindow::on_fChatSend_clicked()
    110133{
    111     if (DimClient::sendCommand("CHAT/MSG", fChatMessage->displayText().toStdString().c_str()))
     134    if (Dim::SendCommand("CHAT/MSG", fChatMessage->displayText().constData()))
    112135        fChatMessage->clear();
    113136}
     
    138161{
    139162    if (checked)
    140         DimClient::sendCommand("FTM_CONTROL/PING", NULL, 0);
     163        Dim::SendCommand("FTM_CONTROL/PING");
    141164}
  • trunk/FACT++/gui/MainWindow.h

    r10528 r10540  
    7878
    7979    // Tab: Rates
    80     void on_fThresholdVal_valueChanged(int v) { fThresholdVolt->setValue(2500./4095*v); }
     80    void on_fThresholdVal_valueChanged(int v);
    8181    virtual void on_fThresholdIdx_valueChanged(int) { }
    8282
Note: See TracChangeset for help on using the changeset viewer.