示例#1
0
DrawArea::DrawArea(StateMachine& _state_machine, sca::ca::input_ca* ca, QWidget *parent) :
	QWidget(parent),
	state_machine(_state_machine),
	pixel_factor(1),
	TIMER_INTERVAL(250),
	min_color(0,255,0),
	max_color(255,0,0),
	ca(ca),
	grid_layout(this)
{
	set_timeout_interval(TIMER_INTERVAL);

	connect(&next_fire_timer, SIGNAL(timeout()),
		this, SLOT(slot_timeout()));
	connect(&state_machine, SIGNAL(updated(StateMachine::STATE)),
		this, SLOT(state_updated(StateMachine::STATE)));

	ColorTable tmp_ct(min_color, max_color, 0, 7);
	int entry = 0;

	for(ColorTable::const_iterator itr(tmp_ct); itr.valid();
		++itr, ++entry)
	{
		itr->to_32bit((int*)(color_table + entry));
	}
	color_table[8] = 0; // sentinel - black

	pixmap_table.resize(9);
	for(int i = 0; i < 9; ++i)
	{
		pixmap_table[i] = QPixmap(1, 1);
		pixmap_table[i].fill(color_table[i]);
	}

}
Abstract_GLWidget::Abstract_GLWidget(QWidget *parent)
    : QGLWidget( new Core3_2_context( getFormat() ), parent ),
      _loopMode(false)
{
    _pQTimer = new QTimer(this);

    connect( _pQTimer, SIGNAL(timeout()), this, SLOT(slot_timeout()) );
}
CProgressItem::CProgressItem(int row, QObject *parent) :
    CAbstractItem(Progress, row, parent)
{
    m_step = 1;
    m_bytesTotal = 0;
    m_bytesReceived = 0;

    m_timer = new QTimer(this);
    m_timer->start(150);
    connect(m_timer, SIGNAL(timeout()), this, SLOT(slot_timeout()));
}
QGenieTray_Communication_Verify::QGenieTray_Communication_Verify(QObject *parent) :
    QObject(parent),
    mLocalSock(NULL),
    mWaitTime(WAIT_TIME),
    mRetryCount(RETRY_COUNT),
    mCacheLen(CACHE_TABLE_LEN),
    mRetSession(-1)
{
    connect(&mTimer, SIGNAL(timeout()), this, SLOT(slot_timeout()));

  
    mTimer.start(WAIT_TIME);
}
示例#5
0
void DrawArea::state_updated(StateMachine::STATE new_state)
{
	switch(new_state)
		{
		case StateMachine::STATE_STEP:
			QTimer::singleShot(TIMER_INTERVAL,
				this, SLOT(slot_timeout()));
			break;
		case StateMachine::STATE_INSTABLE:
			next_fire_timer.stop();
			break;
		case StateMachine::STATE_SIMULATING:
			next_fire_timer.start();
			break;
		default: break;
		}
}
示例#6
0
WPInfoWidget::WPInfoWidget( QWidget *parent ) :
  QWidget(parent)
{
  setObjectName("WPInfoWidget");
  setWindowTitle( tr("Point Info") );
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);

  m_returnView = MainWindow::mapView;

  m_homeChanged = false;
  m_editedWpIsTarget = false;

  if( parent )
    {
      resize( parent->size() );
    }

  QFont bfont = font();
  bfont.setBold(true);

  QBoxLayout *topLayout = new QVBoxLayout(this);

  text = new QTextEdit(this);
  text->setReadOnly( true );

