コード例 #1
0
ファイル: logbrowser.cpp プロジェクト: Hosting-Scripts/mirall
LogBrowser::LogBrowser(QWidget *parent) :
    QDialog(parent),
    _logWidget( new LogWidget(parent) ),
    _logstream(0),
    _doFileFlush(false)
{
    setWindowTitle(tr("Log Output"));
    setMinimumWidth(600);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    // mainLayout->setMargin(0);

    mainLayout->addWidget( _logWidget );

    QHBoxLayout *toolLayout = new QHBoxLayout;
    mainLayout->addLayout( toolLayout );

    // Search input field
    QLabel *lab = new QLabel(tr("&Search: "));
    _findTermEdit = new QLineEdit;
    lab->setBuddy( _findTermEdit );
    toolLayout->addWidget(lab);
    toolLayout->addWidget( _findTermEdit );

    // find button
    QPushButton *findBtn = new QPushButton;
    findBtn->setText( tr("&Find") );
    connect( findBtn, SIGNAL(clicked()), this, SLOT(slotFind()));
    toolLayout->addWidget( findBtn );

    // stretch
    toolLayout->addStretch(1);
    _statusLabel = new QLabel;
    toolLayout->addWidget( _statusLabel );
    toolLayout->addStretch(5);

    QDialogButtonBox *btnbox = new QDialogButtonBox;
    QPushButton *closeBtn = btnbox->addButton( QDialogButtonBox::Close );
    connect(closeBtn,SIGNAL(clicked()),this,SLOT(close()));

    mainLayout->addWidget( btnbox );

    // clear button
    _clearBtn = new QPushButton;
    _clearBtn->setText( tr("Clear") );
    _clearBtn->setToolTip( tr("Clear the log display.") );
    btnbox->addButton(_clearBtn, QDialogButtonBox::ActionRole);
    connect( _clearBtn, SIGNAL(clicked()), this, SLOT(slotClearLog()));

    // save Button
    _saveBtn = new QPushButton;
    _saveBtn->setText( tr("S&ave") );
    _saveBtn->setToolTip(tr("Save the log file to a file on disk for debugging."));
    btnbox->addButton(_saveBtn, QDialogButtonBox::ActionRole);
    connect( _saveBtn, SIGNAL(clicked()),this, SLOT(slotSave()));

    setLayout( mainLayout );

    setModal(false);

    // needs to be a queued connection as logs from other threads come in
    connect(Logger::instance(), SIGNAL(newLog(QString)),this,SLOT(slotNewLog(QString)), Qt::QueuedConnection);
}
コード例 #2
0
ファイル: logbrowser.cpp プロジェクト: chetan19/client
LogBrowser::LogBrowser(QWidget *parent) :
    QDialog(parent),
    _logWidget( new LogWidget(parent) )
{
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    setObjectName("LogBrowser"); // for save/restoreGeometry()
    setWindowTitle(tr("Log Output"));
    setMinimumWidth(600);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    // mainLayout->setMargin(0);

    mainLayout->addWidget( _logWidget );

    QHBoxLayout *toolLayout = new QHBoxLayout;
    mainLayout->addLayout( toolLayout );

    // Search input field
    QLabel *lab = new QLabel(tr("&Search: "));
    _findTermEdit = new QLineEdit;
    lab->setBuddy( _findTermEdit );
    toolLayout->addWidget(lab);
    toolLayout->addWidget( _findTermEdit );

    // find button
    QPushButton *findBtn = new QPushButton;
    findBtn->setText( tr("&Find") );
    connect( findBtn, SIGNAL(clicked()), this, SLOT(slotFind()));
    toolLayout->addWidget( findBtn );

    // stretch
    toolLayout->addStretch(1);
    _statusLabel = new QLabel;
    toolLayout->addWidget( _statusLabel );
    toolLayout->addStretch(5);

    QDialogButtonBox *btnbox = new QDialogButtonBox;
    QPushButton *closeBtn = btnbox->addButton( QDialogButtonBox::Close );
    connect(closeBtn,SIGNAL(clicked()),this,SLOT(close()));

    mainLayout->addWidget( btnbox );

    // clear button
    _clearBtn = new QPushButton;
    _clearBtn->setText( tr("Clear") );
    _clearBtn->setToolTip( tr("Clear the log display.") );
    btnbox->addButton(_clearBtn, QDialogButtonBox::ActionRole);
    connect( _clearBtn, SIGNAL(clicked()), this, SLOT(slotClearLog()));

    // save Button
    _saveBtn = new QPushButton;
    _saveBtn->setText( tr("S&ave") );
    _saveBtn->setToolTip(tr("Save the log file to a file on disk for debugging."));
    btnbox->addButton(_saveBtn, QDialogButtonBox::ActionRole);
    connect( _saveBtn, SIGNAL(clicked()),this, SLOT(slotSave()));

    setLayout( mainLayout );

    setModal(false);

    // Direct connection for log comming from this thread, and queued for the one in a different thread
    connect(Logger::instance(), SIGNAL(newLog(QString)),this,SLOT(slotNewLog(QString)), Qt::AutoConnection);

    QAction *showLogWindow = new QAction(this);
    showLogWindow->setShortcut(QKeySequence("F12"));
    connect(showLogWindow, SIGNAL(triggered()), SLOT(close()));
    addAction(showLogWindow);

    ConfigFile cfg;
    cfg.restoreGeometry(this);
    int lines = cfg.maxLogLines();
    // qDebug() << "#        ##  Have " << lines << " Loglines!";
    _logWidget->document()->setMaximumBlockCount( lines );

}
コード例 #3
0
ファイル: main_wnd.cpp プロジェクト: z80/robocam
MainWnd::MainWnd( QWidget * parent )
: QMainWindow( parent )
{
    ui.setupUi( this );
    connect( this, SIGNAL(sigLog(const QString &)), this, SLOT(slotLog(const QString &)), Qt::QueuedConnection );
    connect( ui.console, SIGNAL(line_validate(const QString &)), this, SLOT(slotSend(const QString &)), Qt::QueuedConnection );

    QObject::connect( ui.clearLog,    SIGNAL(triggered()), this, SLOT(slotClearLog()) );
    QObject::connect( ui.dontSleep,   SIGNAL(triggered()), this, SLOT(slotDontSleep()) );

    QObject::connect( ui.showFullLog, SIGNAL(triggered()), this, SLOT(slotShowFullLog()) );
    QObject::connect( ui.queryStatus, SIGNAL(triggered()), this, SLOT(slotStatus()) );
    QObject::connect( ui.queryOsc,    SIGNAL(triggered()), this, SLOT(slotOsc()) );
    QObject::connect( ui.shutdown,    SIGNAL(triggered()), this, SLOT(slotShutdown()) );
    QObject::connect( ui.setupPipe,   SIGNAL(triggered()), this, SLOT(slotSetupPipe()) );

    QObject::connect( ui.lightBtn,    SIGNAL(clicked()),   this, SLOT(slotLight()) );
    QObject::connect( ui.motoEnBtn,   SIGNAL(clicked()),   this, SLOT(slotMotoEn()) );

    QObject::connect( ui.fwdBtn,      SIGNAL(pressed()),   this, SLOT(slotForward()) );
    QObject::connect( ui.bwdBtn,      SIGNAL(pressed()),   this, SLOT(slotBackward()) );
    QObject::connect( ui.leftBtn,     SIGNAL(pressed()),   this, SLOT(slotLeft()) );
    QObject::connect( ui.rightBtn,    SIGNAL(pressed()),   this, SLOT(slotRight()) );

    QObject::connect( ui.fwdBtn,      SIGNAL(released()),  this, SLOT(slotStop()) );
    QObject::connect( ui.bwdBtn,      SIGNAL(released()),  this, SLOT(slotStop()) );
    QObject::connect( ui.leftBtn,     SIGNAL(released()),  this, SLOT(slotStop()) );
    QObject::connect( ui.rightBtn,    SIGNAL(released()),  this, SLOT(slotStop()) );


    QObject::connect( ui.showFullLog, SIGNAL(triggered()), this, SLOT(slotShowFullLog()) );

    m_peer = new QXmppPeer( this );
    QObject::connect( m_peer, SIGNAL(connected()),      this, SLOT(slotConnected()) );
    QObject::connect( m_peer, SIGNAL(disconnected()),   this, SLOT(slotDisconnected()) );
    QObject::connect( m_peer, SIGNAL(textmsg(QString)), this, SLOT(qxmppMessageReceived(QString)) );

    m_video = new QXmppVideo( m_peer );
    // It also connects frameReady() signal to an appropriate slot.
    ui.view->setVideo( m_video );
    this->setCentralWidget( ui.view );

    QSettings ini( CONFIG_FILE, QSettings::IniFormat );
    ini.beginGroup( "main" );
    QString selfJid  = ini.value( "selfJid",    "client@xmpp" ).toString();
    QString destJid  = ini.value( "destJid",    "host@xmpp" ).toString();
    QString password = ini.value( "password",   "12345" ).toString();
    QString host     = ini.value( "host",       QString() ).toString();
    int     port     = ini.value( "port",       -1 ).toInt();
    bool    tls      = ini.value( "tls",        true ).toBool();
    bool updateDest  = ini.value( "updateDest", true ).toBool();

    m_peer->setTarget( destJid, updateDest );
    m_video->setTarget( destJid );
    m_peer->connect( selfJid, password, host, port, tls );
    m_jidDest = destJid;

    m_pipe = new QXmppMsgPipe( m_peer, 1 );
    m_pipe->setOutPipe( m_jidDest, 1234, 22, "localhost" );

    m_dontSleepTimer = new QTimer( this );
    m_dontSleepTimer->setInterval( 15000 );
    QObject::connect( m_dontSleepTimer, SIGNAL(timeout()), 
                      this,             SLOT(slotDontSleepTimeout()) );
}