void PrinterSettings::resetToDefault() { currentProfile()->setTopMargin( currentPrinter()->cupsProfile()->topMargin(mUnit), mUnit); currentProfile()->setBottomMargin( currentPrinter()->cupsProfile()->bottomMargin(mUnit), mUnit); currentProfile()->setLeftMargin( currentPrinter()->cupsProfile()->leftMargin(mUnit), mUnit); currentProfile()->setRightMargin( currentPrinter()->cupsProfile()->rightMargin(mUnit), mUnit); currentProfile()->setInternalMargin(currentPrinter()->cupsProfile()->internalMargin(mUnit), mUnit); updateWidgets(); }
void System::saveCurrentProfile(std::vector<QString> interfaces, QString defaultPolicyIN, QString defaultPolicyOUT) { //Writing the changes to the profile file QString pathString; QTextStream pathStream(&pathString); pathStream << this->systemPath << "/profiles/" << this->currentProfile->getName() << ".txt"; QFile currentProfile(pathString); currentProfile.open(QIODevice::WriteOnly | QIODevice::Text); QTextStream out1(¤tProfile); out1 << this->currentProfile->getName() << "\n"; out1 << defaultPolicyIN << "\n"; out1 << defaultPolicyOUT << "\n"; out1 << this->currentProfile->getCreationDate() << "\n"; out1 << this->currentProfile->getSystemTime() << "\n"; currentProfile.close(); //Writing the changes of interfaces to the profile's interface file QString pathString2; QTextStream pathStream2(&pathString2); pathStream2 << this->systemPath << "/profiles/" << this->currentProfile->getName() << "-interfaces.txt"; QFile currentProfileInterfaces(pathString2); currentProfileInterfaces.open(QIODevice::WriteOnly | QIODevice::Text); QTextStream out2(¤tProfileInterfaces); out2 << interfaces.size() << "\n"; for (unsigned int i=0;i<interfaces.size();i++) out2 << interfaces.at(i) << "\n"; currentProfileInterfaces.close(); //Reload the currentProfile with the new changes this->updateProfileInfo(this->currentProfile->getName()); }
void PrinterSettings::updateWidgets() { PrinterProfile *profile = currentProfile(); int n = ui->duplexTypeComboBox->findData(profile->duplexType()); ui->duplexTypeComboBox->setCurrentIndex(n); ui->borderCbx->setChecked(profile->drawBorder()); ui->reverseOrderCbx->setChecked(profile->reverseOrder()); ui->leftMarginSpin->setValue(profile->leftMargin(mUnit)); ui->rightMarginSpin->setValue(profile->rightMargin(mUnit)); ui->topMarginSpin->setValue(profile->topMargin(mUnit)); ui->bottomMarginSpin->setValue(profile->bottomMargin(mUnit)); ui->internalMarginSpin->setValue(profile->internalMargin(mUnit)); ui->delProfileButton->setEnabled(ui->profilesList->count() > 1); }
void PrinterSettings::updateProfile() { PrinterProfile *profile = currentProfile(); profile->setName(currentItem()->text()); profile->setLeftMargin(ui->leftMarginSpin->value(), mUnit); profile->setRightMargin(ui->rightMarginSpin->value(), mUnit); profile->setTopMargin(ui->topMarginSpin->value(), mUnit); profile->setBottomMargin(ui->bottomMarginSpin->value(), mUnit); profile->setInternalMargin(ui->internalMarginSpin->value(), mUnit); QVariant v =ui->duplexTypeComboBox->itemData(ui->duplexTypeComboBox->currentIndex()); profile->setDuplexType(static_cast<DuplexType>(v.toInt())); profile->setDrawBorder(ui->borderCbx->isChecked()); profile->setReverseOrder(ui->reverseOrderCbx->isChecked()); }
ConversionOptions *OptionsDetailed::currentConversionOptions( bool saveLastUsed ) { if( wPlugin && currentPlugin ) { ConversionOptions *conversionOptions = wPlugin->currentConversionOptions(); if( conversionOptions ) { conversionOptions->codecName = cFormat->currentText(); if( conversionOptions->codecName != "wav" ) conversionOptions->pluginName = currentPlugin->name(); else conversionOptions->pluginName = ""; conversionOptions->profile = wPlugin->currentProfile(); conversionOptions->outputDirectoryMode = outputDirectory->mode(); conversionOptions->outputDirectory = outputDirectory->directory(); conversionOptions->outputFilesystem = outputDirectory->filesystem(); conversionOptions->replaygain = cReplayGain->isEnabled() && cReplayGain->isChecked(); for( int i=0; i<wFilter.size(); i++ ) { FilterWidget *widget = wFilter.keys().at(i); FilterPlugin *plugin = wFilter.values().at(i); if( widget && plugin ) { FilterOptions *filterOptions = widget->currentFilterOptions(); if( filterOptions ) { filterOptions->pluginName = plugin->name(); conversionOptions->filterOptions.append( filterOptions ); } } } if( saveLastUsed ) { config->data.general.lastProfile = currentProfile(); saveCustomProfile( true ); config->data.general.lastFormat = cFormat->currentText(); } return conversionOptions; } } return 0; }
void K3b::Device::DiskInfo::debug() const { kDebug() << "DiskInfo:" << endl << "Mediatype: " << K3b::Device::mediaTypeString( mediaType() ) << endl << "Current Profile: " << K3b::Device::mediaTypeString( currentProfile() ) << endl << "Disk state: " << ( diskState() == K3b::Device::STATE_EMPTY ? "empty" : ( diskState() == K3b::Device::STATE_INCOMPLETE ? "incomplete" : ( diskState() == K3b::Device::STATE_COMPLETE ? "complete" : ( diskState() == K3b::Device::STATE_NO_MEDIA ? "no media" : "unknown" ) ) ) ) << endl << "Empty: " << empty() << endl << "Rewritable: " << rewritable() << endl << "Appendable: " << appendable() << endl << "Sessions: " << numSessions() << endl << "Tracks: " << numTracks() << endl << "Layers: " << numLayers() << endl << "Capacity: " << capacity() << " (LBA " << capacity().lba() << ") (" << capacity().mode1Bytes() << " Bytes)" << endl << "Remaining size: " << remainingSize() << " (LBA " << remainingSize().lba() << ") (" << remainingSize().mode1Bytes() << " Bytes)" << endl << "Used Size: " << size() << " (LBA " << size().lba() << ") (" << size().mode1Bytes() << " Bytes)" << endl; if( mediaType() == K3b::Device::MEDIA_DVD_PLUS_RW ) kDebug() << "Bg Format: " << ( bgFormatState() == BG_FORMAT_NONE ? "none" : ( bgFormatState() == BG_FORMAT_INCOMPLETE ? "incomplete" : ( bgFormatState() == BG_FORMAT_IN_PROGRESS ? "in progress" : ( bgFormatState() == BG_FORMAT_COMPLETE ? "complete" : "unknown" ) ) ) ) << endl; }
QJsonObject MojangAccount::saveToJson() const { QJsonObject json; json.insert("username", m_username); json.insert("clientToken", m_clientToken); json.insert("accessToken", m_accessToken); QJsonArray profileArray; for (AccountProfile profile : m_profiles) { QJsonObject profileObj; profileObj.insert("id", profile.id); profileObj.insert("name", profile.name); profileObj.insert("legacy", profile.legacy); profileArray.append(profileObj); } json.insert("profiles", profileArray); QJsonObject userStructure; { userStructure.insert("id", m_user.id); /* QJsonObject userAttrs; for(auto key: m_user.properties.keys()) { auto array = QJsonArray::fromStringList(m_user.properties.values(key)); userAttrs.insert(key, array); } userStructure.insert("properties", userAttrs); */ } json.insert("user", userStructure); if (m_currentProfile != -1) json.insert("activeProfile", currentProfile()->id); return json; }
void EnvironmentSelectionWidget::reconfigure() { QString selectedProfile = currentProfile(); d->model->reload(); setCurrentProfile( d->model->reloadSelectedItem( selectedProfile ) ); }
void PrinterSettings::profileRenamed(QWidget *editor, QAbstractItemDelegate::EndEditHint hint) { currentProfile()->setName(ui->profilesList->currentItem()->text()); }