示例#1
0
void MainWindow::showPreferences()
{
  Session *sess =  _Sessions.at(tabs->currentIndex());
  Profile *prof = new Profile(sess->profileKey());
  Preferences *pd = new Preferences(prof);
  pd->setModal(true);
#ifdef QTOPIA_PHONE
  if (Qtopia::mousePreferred)
     QtopiaApplication::instance()->hideInputMethod();
#endif
  pd->exec();
  if (pd->result()==QDialog::Accepted) {
    // apply the changes and update the current session settings
    Profile *p = pd->profile();
    TerminalDisplay *display = sess->views()[0];
    display->setVTFont(QFont(p->fontName(), p->fontSize()));
const ColorScheme* colorScheme = ColorSchemeManager::instance()->findColorScheme(p->colorScheme());
    ColorEntry table[TABLE_COLORS];
    colorScheme->getColorTable(table, display->randomSeed());
    display->setColorTable(table);
    display->setOpacity(colorScheme->opacity());
    display->setKeyboardCursorShape((TerminalDisplay::KeyboardCursorShape)p->cursorShape());
    sess->setKeyBindings(p->keyboard());
    sess->setHistoryType(HistoryTypeBuffer(p->historyLines()));
    sess->setProfileKey(p->name());
    p->saveProfile(p->name());    
  }
#ifdef QTOPIA_PHONE
  if (Qtopia::mousePreferred) 
     QtopiaApplication::instance()->showInputMethod();
#endif
  delete pd;
}
示例#2
0
void WindowImpl::showPreferences()
{
    Preferences prefs;
    if (prefs.exec() == QDialog::Accepted){
        prefs.save();
    }
}
示例#3
0
void MainWindow::on_actionPreferences_triggered()
{
    Preferences *preferences = new Preferences();

    preferences->exec();

    delete preferences;
}
示例#4
0
void FreeSSM::preferences()
{
	if (_dumping) return;
	Preferences *preferencesdlg = new Preferences(this, &_iface_type, &_iface_filename, _language);
	connect(preferencesdlg, SIGNAL( languageSelChanged(QString, QTranslator*) ),
					this, SLOT( retranslate(QString, QTranslator*) ));
#ifdef SMALL_RESOLUTION
	preferencesdlg->showFullScreen();
#else
	preferencesdlg->show();
#endif
	preferencesdlg->exec();
	delete preferencesdlg;
}
void MainWindow::on_actionPreferences_triggered()
{
    Preferences *Dialog = new Preferences;
    connect(Dialog, SIGNAL(finished(int)), Dialog, SLOT(deleteLater()));
    search_model.setQuery("SELECT id,row,type FROM sort_preferences", db);
    /*
    qDebug() << search_model.record(0).value(1).toInt();
    qDebug() << search_model.record(0).value(2).toInt();
    */

    Dialog->set_sortRow(settings->value("Sorting/row", 0).toInt());
    Dialog->set_sortType(settings->value("Sorting/type", 0).toInt());
    Dialog->set_autoUpdate(settings->value("AutoUpdate/enabled", true).toBool());
    Dialog->set_portableMode(settings->value("portableMode", false).toBool());
    Dialog->set_dataLoc(QStandardPaths::standardLocations(QStandardPaths::DataLocation).at(0));

    if(Dialog->exec())
    {
        qDebug() << "sortRow(): " << Dialog->get_sortRow();
        qDebug() << "sortType(): " << Dialog->get_sortType();
        qDebug() << "autoUpdate(): " << Dialog->get_autoUpdate();

        settings->setValue("Sorting/row", Dialog->get_sortRow());
        settings->setValue("Sorting/type", Dialog->get_sortType());
        settings->setValue("AutoUpdate/enabled", Dialog->get_autoUpdate());
        settings->sync();

        QSqlQuery query("insert or replace into sort_preferences (id, row, type) VALUES ('1', :row, :type)");
        query.bindValue(0, Dialog->get_sortRow());
        query.bindValue(1, Dialog->get_sortType());
        if(query.exec())
            updateTable();

        if(Dialog->get_portableMode())
        {
            QFile file("portable.dat");
            file.open(QIODevice::WriteOnly);
            file.write("");
            file.close();
        }
        else
        {
            QFile::remove("portable.dat");
        }
    }
}