Exemple #1
0
value ocaml_pause (value v)
{
    pauseSong(systemSong);
    return v;
}
Exemple #2
0
void MainWindow::createActions()
//POST: Actions are initialized and connected to the appropriate slots for handling
{
    //This is very repetitive. Format for creating an action:
    /*
    	actionPointer = new QAction("n&ame", parent);			//Initiliaze action of name
    															// "name" with alt-shortcut indicated
    															// by character following '&'
    	actionPointer->setShorcut(tr("keyboard shortcut"));		//Sets the action's shortcut
    															// ex. "Ctrl+Alt+K"
    	connect(actionPointer, SIGNAL(triggered),				//When the action is triggered (via menu
    		    someWidgetPointer, SLOT(someSlot()));			// click et al.), handle this via a slot
    */													        //method of someWidget
    //If the action just switches some property on or off (true or false), one can use
    //  actionPointer->setCheckable() to indicate this. To check if the property is on or off
    //  use actionPointer->isChecked()

    // File menu actions
    openAct = new QAction("&Open", this);
    openAct->setShortcut(tr("Ctrl+O"));
    connect(openAct, SIGNAL(triggered()), this, SLOT(open()));

    enqueueAct = new QAction("&Add to Playlist", this);
    enqueueAct->setShortcut(tr("Ctrl+A"));
    connect(enqueueAct, SIGNAL(triggered()), this, SLOT(addToPlaylist()));

    quitAct = new QAction("&Quit", this);
    quitAct->setShortcut(tr("Ctrl+Q"));
    connect(quitAct, SIGNAL(triggered()), this, SLOT(quit()));

    // Controls toolbar actions
    pauseAct = new QAction(style()->standardIcon(QStyle::SP_MediaPause), tr("P&ause"), this);
    connect(pauseAct, SIGNAL(triggered()), myPlayer, SLOT(pause()));
    connect(pauseAct, SIGNAL(triggered()), glWindow, SLOT(pauseSong()));

    playAct = new QAction(style()->standardIcon(QStyle::SP_MediaPlay), "P&lay", this);
    connect(playAct, SIGNAL(triggered()), this, SLOT(resumeTest()));

    prevAct = new QAction(style()->standardIcon(QStyle::SP_MediaSkipBackward), "&Prev", this);
    connect(prevAct, SIGNAL(triggered()), this, SLOT(gotoPrevSong()));

    nextAct = new QAction(style()->standardIcon(QStyle::SP_MediaSkipForward), "&Next", this);
    connect(nextAct, SIGNAL(triggered()), this, SLOT(gotoNextSong()));

    stopAct = new QAction(style()->standardIcon(QStyle::SP_MediaStop), "&Stop", this);
    connect(stopAct, SIGNAL(triggered()), myPlayer, SLOT(stop()));
    connect(stopAct, SIGNAL(triggered()), glWindow, SLOT(stopSong()));

    // Visualization menu actions
    redAct = new QAction("Increase &Red", this);
    redAct->setShortcut(tr("Ctrl+R"));
    connect(redAct, SIGNAL(triggered()), glWindow, SLOT(IncreaseRed()));

    greenAct = new QAction("Increase &Green", this);
    greenAct->setShortcut(tr("Ctrl+G"));
    connect(greenAct, SIGNAL(triggered()), glWindow, SLOT(IncreaseGreen()));

    blueAct = new QAction("Increase &Blue", this);
    blueAct->setShortcut(tr("Ctrl+B"));
    connect(blueAct, SIGNAL(triggered()), glWindow, SLOT(IncreaseBlue()));

    prevVisAct = new QAction("&Previous Visualization", this);
    prevVisAct->setShortcut(tr("Ctrl+Z"));
    connect(prevVisAct, SIGNAL(triggered()), glWindow, SLOT(LastVisualization()));

    nextVisAct = new QAction("&Next Visualization", this);
    nextVisAct->setShortcut(tr("Ctrl+X"));
    connect(nextVisAct, SIGNAL(triggered()), glWindow, SLOT(NextVisualization()));

    fullScreenAct = new QAction("&Fullscreen", this);
    fullScreenAct->setShortcut(tr("Ctrl+F"));
    fullScreenAct->setCheckable(true);
    connect(fullScreenAct, SIGNAL(triggered()), this, SLOT(fullScreen()));

    //Playlist actions
    repeatOneAct = new QAction("Repeat &One", this);
    repeatOneAct->setShortcut(tr("Ctrl+T"));
    repeatOneAct->setCheckable(true);

    repeatAllAct = new QAction("Repeat &All", this);
    repeatAllAct->setShortcut(tr("Ctrl+Alt+T"));
    repeatAllAct->setCheckable(true);

    // About action
    aboutAct = new QAction("&About", this);
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
}