void ActionDialog::restoreHistory() { ConfigurationManager *cm = ConfigurationManager::instance(); int maxCount = cm->value("command_history_size").toInt(); ui->comboBoxCommands->setMaxCount(maxCount); QFile file( dataFilename() ); file.open(QIODevice::ReadOnly); QDataStream in(&file); QVariant v; ui->comboBoxCommands->clear(); ui->comboBoxCommands->addItem(QString()); while( !in.atEnd() ) { in >> v; if (v.canConvert(QVariant::String)) { // backwards compatibility with versions up to 1.8.2 QVariantMap values; values["cmd"] = v; ui->comboBoxCommands->addItem(commandToLabel(v.toString()), values); } else { QVariantMap values = v.value<QVariantMap>(); ui->comboBoxCommands->addItem(commandToLabel(values["cmd"].toString()), v); } } ui->comboBoxCommands->setCurrentIndex(0); }
void ActionDialog::loadSettings() { ConfigurationManager *cm = ConfigurationManager::instance(); restoreHistory(); ui->comboBoxInputFormat->clear(); ui->comboBoxInputFormat->addItems(standardFormats); ui->comboBoxInputFormat->setCurrentIndex(cm->value("action_has_input").toBool() ? 1 : 0); ui->comboBoxOutputFormat->clear(); ui->comboBoxOutputFormat->addItems(standardFormats); ui->comboBoxOutputFormat->setCurrentIndex(cm->value("action_has_output").toBool() ? 1 : 0); ui->separatorEdit->setText(cm->value("action_separator").toString()); ui->comboBoxOutputTab->setEditText(cm->value("action_output_tab").toString()); }
void ClipboardBrowserShared::loadFromConfiguration() { ConfigurationManager *cm = ConfigurationManager::instance(); editor = cm->value("editor").toString(); maxItems = cm->value("maxitems").toInt(); formats = ItemFactory::instance()->formatsToSave(); maxImageWidth = cm->value("max_image_width").toInt(); maxImageHeight = cm->value("max_image_height").toInt(); textWrap = cm->value("text_wrap").toBool(); commands = cm->commands(); viMode = cm->value("vi").toBool(); saveOnReturnKey = !cm->value("edit_ctrl_return").toBool(); moveItemOnReturnKey = cm->value("move").toBool(); }
void ClipboardBrowserShared::loadFromConfiguration() { ConfigurationManager *cm = ConfigurationManager::instance(); editor = cm->value("editor").toString(); maxItems = cm->value("maxitems").toInt(); textWrap = cm->value("text_wrap").toBool(); viMode = cm->value("vi").toBool(); saveOnReturnKey = !cm->value("edit_ctrl_return").toBool(); moveItemOnReturnKey = cm->value("move").toBool(); minutesToExpire = cm->value("expire_tab").toInt(); }
void ActionDialog::restoreHistory() { ConfigurationManager *cm = ConfigurationManager::instance(); int maxCount = cm->value("command_history_size").toInt(); ui->cmdEdit->setMaxCount(maxCount); QFile file( dataFilename() ); file.open(QIODevice::ReadOnly); QDataStream in(&file); QVariant v; ui->cmdEdit->clear(); while( !in.atEnd() ) { in >> v; ui->cmdEdit->addItem(v.toString()); } ui->cmdEdit->setCurrentIndex(0); ui->cmdEdit->lineEdit()->selectAll(); }