示例#1
0
void Deinterlacer::push_down_one_line(Frame top_field, Frame bottom_field) {
        Frame top_field_pushed_down = top_field;
        top_field_pushed_down.image = push_down_one_line(top_field.image);

        Frame bottom_field_pushed_down = bottom_field;
        bottom_field_pushed_down.image = push_down_one_line(bottom_field.image);

        emit pushed_down(top_field, bottom_field, top_field_pushed_down, bottom_field_pushed_down);
}
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();
}