#ifdef QSCROLLER
  QScroller::grabGesture( text->viewport(), QScroller::LeftMouseButtonGesture );
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture( text->viewport(), QtScroller::LeftMouseButtonGesture );
#endif

  topLayout->addWidget(text, 10);

  buttonrow2 = new QHBoxLayout;
  topLayout->addLayout(buttonrow2);

  cmdAddWaypoint = new QPushButton(tr("Add Waypoint"), this);
  cmdAddWaypoint->setFont(bfont);
  buttonrow2->addWidget(cmdAddWaypoint);
  connect(cmdAddWaypoint, SIGNAL(clicked()), SLOT(slot_addAsWaypoint()));

  cmdHome = new QPushButton(tr("Home"), this);
  cmdHome->setFont(bfont);
  buttonrow2->addWidget(cmdHome);
  connect(cmdHome, SIGNAL(clicked()), SLOT(slot_setNewHome()));

  cmdArrival = new QPushButton(tr("Arrival"), this);
  cmdArrival->setFont(bfont);
  buttonrow2->addWidget(cmdArrival);
  connect(cmdArrival, SIGNAL(clicked()), SLOT(slot_arrival()));

  cmdEdit = new QPushButton(tr("Edit"), this);
  cmdEdit->setFont(bfont);
  buttonrow2->addWidget(cmdEdit);
  connect(cmdEdit, SIGNAL(clicked()), SLOT(slot_edit()));

  cmdDelete = new QPushButton(tr("Delete"), this);
  cmdDelete->setFont(bfont);
  buttonrow2->addWidget(cmdDelete);
  connect(cmdDelete, SIGNAL(clicked()), SLOT(slot_delete()));

  buttonrow1=new QHBoxLayout;
  topLayout->addLayout(buttonrow1);

  cmdClose = new QPushButton(tr("Close"), this);
  cmdClose->setFont(bfont);
  buttonrow1->addWidget(cmdClose);
  connect(cmdClose, SIGNAL(clicked()), SLOT(slot_SwitchBack()));

  // Activate keyboard shortcut cancel to close the window too
  scClose = new QShortcut( this );

#ifndef ANDROID
  scClose->setKey( Qt::Key_Escape );
  connect( scClose, SIGNAL(activated()), SLOT( slot_SwitchBack() ));
