Exemplo n.º 1
0
void MyApp::OnInput(const sInput2Event &ie)
{
  sU32 key = ie.Key;
  if(key & sKEYQ_SHIFT) key |= sKEYQ_SHIFT;
  if(key & sKEYQ_CTRL ) key |= sKEYQ_CTRL;
  switch(ie.Key)
  {
  case sKEY_ESCAPE:
  case sKEY_ESCAPE|sKEYQ_SHIFT:
    sExit();
    break;
  }
}
Exemplo n.º 2
0
void sDocumentBase::CmdExit2()
{
    sExit();
}
Exemplo n.º 3
0
void App::OnKey(const sKeyData &kd)
{
    sU32 mkey = kd.Key & sKEYQ_Mask;
    if(mkey==27)
        sExit();
}
Exemplo n.º 4
0
void App::OnKey(const sKeyData &kd)
{
  if((kd.Key&(sKEYQ_Mask|sKEYQ_Break))==27)
      sExit();
}
Exemplo n.º 5
0
void MyApp::OnInput(const sInput2Event &ie)
{
  if((ie.Key&sKEYQ_MASK)==sKEY_ESCAPE) sExit();
}
Exemplo n.º 6
0
void MyApp::OnInput(const sInput2Event &ie)
{
  if(ie.Key==sKEY_ESCAPE) sExit();
}
QtAsteriskDesktopMain::QtAsteriskDesktopMain(QWidget *parent) :
  QMainWindow(parent),
  ui(new Ui::QtAsteriskDesktopMain)
{
  _instance = this;
  
  _skipEvents.append("VarSet");
  _skipEvents.append("Newexten");
  
  _phoneFeatures = NULL;

  ui->setupUi(this);

  _chanMap = new QMap<QString, AstChannel*>();
  _parkedMap = new QMap<QString, AstParkedCall*>();
  _callMap = new QMap<QString, AdmCallWidget*>();

  _extensionMap = new QMap<QString, AdmExtensionWidget *>();

  _mySipPeerMap = new QMap<QString, AstSipPeer*>();
  _sipPeerMap = new QMap<QString, AstSipPeer*>();

  _showSipPeerActionId = new QMap<QString, AstSipPeer*>();
  _extensionStateActionId = new QMap<QString, AstSipPeer*>();
  _loginActionId = QString();

  _sipPeersActionId = QString();
  _statusIcon = new StatusIcon(this);
  ui->statusBar->addPermanentWidget(_statusIcon);

  /*Connect the Menu Actions*/
  connect(ui->_actionExit,  SIGNAL(triggered()),
          this,             SLOT(sExit()));
  connect(ui->_actionPreferences, SIGNAL(triggered()),
          this,                  SLOT(sPreferences()));
  connect(ui->_actionPhoneFeatures, SIGNAL(triggered()),
          this,                     SLOT(sPhoneFeatures()));


  _ami = new AsteriskManager(this);
  connect( _ami, SIGNAL(connected()),
           this, SLOT(asteriskConnected())
  );
  connect(_ami, SIGNAL(disconnected()),
          this, SLOT(asteriskDisconnected())
  );
  connect(_ami, SIGNAL(responseSent(AsteriskManager::Response,QVariantMap,QString)),
          this, SLOT(asteriskResponseSent(AsteriskManager::Response,QVariantMap,QString))
  );
  connect(_ami, SIGNAL(eventGenerated(AsteriskManager::Event,QVariantMap)),
          this, SLOT(asteriskEventGenerated(AsteriskManager::Event,QVariantMap))
  );
  QSettings settings;
  settings.beginGroup("AMI");
  if(settings.contains(AmiPref::getName(AmiPref::host)) && settings.contains(AmiPref::getName(AmiPref::port)))
  {
    bool valid = false;
    
    QString host = settings.value(AmiPref::getName(AmiPref::host)).toString();
    uint port = settings.value(AmiPref::getName(AmiPref::port)).toUInt(&valid);
    if(valid)
    {
      _ami->connectToHost(host, port);
      bool connected = _ami->waitForConnected(60000);
      qDebug() << "connected: " << connected;
      qDebug() << _ami->socketType();
      qDebug() << _ami->peerName();

      qDebug() << _ami->peerAddress().toIPv4Address();
      qDebug() << _ami->peerPort();
      if(!connected)
      {
        qDebug() << _ami->errorString();
        _ami->connectToHost(host, port);
        bool connected = _ami->waitForConnected(60000);
        qDebug() << "connected: " << connected;
        qDebug() << _ami->socketType();
        qDebug() << _ami->peerName();

        qDebug() << _ami->peerAddress().toIPv4Address();
        qDebug() << _ami->peerPort();
        if(!connected)
        {
          qDebug() << _ami->errorString();
        }
      }
    }
    else
      asteriskDisconnected();
  }
  else
    asteriskDisconnected();

  settings.endGroup();

  if(settings.contains("DEVICES/default"))
  {
    AstChanParts cp(settings.value("DEVICES/default").toString());
    if(cp.isValid())
    {
      ui->_extStatus->setExten(cp.getExten());
    }
  }
}