Пример #1
0
//================
//    PUBLIC SLOTS
//================
void page_fluxbox_settings::SaveSettings(){
  QStringList FB;
  if(ui->radio_simple->isChecked()){
    FB = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init");
    // - window placement
    int index = FB.indexOf( FB.filter("session.screen0.windowPlacement:").join("") );
    QString line = "session.screen0.windowPlacement:\t"+ui->combo_session_wloc->itemData( ui->combo_session_wloc->currentIndex() ).toString();
    if(index < 0){ FB << line; } //add line to the end of the file
    else{ FB[index] = line; } //replace the current setting with the new one
    // - window focus
    index = FB.indexOf( FB.filter("session.screen0.focusModel:").join("") );
    line = "session.screen0.focusModel:\t"+ui->combo_session_wfocus->itemData( ui->combo_session_wfocus->currentIndex() ).toString();
    if(index < 0){ FB << line; } //add line to the end of the file
    else{ FB[index] = line; } //replace the current setting with the new one
    // - window theme
    index = FB.indexOf( FB.filter("session.styleFile:").join("") );
    line = "session.styleFile:\t"+ui->combo_session_wtheme->itemData( ui->combo_session_wtheme->currentIndex() ).toString();
    if(index < 0){ FB << line; } //add line to the end of the file
    else{ FB[index] = line; } //replace the current setting with the new one
    // - workspace number
    index = FB.indexOf( FB.filter("session.screen0.workspaces:").join("") );
    line = "session.screen0.workspaces:\t"+QString::number(ui->spin_session_wkspaces->value());
    if(index < 0){ FB << line; } //add line to the end of the file
    else{ FB[index] = line; } //replace the current setting with the new one
  }else{
    //advanced editor
    FB = ui->text_file->toPlainText().split("\n");
  }
  //Save the fluxbox settings
  bool ok = overwriteFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init", FB);
  if(!ok){ qDebug() << "Warning: Could not save fluxbox-init"; }
  emit HasPendingChanges(false);
}
Пример #2
0
void PluginsDialog::on_pushButton_clicked( void )
{
    QString const strFileName = "installExtendedSaving.gmax";
    QString const strTempFilePath = QDir::temp().absolutePath() + '/' + strFileName;
    overwriteFile( strTempFilePath, ":/plugins/plugins/Extended Saving/" + strFileName );
    QDesktopServices::openUrl( QUrl::fromLocalFile( strTempFilePath ) );
    close();
}
Пример #3
0
void Storage::setFilename(const string &filename)
{
    this->filename = filename;
    ifstream i(filename.c_str());
    if (i.is_open())
        i.close();
    else
        overwriteFile();
}
Пример #4
0
void PluginsDialog::on_pushButton_3_clicked( void )
{
    QString strDir = QFileDialog::getExistingDirectory( this, tr( "Please specify your Blender installation directory" ), QDir::homePath() );
    if ( strDir == "" )
        return;
    QDir dirBlender( strDir );
    if ( !getBlenderAddonsDirectory( dirBlender ) )
    {
        Rimy3D::showError( tr( "Could not find Blender's addons directory at the specified location." ) );
        return;
    }
    QString strDirDest = dirBlender.absolutePath() + "/io_scene_3db/";
    QString strDirSource = ":/plugins/plugins/blender_3db/";
    if ( !( QDir( strDirDest ).exists() || QDir( strDirDest ).mkdir( "." ) ) ||
         !overwriteFile( strDirDest + "__init__.py", strDirSource + "__init__.py" ) ||
         !overwriteFile( strDirDest + "export_3db.py", strDirSource + "export_3db.py" ) ||
         !overwriteFile( strDirDest + "import_3db.py", strDirSource + "import_3db.py" ) )
    {
        Rimy3D::showError( tr( "Rimy3D has not write permissions to %1\nTry running Rimy3D with administrator rights." ).arg( dirBlender.absolutePath() ) );
        return;
    }
    Rimy3D::showMessage( tr( "The script files have been successfully copied to %1\nYou can now start Blender and enable the addon in 'File' > 'User Preferences'." ).arg( dirBlender.absolutePath() ) );
}
Пример #5
0
void PluginsDialog::on_pushButton_4_clicked( void )
{
    QString strDir = QFileDialog::getExistingDirectory( this, tr( "Please specify your 3ds Max installation directory" ), QDir::homePath() );
    if ( strDir == "" )
        return;
    QDir dirMax( strDir );
    if ( !dirMax.cd( "scripts" ) || !dirMax.cd( "startup" ) )
    {
        Rimy3D::showError( tr( "Could not find 3ds Max's scripts\\startup directory at the specified location." ) );
        return;
    }
    if ( !overwriteFile( dirMax.absolutePath() + "/3dbTools.ms", ":/plugins/plugins/max_3db/3dbTools.ms" ) )
    {
        Rimy3D::showError( tr( "Rimy3D has not write permissions to %1\nTry running Rimy3D with administrator rights." ).arg( dirMax.absolutePath() ) );
        return;
    }
    Rimy3D::showMessage( tr( "3db Tools have been successfully installed." ) );
}