Exemple #1
0
///////////////////////////////////////////////////////////
//                                                       //
// Tools Menu                                            //
//                                                       //
///////////////////////////////////////////////////////////
void WinImage::setupToolsMenu()
{
    // Actions
    QAction* bigO = new QAction( "Bi&gO", this );
    bigO->setShortcut( Qt::CTRL + Qt::Key_G );
    bigO->setStatusTip("Big O");
    connect( bigO, SIGNAL( triggered() ), this, SLOT( slotBigO()));

    QAction* zoom = new QAction( "&Zoom", this );
    zoom->setShortcut( Qt::CTRL + Qt::Key_Z );
    zoom->setStatusTip("Zoom with scale");
    connect( zoom, SIGNAL( triggered() ), this, SLOT( slotZoom()));

    QAction* differ = new QAction( "Di&ffer", this );
    differ->setShortcut( Qt::CTRL + Qt::Key_F );
    differ->setStatusTip("Compare generated image against expected");
    connect( differ, SIGNAL( triggered() ), this, SLOT( slotDiffer()));

    QAction* format = new QAction( "&Change format", this );
    format->setShortcut( Qt::CTRL + Qt::Key_C );
    format->setStatusTip("Change format: 1 to 15");
    connect( format, SIGNAL( triggered() ), this, SLOT( slotChangeFormat()));

    QAction* test1 = new QAction( "Test &1: black white ", this );
    test1->setShortcut( Qt::CTRL + Qt::Key_1 );
    test1->setStatusTip("Test case 1");
    connect(test1, SIGNAL( triggered()), this, SLOT( slotTest1()));

    QAction* test2 = new QAction( "Test &2: smooth", this );
    test2->setShortcut( Qt::CTRL + Qt::Key_2 );
    test2->setStatusTip("Test case 2");
    connect(test2, SIGNAL( triggered()), this, SLOT( slotTest2()));

    QAction* test3 = new QAction( "Test &3: detect edges", this );
    test3->setShortcut( Qt::CTRL + Qt::Key_3 );
    test3->setStatusTip("Test case 3");
    connect(test3, SIGNAL( triggered()), this, SLOT( slotTest3()));

    QAction* test4 = new QAction( "Test &4: non-maximum suppression", this );
    test4->setShortcut( Qt::CTRL + Qt::Key_4 );
    test4->setStatusTip("Test case 4");
    connect(test4, SIGNAL( triggered()), this, SLOT( slotTest4()));

    QAction* test5 = new QAction( "Test &5: double thresholding", this );
    test5->setShortcut( Qt::CTRL + Qt::Key_5 );
    test5->setStatusTip("Test case 5");
    connect(test5, SIGNAL( triggered()), this, SLOT( slotTest5()));

    QAction* test6 = new QAction( "Test &6: blob extract", this );
    test6->setShortcut( Qt::CTRL + Qt::Key_6 );
    test6->setStatusTip("Test case 6");
    connect(test6, SIGNAL( triggered()), this, SLOT( slotTest6()));

    QAction* test7 = new QAction( "Test &7: detect all lines", this );
    test7->setShortcut( Qt::CTRL + Qt::Key_7 );
    test7->setStatusTip("Test case 7");
    connect(test7, SIGNAL( triggered()), this, SLOT( slotTest7()));

    QAction* test8 = new QAction( "Test &8: rotate blackout", this );
    test8->setShortcut( Qt::CTRL + Qt::Key_8 );
    test8->setStatusTip("Test case 8");
    connect(test8, SIGNAL( triggered()), this, SLOT( slotTest8()));

    QAction* test9 = new QAction( "Test &9: blackout corners", this );
    test9->setShortcut( Qt::CTRL + Qt::Key_9 );
    test9->setStatusTip("Test case 9");
    connect(test9, SIGNAL( triggered()), this, SLOT( slotTest9()));

    QAction* test0 = new QAction( "Test &0: detect master lines", this );
    test0->setShortcut( Qt::CTRL + Qt::Key_0 );
    test0->setStatusTip("Test case 0");
    connect(test0, SIGNAL( triggered()), this, SLOT( slotTest0()));

    QMenu* tools = new QMenu( "&Tools", menuBar() );
    menuBar()->addMenu( tools);
    tools->addAction( bigO);
    tools->addAction( zoom);
    tools->addAction( differ);
    tools->addAction( format);
    tools->addAction( test1);
    tools->addAction( test2);
    tools->addAction( test3);
    tools->addAction( test4);
    tools->addAction( test5);
    tools->addAction( test6);
    tools->addAction( test7);
    tools->addAction( test8);
    tools->addAction( test9);
    tools->addAction( test0);
}
// private
void kpMainWindow::setupViewMenuActions ()
{
    m_viewMenuDocumentActionsEnabled = false;
    m_thumbnailSaveConfigTimer = 0;


    KActionCollection *ac = actionCollection ();

    /*m_actionFullScreen = KStdAction::fullScreen (0, 0, ac);
    m_actionFullScreen->setEnabled (false);*/


    m_actionActualSize = KStdAction::actualSize (this, SLOT (slotActualSize ()), ac);
    /*m_actionFitToPage = KStdAction::fitToPage (this, SLOT (slotFitToPage ()), ac);
    m_actionFitToWidth = KStdAction::fitToWidth (this, SLOT (slotFitToWidth ()), ac);
    m_actionFitToHeight = KStdAction::fitToHeight (this, SLOT (slotFitToHeight ()), ac);*/


    m_actionZoomIn = KStdAction::zoomIn (this, SLOT (slotZoomIn ()), ac);
    m_actionZoomOut = KStdAction::zoomOut (this, SLOT (slotZoomOut ()), ac);


    m_actionZoom = new KSelectAction (i18n ("&Zoom"), 0,
        this, SLOT (slotZoom ()), actionCollection (), "view_zoom_to");
    m_actionZoom->setEditable (true);

    // create the zoom list for the 1st call to zoomTo() below
    m_zoomList.append (10); m_zoomList.append (25); m_zoomList.append (33);
    m_zoomList.append (50); m_zoomList.append (67); m_zoomList.append (75);
    m_zoomList.append (100);
    m_zoomList.append (200); m_zoomList.append (300);
    m_zoomList.append (400); m_zoomList.append (600); m_zoomList.append (800);
    m_zoomList.append (1000); m_zoomList.append (1200); m_zoomList.append (1600);


    m_actionShowGrid = new KToggleAction (i18n ("Show &Grid"), CTRL + Key_G,
        this, SLOT (slotShowGridToggled ()), actionCollection (), "view_show_grid");
    m_actionShowGrid->setCheckedState (i18n ("Hide &Grid"));


    // TODO: This doesn't work when the thumbnail has focus.
    //       Testcase: Press CTRL+H twice on a fresh KolourPaint.
    //                 The second CTRL+H doesn't close the thumbnail.
    m_actionShowThumbnail = new KToggleAction (i18n ("Show T&humbnail"), CTRL + Key_H,
        this, SLOT (slotShowThumbnailToggled ()), actionCollection (), "view_show_thumbnail");
    m_actionShowThumbnail->setCheckedState (i18n ("Hide T&humbnail"));

    // Please do not use setCheckedState() here - it wouldn't make sense
    m_actionZoomedThumbnail = new KToggleAction (i18n ("Zoo&med Thumbnail Mode"), 0,
        this, SLOT (slotZoomedThumbnailToggled ()), actionCollection (), "view_zoomed_thumbnail");

    // For consistency with the above action, don't use setCheckedState()
    //
    // Also, don't use "Show Thumbnail Rectangle" because if entire doc
    // can be seen in scrollView, checking option won't "Show" anything
    // since rect _surrounds_ entire doc (hence, won't be rendered).
    d->m_actionShowThumbnailRectangle = new KToggleAction (
        i18n ("Enable Thumbnail &Rectangle"),
        0,
        this, SLOT (slotThumbnailShowRectangleToggled ()),
        actionCollection (), "view_show_thumbnail_rectangle");


    enableViewMenuDocumentActions (false);
}