Example #1
0
bool MainWindow::on_save_select(){
    bool ret = false;
    QString file_name;

    file_name = QFileDialog::getSaveFileName(
        this,
        tr( "Select File" ),
        QProcess( this ).workingDirectory(),
        tr( "Voice Texturing Data (*.vtd);;All Files (*.*)" ) );

    if( !file_name.isEmpty() ){
        ret = this->write_vtd_file( file_name );
    }

    return ret;
}
Example #2
0
bool MainWindow::on_add_select(){
    bool ret = false;
    QString file_name;

    file_name =QFileDialog::getOpenFileName(
        this,
        tr( "Select File "),
        QProcess( this ).workingDirectory(),
        tr( "WORLD Spectrum (*.wsp);;All Files (*.*)" ) );

    if( !file_name.isEmpty() ){
        // 第3引数が NULL なら非周期性以降は読み込まない。
        this->spectra[this->num_spectra] = new double[SPECTRUM_LENGTH];
        if( ret = this->read_spectrum_file( file_name, this->spectra[this->num_spectra], NULL, NULL ) ){
            this->num_spectra++;
        }
    }

    this->update();
    return ret;
}
Example #3
0
bool MainWindow::on_import_select(){
    bool ret = false;
    QString file_name;

    file_name = QFileDialog::getOpenFileName(
            this,
            tr( "Select File" ),
            QProcess( this ).workingDirectory(),
            tr( "WORLD Spectrum (*.wsp);;All Files (*.*)" ) );

//#ifdef _DEBUG
    qDebug( "MainWindow::on_import_select; file_name=%s", file_name.toStdString().c_str() );
//#endif
    if( !file_name.isEmpty() ){
        double tmp;
        ret = this->read_spectrum_file( file_name, this->src_spectrum, this->src_aperiodicity, &tmp );
        this->src_f0 = tmp;
    }

    this->update();
    return ret;
}
Example #4
0
int main(int pArgC, char *pArgV[])
{
    // Initialise Qt's message pattern

    OpenCOR::initQtMessagePattern();

    // Initialise the plugins path

    OpenCOR::initPluginsPath(pArgV[0]);

    // Create our application

    QCoreApplication *cliApp = new QCoreApplication(pArgC, pArgV);

    // Some general initialisations

    OpenCOR::initApplication();

    // Try to run OpenCOR as a CLI application

    int res;

    if (!OpenCOR::cliApplication(&res)) {
        // OpenCOR isn't meant to be run as a CLI application, so start its GUI
        // version instead

        static const QString DotExe = ".exe";

        if (cliApp->applicationFilePath().right(DotExe.size()) == DotExe) {
            // This is a safeguard from accidentally running a non-renamed (to
            // '.com') CLI version of OpenCOR

            error("the CLI version of "+qAppName()+" has the wrong extension ('.exe' instead of '.com').");

            res = -1;
        } else {
            QString guiAppFilePath = cliApp->applicationDirPath()+QDir::separator()+qAppName()+DotExe;

            if (!QFile::exists(guiAppFilePath)) {
                // We can't find the GUI version of OpenCOR, so...

                error("the GUI version of "+qAppName()+" cannot be found.");

                res = -1;
            } else {
                // We found the GUI version of OpenCOR, so run it with our
                // arguments, minus the first one since it corresponds to the
                // full path to our executable, which we are not interested in

                QStringList appArguments = cliApp->arguments();

                appArguments.removeFirst();

                QProcess().startDetached(guiAppFilePath, appArguments, QProcess().workingDirectory());

                res = 0;
            }
        }
    }

    // Release some memory

    delete cliApp;

    // We are done, so...

    return res;
}