Exemple #1
0
CScreen * newCScreen(int x, int y, int small){
	CScreen* cscreen = malloc(sizeof(CScreen));
	
	char **maps[] = {WINDOWS_BIG, BSOD_BIG, LINUX_BIG, MAC_BIG, DEATH_BIG};
	if (small) {
		maps[0] = WINDOWS_SMALL;
		maps[1] = BSOD_SMALL;
		maps[2] = LINUX_SMALL;
		maps[3] = MAC_SMALL;
		maps[4] = DEATH_SMALL;
	}
	
	cscreen->sprite = newSprite(x, y, maps, sizeof(maps)/sizeof(char*));
	
	Note notes[] = {{Mi6, 275},{Mi6, 250},{Mi6, 225},{Mi6, 200},
					{Mi6, 175},{Mi6, 150},{Mi6, 125},{Mi6, 100},
					{Mi6, 75},{Mi6, 50},{Mi6, 25},
					{Mi6, 1000}};
	cscreen->crash = newSong(50, notes, sizeof(notes)/sizeof(Note));
	
	Note notes1[] = {{Mi3, 150}, {Fa3, 150}, {Sol3, 150}, {Re3, 150}, 
					 {Do6, 250}, {Do6, 250}};
	cscreen->reinstall = newSong(50, notes1, sizeof(notes1)/sizeof(Note));
	
	cscreen->state = WINDOWS;
	
	cscreen->nextCrashTime = -1;
	
	return cscreen;
}
SimpleUI::SimpleUI()
     : KMainWindow(0, "NoatunSimpleUI"), UserInterface()
{
    setAcceptDrops( true );
    setCaption( i18n("Noatun") );
    setIcon( SmallIcon( "noatun" ) );

    setupCentralWidget();
    setupActions();

    contextMenu = video->popupMenu( this );

    setupGUI( StatusBar|Create, "simpleui.rc" );

    connect( napp->player(), SIGNAL(playing()), SLOT(slotPlaying()) );
    connect( napp->player(), SIGNAL(stopped()), SLOT(slotStopped()) );
    connect( napp->player(), SIGNAL(paused()), SLOT(slotPaused()) );
    connect( napp->player(), SIGNAL(timeout()), SLOT(slotTimeout()) );
    connect( napp->player(), SIGNAL(newSong()), SLOT(slotChanged()) );
    connect( napp->player(), SIGNAL(volumeChanged(int)), SLOT(slotVolumeChanged(int)) );
    connect( napp, SIGNAL(hideYourself()), SLOT(hide()) );
    connect( napp, SIGNAL(showYourself()), SLOT(show()) );

    napp->player()->handleButtons();

    resize( minimumSize() );

    // Show UI and calculate video widget frame
    show();

    extra_width  = (width() - video->width());
    extra_height = (height() - video->height());

    // Load configuration
    KConfig &config = *KGlobal::config();
    config.setGroup( "Simple" );
    QString str = config.readEntry( "View", "NormalSize" );

    if (str == "HalfSize")
        video->setHalfSize();
    else if (str == "NormalSize")
        video->setNormalSize();
    else if (str == "DoubleSize")
        video->setDoubleSize();
    else
        applyMainWindowSettings( &config, "Simple" );

    // PlayObject could be running, update video widget
    slotChanged();

    video->give();
}
Exemple #3
0
void MainWindow::mkconnections()
{
    connect(bar,SIGNAL(closeClicked()),SLOT(close()));
    connect(bar,SIGNAL(maximizeClicked(bool)),SLOT(showWind(bool)));
    connect(bar,SIGNAL(hideClicked()),SLOT(showMinimized()));
    connect(playlists,SIGNAL(songAdded(QString,QString)),&library,SLOT(addSongInPlaylist(QString,QString)));
    connect(bar,SIGNAL(addFilePressed()),SLOT(addFiles()));
    connect(bar,SIGNAL(addFolderPressed()),SLOT(addFolder()));
    connect(&player,SIGNAL(inPlaylist(bool)),SLOT(changePlayerConnections(bool)));
    connect(&library,SIGNAL(newSong(Song)),table,SLOT(addSongInList(Song)));
    connect(&player,SIGNAL(positionChanged(qint64)),bar,SIGNAL(seekChanged(qint64)));
    connect(&player,SIGNAL(currentSongChanged(Song)),bar,SIGNAL(songChanged(Song)));
    connect(bar,SIGNAL(playClicked()),&player,SLOT(playpause()));
    connect(addFile,SIGNAL(triggered()),SLOT(addFiles()));
    connect(actionAddFolder,SIGNAL(triggered()),SLOT(addFolder()));
    connect(actionOuvrir,SIGNAL(triggered()),SLOT(openFile()));
    connect(bar,SIGNAL(volumeChanged(int)),&player,SLOT(setVolume(int)));
    connect(bar,SIGNAL(positionChanged(int)),&player,SLOT(setPosition(int)));
    connect(bar,SIGNAL(seekBarPressed()),&player,SLOT(pause()));
    connect(bar,SIGNAL(seekBarReleased()),&player,SLOT(play()));
    connect(&player,SIGNAL(playbackStateChanged(bool)),bar,SLOT(changeButton(bool)));
    connect(tree,SIGNAL(albumChosen(QString,QString)),table,SLOT(showSongsFrom(QString,QString)));
    connect(tree,SIGNAL(artistChosen(QString)),table,SLOT(showSongsBy(QString)));
    connect(&library,SIGNAL(libraryChanged(Library*)),tree,SLOT(updateTree(Library*)));
    connect(table,SIGNAL(newPlaylist(Song)),this,SLOT(mkPlaylist(Song)));
    connect(playlists,SIGNAL(playlistChosen(QString)),table,SLOT(showSongsIn(QString)));
    connect(table,SIGNAL(deleteSong(Song,bool)),&library,SLOT(deleteSong(Song,bool)));
    connect(bar,SIGNAL(newQuery(QString,int)),table,SLOT(setQuery(QString,int)));
    connect(bar,SIGNAL(newPlaybackMode(QMediaPlaylist::PlaybackMode)),&player,SLOT(setPlayBackMode(QMediaPlaylist::PlaybackMode)));
    connect(table,SIGNAL(songChosen(int)),&player,SLOT(play(int)));
    connect(table,SIGNAL(newSongList(SongList)),&player,SLOT(update(SongList)));
    connect(&player,SIGNAL(inPlaylist(bool)),bar,SLOT(enableNavigation(bool)));
    connect(bar,SIGNAL(miniLecteur()),&mLecteur,SLOT(show()));
    connect(bar,SIGNAL(miniLecteur()),SLOT(hide()));
    connect(&mLecteur,SIGNAL(windowedMode()),SLOT(show()));
    connect(&mLecteur,SIGNAL(positionChanged(int)),bar,SIGNAL(positionChanged(int)));
    connect(&mLecteur,SIGNAL(seekBarPressed()),bar,SIGNAL(seekBarPressed()));
    connect(&mLecteur,SIGNAL(seekBarReleased()),bar,SIGNAL(seekBarReleased()));
    connect(&mLecteur,SIGNAL(positionChanged(int)),bar,SIGNAL(positionChanged(int)));
    connect(&mLecteur,SIGNAL(playClicked()),bar,SIGNAL(playClicked()));
    connect(&mLecteur,SIGNAL(nextClicked()),bar,SIGNAL(nextClicked()));
    connect(&mLecteur,SIGNAL(previousClicked()),bar,SIGNAL(previousClicked()));
    connect(&mLecteur,SIGNAL(volumeChanged(int)),bar,SIGNAL(volumeChanged(int)));
    connect(&player,SIGNAL(currentSongChanged(Song)),&mLecteur,SLOT(setNewSong(Song)));
    connect(&player,SIGNAL(positionChanged(qint64)),&mLecteur,SLOT(setPosition(qint64)));
    connect(&player,SIGNAL(playbackStateChanged(bool)),&mLecteur,SLOT(changeButton(bool)));
    connect(&player,SIGNAL(indexChanged(int,int)),table,SLOT(setIconTo(int,int)));
    connect(table,SIGNAL(addFileTriggered()),SLOT(addFiles()));
    connect(table,SIGNAL(addFolderTriggered()),SLOT(addFolder()));

}
Exemple #4
0
void MainWindow::playCurTrack()
//POST: Starts playing the song as indicated by curTrack
{
    playlistWidget->setCurrentRow(curTrack);			//Update the current row of our playlist to show the current track

    if (myWave)											//if myWave is initialized,
        delete myWave;									//delete its contents

    myWave = new Wave(curSong);							//initialized myWave to the current song as indicated by curTrack

    slider->setRange(0, myWave->GetSongLength()*1000);	//For convenience, the slider range is set from zero to the song
    //length in milliseconds.

    setWindowTitle(("GLUI - " + QFileInfo(QString(playlist[curTrack].c_str()))	//Set the window title to the current song
                    .fileName().toStdString()).c_str());						//(stripped of directory structure)

    emit newSong(myWave);								//send the "new song to start playing" signal.
}
Exemple #5
0
int addToPlaylist(FILE * fp, char * url) {
	Song * song;

	DEBUG("add to playlist: %s\n",url);
	
	if((song = getSongFromDB(url))) {
	}
	else if(isValidRemoteUtf8Url(url) && 
                        (song = newSong(url, SONG_TYPE_URL, NULL))) 
        {
	}
	else {
		commandError(fp, ACK_ERROR_NO_EXIST,
                                "\"%s\" is not in the music db or is "
                                "not a valid url\n", url);
		return -1;
	}

	return addSongToPlaylist(fp,song);
}
Exemple #6
0
void MainWindow::gotoNextSong()
//POST: If repeat-one is on, starts playing the current song from the beginning.
//		Otherwise, starts playing the next song in the playlist, if there is one available.
//      If there is no next track but repeat-all is on, we loop forward to the first song.
{
    if (repeatOneAct->isChecked())						//if repeat-one is on,
        emit newSong(myWave);							//start the current song from the beginning
    else if (curTrack < numTracks-1 || repeatAllAct->isChecked()) //If there is a next song or we're to repeat all,
    {
        curTrack++;										//set the current track to the next song
        curTrack %= numTracks;							//if there is no next song, loop back to the first song.

        playCurTrack();
    }
    else												//otherwise,
    {
        glWindow->stopSong();							//stop everything.
        myPlayer->stop();
        curTrack = -1;
    }
}
Exemple #7
0
void MainWindow::gotoPrevSong()
//POST: If repeat-one is on, starts playing the current song from the beginning.
//		Otherwise, starts playing the previous song in the playlist, if there is one available.
//      If there is no previous track but repeat-all is on, we loop back to the last song.
{
    if (repeatOneAct->isChecked())						//if repeat-one is on,
        emit newSong(myWave);							//start the current song from the beginning
    else if (curTrack > 0 || repeatAllAct->isChecked()) //If there is a previous song or we're to repeat all,
    {
        curTrack--;										//set the current track to the previous song

        if (curTrack < 0)								//if there is no previous song,
            curTrack = numTracks-1;						//loop back to the end.

        playCurTrack();									//play the new current track
    }
    else												//otherwise,
    {
        glWindow->stopSong();							//stop everything.
        myPlayer->stop();
        curTrack = -1;
    }
}
Exemple #8
0
///
/// main function
/// @author csci243
///
/// @param argc  number of command line arguments, including program name
/// @param argv  supplied command line arguments, including program name
/// @returns errorCode  error Code; EXIT_SUCCESS if no error
///
int main( int argc, char **argv )
{
    mtime *atime = NULL ;

    song *song1 = NULL ;
    song *song2 = NULL ;
    song *song3 = NULL ;

    printf( "Creating a time...\n" ) ;
    atime = newMTime( 6, 30, "pm" ) ;

    printf( "Starting song tests...\n" ) ;

    song1 = newSong( "Summer Days", "Beach Boys" ) ;
    printf( "First song initialized...\n" ) ;

    char *artist = songGetArtist( song1 ) ;
    char *title = songGetTitle( song1 ) ;
    printf( "The current song1 song is: %s by %s.\n", title, artist ) ;
    free( artist ) ;
    free ( title ) ;

    char * sstr = songToString( song1 ) ;
    printf( "Otherwise... %s\n", sstr ) ;
	free(sstr);
    songPlay( song1, atime ) ;
    sstr = songToString( song1 ) ;
    printf( "After playing the song... %s\n", sstr ) ;
    free(sstr);
    mtime *glp = songGetLastPlayed( song1 ) ;
    char *sglp = mtimeToString(glp) ;
    artist = songGetArtist( song1 ) ;
    title = songGetTitle( song1 ) ;
    printf( "The same song referencing members is: %s by %s. Last played at: %s\n", 
             title, artist, sglp ) ;
    free( artist ) ;
    free( title ) ;
    mtimeDelete( glp ) ;
    free( sglp ) ;

    songDelete( song1 ) ;

    artist = malloc( sizeof( "Goo Goo Dolls" ) + 1 ) ;
    title = malloc( sizeof( "The Black Hole" ) + 1 ) ;
    strcpy( artist, "Goo Goo Dolls" ) ;
    strcpy( title, "The Black Hole" ) ;
    song2 = newSong( title, artist ) ;
    free( artist ) ;
    free( title ) ;
    sstr = songToString ( song2 ) ;
    printf( "The o song is: %s\n", sstr ) ;
    free(sstr);
    song1 = songCopy( song2 ) ;
    sstr = songToString( song1 ) ;
    free(song1);
    printf( "The copy of song2 song is: %s \n", sstr ) ;
    free(sstr);
    songDelete( song2 ) ;
    sstr = songToString( song1 ) ;
    printf( "After deleting the original, the song1 song is ... %s\n", sstr ) ;
free(sstr);

    char *pstr ;
    song3 = songCopy( song1 ) ;
    if ( songEquals( song1, song3 ) )
    {
        sstr = songToString( song1 ) ;
        pstr = songToString( song3 ) ;
        printf( "The song3 song %s\n    is the same as song1 song %s\n", pstr, sstr ) ;
        free( pstr ) ;
	free(sstr);
	songDelete(song3);
    }
    else
        printf( "ERROR: songCopy() failure!\n" ) ;

 
    song3 = newSong( "Its a Beatiful Morning", "Chicago" ) ;
    sstr = songToString( song3 ) ;
    printf( "The current song3 song is: %s\n", sstr ) ;
    free(sstr);
    songPlay( song3, newMTime(4, 42, "am") ) ;

    sstr = songToString( song3 ) ;
    printf( "The current song3 song is: %s\n", sstr ) ;
    free( sstr ) ;

    songDelete( song1 ) ;
    songDelete( song3 ) ;

    return EXIT_SUCCESS ;
}
Exemple #9
0
UEditorWindow::UEditorWindow(QWidget *parent)
    : QMainWindow(parent),
      ui(new Ui::EditWindowClass),
      _confirmCloseMessageBox(0),
      _redoAction(0),
      _undoAction(0),
      _spaceNoteGeneration(false)
{

    this->setFocusPolicy(Qt::StrongFocus);
_startTime=0;
    _playViolon = false;
    _currentFile = NULL;
    _isPlaying=false;
setAcceptDrops(true);
USetting::Instance.init();

#ifdef QT_MODULE_NETWORK
UCheckUpdate * check = new UCheckUpdate(QUrl(URL_VERSION));
connect(check,SIGNAL(connected()),this,SLOT(onConnected()));
#endif


    setupAudio();
    setupUi();

            _currentFile = new UFile(this);// "songs/arkol - vingt ans/Arkol - vingt ans.txt");

            fileConnect();

            this->showSentenceWidget->setHScroll(0);

        connect(ui->vScroll,SIGNAL(valueChanged(int)),this,SLOT(onUpdateVScrollAndScale(int)));
        connect(ui->vSlider,SIGNAL(valueChanged(int)),this,SLOT(onUpdateVScrollAndScale(int)));
        connect(ui->vScroll,SIGNAL(sliderPressed()),this,SLOT(onUpdateVScrollAndScale()));
        connect(ui->vSlider,SIGNAL(sliderPressed()),this,SLOT(onUpdateVScrollAndScale()));
        //connect(ui->vScroll,SIGNAL(actionTriggered(int)),this,SLOT(changeVScroll(int)));

        connect(_hScroll,SIGNAL(valueChanged(int)),this,SLOT(changeHScroll(int)));
        //connect(ui->hSlider,SIGNAL(valueChanged(int)),this,SLOT(changeHSlider(int)));
        connect(_hScroll,SIGNAL(sliderPressed()),this,SLOT(changeHScroll()));
        //connect(ui->hSlider,SIGNAL(sliderPressed()),this,SLOT(changeHSlider()));
        connect(_hScroll,SIGNAL(pageStepChanged(int)),this,SLOT(changeHSlider(int)));





        connect(ui->actionOpen,SIGNAL(triggered()),this,SLOT(openFile()));

        connect(ui->actionEditHeaders,SIGNAL(triggered()),this,SLOT(editHeader()));
        connect(ui->actionApplyOffset,SIGNAL(triggered()),this,SLOT(openTiming()));
        connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()));
        connect(playAction, SIGNAL(triggered()), this, SLOT(tooglePlay()));
        connect(pauseAction, SIGNAL(triggered()), this, SLOT(tooglePlay()));
        connect(recordAction, SIGNAL(triggered()), this, SLOT(toggleRecord()));
        connect(showSentenceWidget,SIGNAL(haveToStop()), this, SLOT(tooglePlay()));

        connect(this->ui->offsetSpinBox, SIGNAL(valueChanged(int)), showSentenceWidget, SLOT(setPreviousDisplayed(int)));
        this->ui->offsetSpinBox->setValue(2);
        connect(ui->actionSetNormalNote,SIGNAL(triggered()),showSentenceWidget, SLOT(setNormal()));
        connect(ui->actionSetFreeNote,SIGNAL(triggered()),showSentenceWidget, SLOT(setFree()));
        connect(ui->actionSetGoldNote,SIGNAL(triggered()),showSentenceWidget, SLOT(setGold()));

        connect(ui->actionMergeNotes,SIGNAL(triggered()),showSentenceWidget, SLOT(fusion()));
        connect(ui->actionSplitNote,SIGNAL(triggered()),showSentenceWidget, SLOT(split()));

        connect(ui->actionAddNote,SIGNAL(triggered()),showSentenceWidget, SLOT(nextClickAddNote()));
        connect(ui->actionAddSeparator,SIGNAL(triggered()),showSentenceWidget, SLOT(nextClickAddSeparator()));

        connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(save()));
        connect(ui->actionSaveAs,SIGNAL(triggered()),this,SLOT(saveAs()));
        connect(ui->actionNew,SIGNAL(triggered()),this,SLOT(newSong()));

        connect(ui->actionQuit,SIGNAL(triggered()),this,SLOT(close()));

        connect(&UInputManager::Instance,SIGNAL(spacePressEvent(void)),this,SLOT(tooglePlay()));

        connect(_wydget_timeline, SIGNAL(gapModified(double)),this, SLOT(gapModified(double)));

         connect(ui->actionDeleteNote,SIGNAL(triggered()),showSentenceWidget,SLOT(deleteNotes()));

        connect(ui->actionPreferences,SIGNAL(triggered()),&USetting::Instance,SLOT(showDialog()));

        connect(ui->actionMorphe,SIGNAL(triggered()),showSentenceWidget,SLOT(calquer()));


        connect(ui->actionLockTimings,SIGNAL(toggled(bool)),showSentenceWidget,SLOT(lockTime(bool)));

        connect(ui->actionCenter,SIGNAL(triggered()),this,SLOT(centerView()));

        connect(ui->actionHelp,SIGNAL(triggered()),this,SLOT(displayHelpScreen()));
        connect(ui->actionSendFeedback,SIGNAL(triggered()),this,SLOT(displayFeedback()));




        onUpdateVScrollAndScale();
        changeHScroll(0);


       // _currentFile = new UFile(this);
        this->showSentenceWidget->setLyrics(_currentFile->lyrics);
        _wydget_lyrics->setWidgetWords(showSentenceWidget);


        _undoAction = _currentFile->lyrics->history().createUndoAction(this->ui->menuEdit, tr("Annuler "));
        _undoAction->setShortcut(QKeySequence::Undo);
        _undoAction->setIcon(QIcon(":/images/undo.png"));
        this->ui->menuEdit->addAction(_undoAction);
        this->ui->toolBar->insertAction(this->ui->actionSetNormalNote, _undoAction);

        _redoAction = _currentFile->lyrics->history().createRedoAction(this->ui->menuEdit, tr("Refaire "));
        _redoAction->setShortcut(QKeySequence::Redo);
        _redoAction->setIcon(QIcon(":/images/redo.png"));
        this->ui->menuEdit->addAction(_redoAction);
        this->ui->toolBar->insertAction(this->ui->actionSetNormalNote, _redoAction);


        readLastFile();

        connect(ui->actionRecentFiles,SIGNAL(triggered()),this,SLOT(openLastFile()));



        readSettings();

        _spaceNote = new Recorder(this->showSentenceWidget);

        _autoSaveTimer = new QTimer(this);
          connect(_autoSaveTimer, SIGNAL(timeout()), this, SLOT(autoSave()));

          adaptNewFile();


}