Ejemplo n.º 1
0
void MainWindow::on_recordButton_clicked()
{
    if (!_inProgress)
    {
        _inProgress = true;
        ui->recordButton->setIcon(*iconRecord);
        ui->label->setText(tr("Recording %1 of %2 seconds...")
            .arg(1).arg(CAPTURE_TIME));
        repaint();

        recorder->record();
        ui->recordButton->setChecked(true);
        timer->start(CAPTURE_TIME*1000);
    }
    else
    {
        if (QMessageBox::question(this, tr("Confirmation"),
                                  tr("Do you really want to cancel recording?"),
                                  QMessageBox::Yes | QMessageBox::No)
                                  == QMessageBox::Yes)
        {
            timer->stop();
            recorder->stop();
            restoreInitialState();
        }

    }
}
Ejemplo n.º 2
0
void MainWindow::showResult(const EchoNestSong *song)
{
    ResultWindow * window = new ResultWindow(this, song);
    window->show();

    // Cleanup interface while user see result window
    restoreInitialState();
}
Ejemplo n.º 3
0
void MainWindow::showError(const QString &errorString)
{
#ifdef Q_WS_MAEMO_5
    QMaemo5InformationBox::information(this,
                                    QString("<br /><br />%1<br/><br />").arg(errorString),
                                    QMaemo5InformationBox::NoTimeout);
#else
    QMessageBox::critical(this,
                          "Error",
                          errorString,
                          QMessageBox::Ok);
#endif
    restoreInitialState();
}
Ejemplo n.º 4
0
Archivo: main.c Proyecto: dl3yc/gHermes
/* ----------------------------------------------------------------------------*/
int main(int argc,char* argv[]) {
    gboolean retry;
    GtkWidget* dialog;
    gint result;
    int i;

    gtk_init(&argc,&argv);

    fprintf(stderr,"gHermes Version %s\n",VERSION);

    strcpy(propertyPath,"gHermes.properties");
    // strcpy(soundCardName,"HPSDR");
    ozy_set_interface("eth0");
    processCommands(argc,argv);
    loadProperties(propertyPath);

#ifdef ALEX_TEST
    alex_rx_test_load("alex_rx_test.csv");
    alex_tx_test_load("alex_tx_test.csv");
#endif

    //init_cw();

    // initialize DttSP
    Setup_SDR();
    Release_Update();
    SetTRX(0,FALSE); // thread 0 is for receive
    SetTRX(1,TRUE);  // thread 1 is for transmit
    SetThreadProcessingMode(0,2); // set thread 0 to RUN
    SetThreadProcessingMode(1,2); // set thread 1 to RUN
    SetSubRXSt(0,0,TRUE);

    reset_for_buflen(0,buffer_size);
    reset_for_buflen(1,buffer_size);


    // initialize ozy (default 48K)
    //ozyRestoreState();
    do {
        switch(ozy_init()) {
            case -1: // cannot find ozy
                dialog = gtk_message_dialog_new (NULL,
                                                 GTK_DIALOG_DESTROY_WITH_PARENT,
                                                 GTK_MESSAGE_ERROR,
                                                 GTK_BUTTONS_YES_NO,
                                                 "Cannot locate Ozy!\n\nIs it powered on and plugged in?");
                gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"Retry?");
                gtk_window_set_title(GTK_WINDOW(dialog),"GHPSDR");
                result = gtk_dialog_run (GTK_DIALOG (dialog));
                switch (result) {
                    case GTK_RESPONSE_YES:
                        retry=TRUE;
                        break;
                    default:
                        exit(1);
                        break;
                }
                gtk_widget_destroy (dialog);
                break;
            case -2: // found but needs initializing
                result=fork();
                if(result==0) {
                    // child process - exec initozy
                    fprintf(stderr,"exec initozy\n");
                    result=execl("initozy",NULL,NULL);
                    fprintf(stderr,"exec returned %d\n",result);
                    exit(result);
                } else if(result>0) {
                    // wait for the forked process to terminate
                    dialog = gtk_message_dialog_new (NULL,
                                                 GTK_DIALOG_DESTROY_WITH_PARENT,
                                                 GTK_MESSAGE_INFO,
                                                 GTK_BUTTONS_NONE,
                                                 "Initializing Ozy");
                    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"Please Wait ...");
                    gtk_window_set_title(GTK_WINDOW(dialog),"GHPSDR");
                    gtk_widget_show_all (dialog);
                    while (gtk_events_pending ())
                        gtk_main_iteration ();

                    wait(&result);
                    fprintf(stderr,"wait status=%d\n",result);
                    retry=TRUE;
                }
                gtk_widget_destroy (dialog);
                break;

            case -3: // did not find metis
                dialog = gtk_message_dialog_new (NULL,
                                                 GTK_DIALOG_DESTROY_WITH_PARENT,
                                                 GTK_MESSAGE_ERROR,
                                                 GTK_BUTTONS_YES_NO,
                                                 "Cannot locate Metis on interface %s!",
                                                 ozy_get_interface());
                gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"Retry?");
                gtk_window_set_title(GTK_WINDOW(dialog),"GHPSDR");
                result = gtk_dialog_run (GTK_DIALOG (dialog));
                switch (result) {
                    case GTK_RESPONSE_YES:
                        retry=TRUE;
                        break;
                    default:
                        exit(1);
                        break;
                }
                gtk_widget_destroy (dialog);
                break;
            default:
                retry=FALSE;
                break;
        }
    } while(retry);

    mainRootX=0;
    mainRootY=0;

    cwPitch =600;

    restoreInitialState();

    //SetKeyerResetSize(4096);
    //NewKeyer(600.0f,TRUE,0.0f,3.0f,25.0f,48000.0f);
    //SetKeyerPerf(FALSE);
    //StartKeyer();

    initColors();
    //gtk_key_snooper_install((GtkKeySnoopFunc)keyboardSnooper,NULL);

    //bandscopeRestoreState();
    //bandscopeWindow=buildBandscopeUI();
   
    //bandscope_controlRestoreState();
    //bandscope_controlWindow=buildBandscope_controlUI();
   
    meterRestoreState();
    meterWindow=buildMeterUI();

    vfoRestoreState();
    vfoWindow=buildVfoUI();

    bandRestoreState();
    bandWindow=buildBandUI();

    modeRestoreState();
    modeWindow=buildModeUI();

    filterRestoreState();
    filterWindow=buildFilterUI();

    displayRestoreState();
    displayWindow=buildDisplayUI();

    audioRestoreState();
    audioWindow=buildAudioUI();


    agcRestoreState();
    agcWindow=buildAgcUI();

    preampWindow=buildPreampUI();
    zoomWindow=buildZoomUI();

    receiverRestoreState();
    receiverWindow=buildReceiverUI();

    volumeRestoreState();
    volumeWindow=buildVolumeUI();

    keyerRestoreState();
    keyerWindow=buildKeyerUI();
    cwPitch =(int)cw_sidetone_frequency;

    transmitRestoreState();
    transmitWindow=buildTransmitUI();
    mic_meterWindow=buildMic_MeterUI();

    subrxRestoreState();
    subrxWindow=buildSubRxUI();

    restoreState();


    // build the Main UI
    buildMainUI();

    //setSoundcard(getSoundcardId(soundCardName));

    audio_stream_init();
    
    hamlibserv_init();

    gtk_main();

    return 0;
}