#endif

  cmdKeep = new QPushButton(tr("Stop"), this);
  cmdKeep->setFont(bfont);
  buttonrow1->addWidget(cmdKeep);
  connect(cmdKeep, SIGNAL(clicked()), SLOT(slot_KeepOpen()));

  cmdUnselectWaypoint = new QPushButton(tr("Unselect"), this);
  cmdUnselectWaypoint->setFont(bfont);
  buttonrow1->addWidget(cmdUnselectWaypoint);
  connect(cmdUnselectWaypoint, SIGNAL(clicked()), SLOT(slot_unselectWaypoint()));

  cmdSelectWaypoint = new QPushButton(tr("Select"), this);
  cmdSelectWaypoint->setFont(bfont);
  buttonrow1->addWidget(cmdSelectWaypoint);
  connect(cmdSelectWaypoint, SIGNAL(clicked()), SLOT(slot_selectWaypoint()));

  m_timer = new QTimer(this);
  connect(m_timer, SIGNAL(timeout()), SLOT(slot_timeout()));
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    _pt2Member(&Fractale::Julia)
{
    this->setMinimumSize(800, 600);

    // QAction*    pQAction_Quit = new QAction("&Quit", this);
    // connect( pQAction_Quit, SIGNAL(triggered()), qApp, SLOT(quit()) );

    // {
    //     QMenu*  pQMenu_File = menuBar()->addMenu("&File");
    //     pQMenu_File->addAction( pQAction_Quit );

    //     // QMenu*  pQMenu_View = menuBar()->addMenu("&View");
    //     // pQMenu_View->addAction( pQAction_SwitchViewMode );
    // }

    // {
    //     QToolBar*   pQToolBar = addToolBar("File");

    //     pQToolBar->addAction( pQAction_Quit );
    //     // pQToolBar->addAction( pQAction_SwitchViewMode );
    // }

    {
        _pImage = new QImage(D_FRACTALE_SIZE, D_FRACTALE_SIZE, QImage::Format_RGB32);

        QWidget*        pMainWidget = new QWidget(this);
        QGridLayout*    pMainLayout = new QGridLayout(pMainWidget);
        pMainWidget->setLayout(pMainLayout);

        //

        _pLabel_refresh = new QLabel();
        _pLabel_refresh->setPixmap( QPixmap::fromImage(*_pImage) );
        pMainLayout->addWidget( _pLabel_refresh, 0,0, 10,10 );

        //

        {
            // _pQPushButton_refresh = new QPushButton("refresh");
            // _pQPushButton_refresh->setShortcut(QKeySequence(Qt::Key_Tab));
            // pMainLayout->addWidget(_pQPushButton_refresh, 0,11);
            // connect(_pQPushButton_refresh, SIGNAL(clicked()), this, SLOT(pushed_refresh()));

            QGroupBox*        pWidget = new QGroupBox(tr("Settings"));
            pMainLayout->addWidget(pWidget, 0,11);
            QGridLayout*    pLayout = new QGridLayout();
            pWidget->setLayout(pLayout);

            QPushButton* pQPushButton_reset = new QPushButton("reset [Tab]");
            pQPushButton_reset->setShortcut(QKeySequence(Qt::Key_Tab));
            pLayout->addWidget( pQPushButton_reset, 0,0);
            connect(pQPushButton_reset, SIGNAL(clicked()), this, SLOT(pushed_reset()));

            QPushButton* pQPushButton_mdlbrot = new QPushButton("Mandelbrot");
            pLayout->addWidget( pQPushButton_mdlbrot, 0,1);
            connect(pQPushButton_mdlbrot, SIGNAL(clicked()), this, SLOT(pushed_mandelbrot()));

            QPushButton* pQPushButton_julia = new QPushButton("Julia");
            pLayout->addWidget( pQPushButton_julia, 0,2);
            connect(pQPushButton_julia, SIGNAL(clicked()), this, SLOT(pushed_julia()));
        }

        //

        {
            QGroupBox*        pWidget = new QGroupBox(tr("Movements"));
            pMainLayout->addWidget(pWidget, 1,11);
            QGridLayout*    pLayout = new QGridLayout();
            pWidget->setLayout(pLayout);

            QPushButton* pQPushButton_up = new QPushButton("up [W/Z]");
            pLayout->addWidget( pQPushButton_up, 0,1);
            connect(pQPushButton_up, SIGNAL(clicked()), this, SLOT(pushed_up()));

            QPushButton* pQPushButton_down = new QPushButton("down [S]");
            pLayout->addWidget( pQPushButton_down, 1,1);
            connect(pQPushButton_down, SIGNAL(clicked()), this, SLOT(pushed_down()));

            QPushButton* pQPushButton_left = new QPushButton("left [A/Q]");
            pLayout->addWidget( pQPushButton_left, 1,0);
            connect(pQPushButton_left, SIGNAL(clicked()), this, SLOT(pushed_left()));

            QPushButton* pQPushButton_right = new QPushButton("right [D]");
            pLayout->addWidget( pQPushButton_right, 1,2);
            connect(pQPushButton_right, SIGNAL(clicked()), this, SLOT(pushed_right()));
        }

        //

        {
            QGroupBox*        pWidget = new QGroupBox(tr("Zoom"));
            pMainLayout->addWidget(pWidget, 2,11);
            QGridLayout*    pLayout = new QGridLayout();
            pWidget->setLayout(pLayout);

            QPushButton* pQPushButton_up = new QPushButton("zoom in [+]");
            pLayout->addWidget( pQPushButton_up, 0,0);
            connect(pQPushButton_up, SIGNAL(clicked()), this, SLOT(pushed_zoom_in()));

            QPushButton* pQPushButton_down = new QPushButton("zoom out [-]");
            pLayout->addWidget( pQPushButton_down, 0,1);
            connect(pQPushButton_down, SIGNAL(clicked()), this, SLOT(pushed_zoom_out()));
        }

        //

        {
            QGroupBox*        pWidget = new QGroupBox(tr("Perturbation"));
            pMainLayout->addWidget(pWidget, 3,11);
            QGridLayout*    pLayout = new QGridLayout();
            pWidget->setLayout(pLayout);

            QPushButton* pQPushButton_up = new QPushButton("up");
            pLayout->addWidget( pQPushButton_up, 0,1);
            connect(pQPushButton_up, SIGNAL(clicked()), this, SLOT(pushed_perturbation_up()));

            QPushButton* pQPushButton_down = new QPushButton("down");
            pLayout->addWidget( pQPushButton_down, 1,1);
            connect(pQPushButton_down, SIGNAL(clicked()), this, SLOT(pushed_perturbation_down()));

            QPushButton* pQPushButton_left = new QPushButton("left");
            pLayout->addWidget( pQPushButton_left, 1,0);
            connect(pQPushButton_left, SIGNAL(clicked()), this, SLOT(pushed_perturbation_left()));

            QPushButton* pQPushButton_right = new QPushButton("right");
            pLayout->addWidget( pQPushButton_right, 1,2);
            connect(pQPushButton_right, SIGNAL(clicked()), this, SLOT(pushed_perturbation_right()));
        }

        //

        {
            QGroupBox*        pWidget = new QGroupBox(tr("Pixel resolution"));
            pMainLayout->addWidget(pWidget, 4,11);
            QGridLayout*    pLayout = new QGridLayout();
            pWidget->setLayout(pLayout);

            QPushButton* pQPushButton_up = new QPushButton("normal [7]");
            pQPushButton_up->setShortcut(QKeySequence(Qt::Key_7));
            pLayout->addWidget( pQPushButton_up, 0,0);
            connect(pQPushButton_up, SIGNAL(clicked()), this, SLOT(pushed_pixelRes_normal()));

            QPushButton* pQPushButton_down = new QPushButton("low [8]");
            pQPushButton_down->setShortcut(QKeySequence(Qt::Key_8));
            pLayout->addWidget( pQPushButton_down, 0,1);
            connect(pQPushButton_down, SIGNAL(clicked()), this, SLOT(pushed_pixelRes_low()));

            QPushButton* pQPushButton_left = new QPushButton("ugly [9]");
            pQPushButton_left->setShortcut(QKeySequence(Qt::Key_9));
            pLayout->addWidget( pQPushButton_left, 0,2);
            connect(pQPushButton_left, SIGNAL(clicked()), this, SLOT(pushed_pixelRes_ugly()));
        }

        //

        {
            QGroupBox*        pWidget = new QGroupBox(tr("Injection mode"));
            pMainLayout->addWidget(pWidget, 5,11);
            QGridLayout*    pLayout = new QGridLayout();
            pWidget->setLayout(pLayout);

            int btt_width = 50;

            QPushButton* pQPushButton_md0 = new QPushButton("[0]");
            pQPushButton_md0->setShortcut(QKeySequence(Qt::Key_0));
            pQPushButton_md0->setMaximumWidth(btt_width);
            pLayout->addWidget( pQPushButton_md0, 0,0);
            connect(pQPushButton_md0, SIGNAL(clicked()), this, SLOT(pushed_mode_0()));

            QPushButton* pQPushButton_md1 = new QPushButton("[1]");
            pQPushButton_md1->setShortcut(QKeySequence(Qt::Key_1));
            pQPushButton_md1->setMaximumWidth(btt_width);
            pLayout->addWidget( pQPushButton_md1, 0,1);
            connect(pQPushButton_md1, SIGNAL(clicked()), this, SLOT(pushed_mode_1()));

            QPushButton* pQPushButton_md2 = new QPushButton("[2]");
            pQPushButton_md2->setShortcut(QKeySequence(Qt::Key_2));
            pQPushButton_md2->setMaximumWidth(btt_width);
            pLayout->addWidget( pQPushButton_md2, 0,2);
            connect(pQPushButton_md2, SIGNAL(clicked()), this, SLOT(pushed_mode_2()));

            QPushButton* pQPushButton_md3 = new QPushButton("[3]");
            pQPushButton_md3->setShortcut(QKeySequence(Qt::Key_3));
            pQPushButton_md3->setMaximumWidth(btt_width);
            pLayout->addWidget( pQPushButton_md3, 0,3);
            connect(pQPushButton_md3, SIGNAL(clicked()), this, SLOT(pushed_mode_3()));

            QPushButton* pQPushButton_md4 = new QPushButton("[4]");
            pQPushButton_md4->setShortcut(QKeySequence(Qt::Key_4));
            pQPushButton_md4->setMaximumWidth(btt_width);
            pLayout->addWidget( pQPushButton_md4, 0,4);
            connect(pQPushButton_md4, SIGNAL(clicked()), this, SLOT(pushed_mode_4()));
        }

        //

        this->setCentralWidget( pMainWidget );
    }


    _pQTimer = new QTimer(this);
    connect( _pQTimer, SIGNAL(timeout()), this, SLOT(slot_timeout()) );


    pushed_refresh();
}