void SatellitesPlugin::updateSettings() { if (!isInitialized()) { return; } m_satModel->clear(); m_configModel->clear(); addBuiltInDataSources(); // (re)load data sources QStringList dsList = m_settings["dataSources"].toStringList(); dsList << m_settings["userDataSources"].toStringList(); dsList.removeDuplicates(); foreach( const QString &ds, dsList ) { mDebug() << "Loading satellite data from:" << ds; m_satModel->downloadFile( QUrl( ds ), ds ); }
void mainWindow::editGame() { if(ui->tableGames->currentIndex().isValid()) { QString console = ui->tableGames->model()->data(ui->tableGames->model()->index(ui->tableGames->currentIndex().row(), 0)).toString(); QString title = ui->tableGames->model()->data(ui->tableGames->model()->index(ui->tableGames->currentIndex().row(), 1)).toString(); QString annee = ui->tableGames->model()->data(ui->tableGames->model()->index(ui->tableGames->currentIndex().row(), 2)).toString(); QString devs = ui->tableGames->model()->data(ui->tableGames->model()->index(ui->tableGames->currentIndex().row(), 3)).toString(); QSqlTableModel* m = new QSqlTableModel(); m->setTable("Consoles"); m->removeColumn(0); m->select(); QStringList list; for(int i = 0; i < m->rowCount(); i++) { list.append(m->record(i).value(0).toString()); } list.removeDuplicates(); editDialog* d = new editDialog(list, this, console, title, annee, devs); if(d->exec() == QDialog::Accepted) { QSqlQuery q; QString query = "UPDATE Games " "SET console='" + d->console() + "', " "titre='" + d->titre() + "', " "annee='" + d->annee() + "', " "devs='" + d->devs() + "' " "WHERE console='" + console +"' AND titre='" + title + "' AND annee='"+ annee + "' AND devs='" + devs + "';"; q.exec(query); m_model->select(); } } }
QStringList LUtils::systemApplicationDirs(){ //Returns a list of all the directories where *.desktop files can be found QStringList appDirs = QString(getenv("XDG_DATA_HOME")).split(":"); appDirs << QString(getenv("XDG_DATA_DIRS")).split(":"); if(appDirs.isEmpty()){ appDirs << "/usr/local/share" << "/usr/share" << LOS::AppPrefix()+"/share" << LOS::SysPrefix()+"/share" << L_SHAREDIR; } appDirs.removeDuplicates(); //Now create a valid list QStringList out; for(int i=0; i<appDirs.length(); i++){ if( QFile::exists(appDirs[i]+"/applications") ){ out << appDirs[i]+"/applications"; //Also check any subdirs within this directory // (looking at you KDE - stick to the standards!!) out << LUtils::listSubDirectories(appDirs[i]+"/applications"); } } //qDebug() << "System Application Dirs:" << out; return out; }
int KCupsConnection::createDBusSubscription(const QStringList &events) { // Build the current list QStringList currentEvents; foreach (const QStringList ®isteredEvents, m_requestedDBusEvents) { currentEvents << registeredEvents; } currentEvents.removeDuplicates(); // Check if the requested events are already being asked bool equal = true; foreach (const QString &event, events) { if (!currentEvents.contains(event)) { equal = false; break; } } // Store the subscription int id = 1; if (!m_requestedDBusEvents.isEmpty()) { id = m_requestedDBusEvents.keys().last(); ++id; } m_requestedDBusEvents[id] = events; // If the requested list is included in our request just // return an ID if (equal) { return id; } // If we alread have a subscription lets cancel // and create a new one if (m_subscriptionId >= 0) { cancelDBusSubscription(); } // Canculates the new events renewDBusSubscription(); return id; }
void MoveDialog::fillLetter(const QString& year) { QSqlQuery q(_db); q.prepare("SELECT letter FROM Grades WHERE num=:yr"); q.bindValue(":yr", year); if(!q.exec()) qDebug() << "Failed to fill letterBox" << q.lastError().text(); QStringList myNames; while (q.next()) myNames.append(q.value(0).toString()); myNames.removeDuplicates(); if (year == cy) myNames.removeOne(cl); myNames.sort(); ui->cbLetter->clear(); ui->cbLetter->addItems(myNames); }
// ============== // Informational // ============== QStringList LPBackend::listPossibleDatasets(){ QString cmd = "zpool list -H -o name"; //Need output, so run this in a QProcess QProcess *proc = new QProcess; proc->setProcessChannelMode(QProcess::MergedChannels); proc->start(cmd); proc->waitForFinished(); QStringList out = QString(proc->readAllStandardOutput()).split("\n"); delete proc; //Now process the output (one dataset per line - no headers) QStringList list; for(int i=0; i<out.length(); i++){ QString ds = out[i].section("/",0,0).simplified(); if(!ds.isEmpty()){ list << ds; } } list.removeDuplicates(); return list; }
//---------------------------------------------------------------------------- QStringList ctkDICOMServerNodeWidget::selectedServerNodes()const { Q_D(const ctkDICOMServerNodeWidget); QStringList nodes; const int count = d->NodeTable->rowCount(); for (int row = 0; row < count; ++row) { QTableWidgetItem* item = d->NodeTable->item(row, NameColumn); if (item && item->checkState() == Qt::Checked) { nodes << item->text(); } } // If there are duplicates, serverNodeParameters(QString) will behave // strangely Q_ASSERT(nodes.removeDuplicates() == 0); return nodes; }
void QssEditor::saveLastFiles() { QStringList files; if(ui->toolOpen->menu()) { const QList<QAction *> actions = ui->toolOpen->menu()->actions(); foreach(QAction *a, actions) { files.append(a->text()); } files.removeDuplicates(); // maximum history size while(files.size() > 15) files.removeLast(); }
const QStringList& ContentFactory::getSupportedExtensions() { static QStringList extensions; if (extensions.empty()) { #if TIDE_ENABLE_PDF_SUPPORT extensions.append(PDFContent::getSupportedExtensions()); #endif extensions.append(SVGContent::getSupportedExtensions()); extensions.append(ImageContent::getSupportedExtensions()); #if TIDE_ENABLE_MOVIE_SUPPORT extensions.append(MovieContent::getSupportedExtensions()); #endif extensions.removeDuplicates(); } return extensions; }
QStringList Editor::getAllPortNames() const { QStringList result; for (const Diagram * const diagram : mDiagrams.values()) { for (const Type * const type : diagram->types()) { if (dynamic_cast<const Port * const>(type)) { result << type->name(); } } } for (const Editor * const editor : mIncludes) { result += editor->getAllPortNames(); } result.removeDuplicates(); return result; }
void MediaCenter::setGenreFilters(const QStringList &genreFilters) { QStringList genresFixed = genreFilters; genresFixed.sort(); genresFixed.removeDuplicates(); genresFixed.removeAll(QString()); genresFixed.removeAll(QString("")); if (m_genreFilters != genresFixed) { QSettings settings; settings.setValue(QLatin1String(CORE_GENRE_FILTERS), genresFixed); m_genreFilters = genresFixed; if (m_showCursor) { m_genreFiltersChanged = true; } else { m_genreFiltersChanged = false; emit genreFiltersChanged(); } } }
Page::Page(Site *site, QMap<QString,Site*> *sites, QStringList tags, int page, int limit, QStringList postFiltering, bool smart, QObject *parent, int pool) : QObject(parent), m_site(site), m_postFiltering(postFiltering), m_errors(QStringList()), m_imagesPerPage(limit), m_currentSource(0), m_smart(smart) { m_website = m_site->url(); m_imagesCount = -1; m_pagesCount = -1; // Replace shortcuts to increase compatibility QString text = " "+tags.join(" ")+" "; text.replace(" rating:s ", " rating:safe ", Qt::CaseInsensitive) .replace(" rating:q ", " rating:questionable ", Qt::CaseInsensitive) .replace(" rating:e ", " rating:explicit ", Qt::CaseInsensitive) .replace(" -rating:s ", " -rating:safe ", Qt::CaseInsensitive) .replace(" -rating:q ", " -rating:questionable ", Qt::CaseInsensitive) .replace(" -rating:e ", " -rating:explicit ", Qt::CaseInsensitive); tags = text.split(" ", QString::SkipEmptyParts); tags.removeDuplicates(); // Get the list of all enabled modifiers QStringList modifiers = QStringList(); for (int i = 0; i < sites->size(); i++) { if (sites->value(sites->keys().at(i))->contains("Modifiers")) { modifiers.append(sites->value(sites->keys().at(i))->value("Modifiers").trimmed().split(" ", QString::SkipEmptyParts)); } } if (m_site->contains("Modifiers")) { QStringList mods = m_site->value("Modifiers").trimmed().split(" ", QString::SkipEmptyParts); for (int j = 0; j < mods.size(); j++) { modifiers.removeAll(mods[j]); } } for (int k = 0; k < modifiers.size(); k++) { tags.removeAll(modifiers[k]); } m_search = tags; // Set values m_page = page; m_pool = pool; fallback(false); m_replyExists = false; m_replyTagsExists = false; m_currentUrl = 0; }
void QToDoContent::flushData(const QStringList &data) { int i = 0; QStringList sdata = data; sdata.removeDuplicates(); m_model->clear(); setTitle(m_title); for ( i = 0 ; i < sdata.count(); ++i) { QList<QStandardItem*> row; QStandardItem *item = new QStandardItem(sdata.at(i)); QStandardItem *check = new QStandardItem(); item->setIcon(QIcon(":/ui/desk.ico")); check->setCheckable(true); row<<item<<check; m_model->appendRow(row); } }
/* Generates the json string for the CHOICE type. */ QString CreateNewDatabase::generateChoiceData() { std::unique_ptr<QString> ss(new QString("")); QString dq("\""); QTextStream s(ss.get()); QStringList choices = ui->choice_grp_choices->toPlainText().split("\n"); choices.removeDuplicates(); s << genericAddData() << quote("TYPE", "CHOICE") << "," << quote("CHOICES") << ":["; for (int x = 0; x < choices.size(); ++x) { s << dq << choices[x] << dq; if (x + 1 != choices.size()) s << ","; } s << "]}}"; return *s.string(); }
QString BAbstractFileType::createFileDialogFilter() const { QString desc = description(); QStringList sl = suffixes(); if (desc.isEmpty() || sl.isEmpty()) return ""; QString filter; filter += desc + " ("; if (sl.contains("*")) sl.clear(); sl.removeDuplicates(); if (!sl.isEmpty()) { for (int i = 0; i < sl.size(); ++i) filter += "*." + sl.at(i) + (i < sl.size() - 1 ? " " : ""); } else filter += "*"; filter += ")"; return filter; }
QStringList Backend::getSwapDevices(){ //Use "mdconfig" to filter out any SWAP devices QStringList info = runShellCommand("mdconfig -l -v").filter("/swap"); QStringList devs; for(int i=0; i<info.length(); i++){ info[i].replace("\t", " "); devs << info[i].section(" ",0,0).simplified(); } //Also check for EFI/SWAP partitions with glabel info = runShellCommand("glabel status"); for(int i=1; i<info.length(); i++){ info[i].replace("\t"," "); QString lab = info[i].section(" ",0,0); if(lab.contains("label/efi") || lab.contains("/swap") ){ devs << info[i].section(" ",2,2,QString::SectionSkipEmpty); } } devs.removeDuplicates(); return devs; }
LedgerViewer::LedgerViewer(QWidget * parent): QWidget(parent),ui(new Ui::LedgerViewerWidget){ ui->setupUi(this); m_currency = tr("euro"); m_lm = new LedgerManager(this); m_ledgerEdit = new LedgerEdit(this); m_ledgerEdit->hide(); /*"QMenuBar {" " background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1," "stop:0 lightgray, stop:1 darkgray);}"*/ m_menuBar = new QMenuBar(this); m_menuBar->setAttribute(Qt::WA_TranslucentBackground); QString menuBarStyle = "QMenuBar {" " background-color:lightgray ;}" "QMenuBar::item {" "spacing: 3px; // spacing between menu bar items" "padding: 1px 4px;" "background: transparent;" "border-radius: 4px;}" "QMenuBar::item:selected {" // when selected using mouse or keyboard "background: #a8a8a8;}" "QMenuBar::item:pressed {" "background: #888888;}"; m_menuBar->setStyleSheet(menuBarStyle); QStringList listOfMonths; listOfMonths = m_lm->getListOfMonths(); ui->monthsComboBox->addItems(listOfMonths); QStringList listOfYears; QString currentDate = QDate::currentDate().toString("yyyy"); listOfYears << currentDate; listOfYears << m_lm->getListOfYears(); listOfYears.removeDuplicates(); ui->yearsComboBox->addItems(listOfYears); ui->tableView->setShowGrid(false); if(createActions()){ createMenus(); fillMenuBar(); } connect(ui->monthsComboBox,SIGNAL(activated(const QString&)),this, SLOT(monthsComboBoxcurrentIndexChanged(const QString&))); }
void LuaHoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos) { LuaEditorWidget *cppEditor = qobject_cast<LuaEditorWidget *>(editor->widget()); if (!cppEditor) return; if (!cppEditor->extraSelectionTooltip(pos).isEmpty()) { setToolTip(cppEditor->extraSelectionTooltip(pos)); } else { QTextCursor tc(cppEditor->document()); tc.setPosition(pos); LuaElementEvaluator evaluator(cppEditor); evaluator.setTextCursor(tc); evaluator.execute(); if (evaluator.hasDiagnosis()) { setToolTip(evaluator.diagnosis()); setIsDiagnosticTooltip(true); } if (evaluator.identifiedCppElement()) { const QSharedPointer<LuaElement> &cppElement = evaluator.cppElement(); if (!isDiagnosticTooltip()) setToolTip(cppElement->tooltip); QStringList candidates = cppElement->helpIdCandidates; candidates.removeDuplicates(); foreach (const QString &helpId, candidates) { if (helpId.isEmpty()) continue; const QMap<QString, QUrl> helpLinks = Core::HelpManager::linksForIdentifier(helpId); if (!helpLinks.isEmpty()) { setLastHelpItemIdentified(TextEditor::HelpItem(helpId, cppElement->helpMark, cppElement->helpCategory, helpLinks)); break; } } } } }
void manageSystemVolumes::readSystemPartitions() { QFile file( m_path ) ; if( !file.open( QIODevice::ReadOnly ) ){ return ; } QStringList entries = QString( file.readAll() ).split( '\n' ) ; file.close() ; if( entries.isEmpty() ){ return ; } entries.removeDuplicates() ; int j = entries.size() ; for( int i = 0 ; i < j ; i++ ){ this->addItemsToTable( entries.at( i ) ) ; } }
void HeaderFilterProgress::findAll(const QString &text,QTextDocument::FindFlags findFlags) { // Fetch a list of all open projects QList<ProjectExplorer::Project*> projects = d->projectExplorer()->session()->projects(); // Make a list of files in each project QStringList files; Q_FOREACH(ProjectExplorer::Project* project, projects) files += project->files(ProjectExplorer::Project::AllFiles); // Remove duplicates files.removeDuplicates(); //------------------------------------------------------------ // Begin searching QString includeline = "#include <" + text + '>'; Find::SearchResult* result = d->searchResultWindow()->startNewSearch(); d->watcher.setFuture(QFuture<FileSearchResult>()); //When result gets activated it invokes the openEditor function connect(result, SIGNAL(activated(Find::SearchResultItem)), this, SLOT(openEditor(Find::SearchResultItem))); d->searchResultWindow()->popup(true); // Let the watcher monitor the search results d->watcher.setFuture(Utils::findInFiles(includeline, files, findFlags)); //Creates the Progres bar Core::FutureProgress* progress = Core::ICore::instance()->progressManager()->addTask(d->watcher.future(), "MySearch", Find::Constants::TASK_SEARCH, Core::ProgressManager::KeepOnFinish ); progress->setWidget(createProgressWidget()); connect(progress, SIGNAL(clicked()), d->searchResultWindow(), SLOT(popup())); }
void SATDialog::setupCategories() { // en will be used in template.xml and it will be then replaced with the lang when used for users // to get the categories in their language. cats.insert(QString("Advertisements"), QObject::tr("Advertisements")); cats.insert(QString("Announcements") , QObject::tr("Announcements")); cats.insert(QString("Brochures") , QObject::tr("Brochures")); cats.insert(QString("Business Cards"), QObject::tr("Business Cards")); cats.insert(QString("Calendars") , QObject::tr("Calendars")); cats.insert(QString("Cards") , QObject::tr("Cards")); cats.insert(QString("Catalogs") , QObject::tr("Catalogs")); cats.insert(QString("Envelopes") , QObject::tr("Envelopes")); cats.insert(QString("Flyers") , QObject::tr("Flyers")); cats.insert(QString("Grids") , QObject::tr("Grids")); cats.insert(QString("Folds") , QObject::tr("Folds")); cats.insert(QString("Labels") , QObject::tr("Labels")); cats.insert(QString("Letterheads"), QObject::tr("Letterheads")); cats.insert(QString("Magazines") , QObject::tr("Magazines")); cats.insert(QString("Media Cases") , QObject::tr("Media Cases")); cats.insert(QString("Menus") , QObject::tr("Menus")); cats.insert(QString("Newsletters"), QObject::tr("Newsletters")); cats.insert(QString("Own Templates"), QObject::tr("Own Templates")); cats.insert(QString("PDF Forms") , QObject::tr("PDF Forms")); cats.insert(QString("PDF Presentations") , QObject::tr("PDF Presentations")); cats.insert(QString("Posters") , QObject::tr("Posters")); cats.insert(QString("Programs") , QObject::tr("Programs")); cats.insert(QString("Signs") , QObject::tr("Signs")); cats.insert(QString("Text Documents"), QObject::tr("Text Documents")); addCategories(ScPaths::instance().applicationDataDir() + "/templates"); addCategories(ScPaths::instance().templateDir()); addCategories(ScPaths::instance().userTemplateDir(true)); QStringList list = cats.values(); list.removeDuplicates(); list.sort(); catsCombo->addItem(""); catsCombo->addItems(list); catsCombo->setEditable(true); }
OrphanedImagesDialog::OrphanedImagesDialog(QWidget *parent) : MasterDialog(parent), ui(new Ui::OrphanedImagesDialog) { ui->setupUi(this); ui->fileTreeWidget->installEventFilter(this); QDir mediaDir(NoteFolder::currentMediaPath()); if (!mediaDir.exists()) { ui->progressBar->setValue(ui->progressBar->maximum()); return; } QStringList orphanedFiles = mediaDir.entryList( QStringList("*"), QDir::Files, QDir::Time); orphanedFiles.removeDuplicates(); QList<Note> noteList = Note::fetchAll(); int noteListCount = noteList.count(); ui->progressBar->setMaximum(noteListCount); ui->progressBar->show(); Q_FOREACH(Note note, noteList) { QString text = note.getNoteText(); // match image links like ![media-qV920](file://media/608766373.gif) QRegularExpression re( "!\\[.*?\\]\\(file:\\/\\/media/(.+?)\\)"); QRegularExpressionMatchIterator i = re.globalMatch(text); // remove all found images from the orphaned files list while (i.hasNext()) { QRegularExpressionMatch match = i.next(); QString fileName = match.captured(1); orphanedFiles.removeAll(fileName); } ui->progressBar->setValue(ui->progressBar->value() + 1); }
void VConfigManager::initDocSuffixes() { m_docSuffixes.clear(); QStringList mdSuffix = getConfigFromSettings("global", "markdown_suffix").toStringList(); if (mdSuffix.isEmpty()) { mdSuffix = getDefaultConfig("global", "markdown_suffix").toStringList(); } for (auto it = mdSuffix.begin(); it != mdSuffix.end();) { if (it->isEmpty()) { it = mdSuffix.erase(it); } else { *it = it->toLower(); ++it; } } Q_ASSERT(!mdSuffix.isEmpty()); mdSuffix.removeDuplicates(); m_docSuffixes[(int)DocType::Markdown] = mdSuffix; QList<QString> list; list << "ls" << "list"; m_docSuffixes[(int)DocType::List] = list; QList<QString> container; container << "co" << "container" << "con"; m_docSuffixes[(int)DocType::Container] = container; QList<QString> html; html << "html"; m_docSuffixes[(int)DocType::Html] = html; qDebug() << "doc suffixes" << m_docSuffixes; }
void PhysiomeModelRepositoryWindowWidget::filter(const QString &pFilter) { // Filter our list of exposures, remove any duplicates (they will be // reintroduced in the next step) and update our message (by retranslating // ourselves) QStringList filteredExposureNames = mExposureNames.filter(QRegularExpression(pFilter, QRegularExpression::CaseInsensitiveOption)); mNumberOfFilteredExposures = filteredExposureNames.count(); filteredExposureNames.removeDuplicates(); retranslateUi(); // Show/hide the relevant exposures // Note: to call QWebElement::setStyleProperty() many times is time // consuming, hence we rely on mExposureDisplayed to determine when we // should change the display property of our elements... QWebElement trElement = page()->mainFrame()->documentElement().findFirst(QString("tbody[id=exposures]")).firstChild(); QWebElement ulElement; for (int i = 0, iMax = mExposureNames.count(); i < iMax; ++i) { if (mExposureDisplayed[i] != filteredExposureNames.contains(mExposureNames[i])) { QString displayValue = mExposureDisplayed[i]?"none":"table-row"; trElement.setStyleProperty("display", displayValue); ulElement = trElement.firstChild().firstChild().nextSibling(); if (ulElement.hasClass("visible")) ulElement.setStyleProperty("display", displayValue); mExposureDisplayed[i] = !mExposureDisplayed[i]; } trElement = trElement.nextSibling(); } }
//! Writes current program state to data structures in Config class //! @see closeEvent() void Window::exportSettings() const { config->clear(); int index; config->pathlistInfile.append(comboInfile->currentText()); for(index = 0; index < comboInfile->count(); ++index) { config->pathlistInfile.append(comboInfile->itemText(index)); } config->pathlistInfile.removeDuplicates(); config->pathlistOutfile.append(comboOutfile->currentText()); for(index = 0; index < comboOutfile->count(); ++index) { config->pathlistOutfile.append(comboOutfile->itemText(index)); } config->pathlistOutfile.removeDuplicates(); config->boxOpen = checkBoxOpenWhenDone->isChecked(); if(comboRowLimit->count() > comboRowLimitDefaultItemCount) { config->limitRows = comboRowLimit->currentText(); } config->colCount = spinColumns->value(); QStringList sl; for(index = 0; index < spinColumns->value(); ++index) { // For each column QComboBox *cBox = dataComboName.at(index); sl.append(cBox->currentText()); // Add the currently displayed text // For each name in this combobox for(int name = 0; name < cBox->count(); ++name) { sl.append(cBox->itemText(name)); } sl.removeDuplicates(); config->colNames.append(sl); sl.clear(); config->colBoxChecked.append(dataCheckBox.at(index)->isChecked()); config->colBytes.append(dataSpinNumBytes.at(index)->value()); } }
void TimeSeriesPicker::on_buttonBox_accepted() { QStringList id; Rcpp::CharacterVector vec = vv->getCharacterVector(vv->getVariableIndex(ui->comboBoxVariableID->currentText())); for (int i = 0; i < vec.length(); ++i) { id << QString::fromUtf8(vec[i]); } id.removeDuplicates(); if (id.length() != vec.length()) { QMessageBox::information(this,"Non ID Variable Selected","Please Choose unique variable for ID"); return; } if (ui->listWidgetTimes->selectedItems().length() < 2) { QMessageBox::information(this,"No Selected time","Please Choose at least two time"); return; } QStringList timeList; for (int i = 0; i < ui->listWidgetTimes->count(); ++i) { if (ui->listWidgetTimes->item(i)->isSelected()) { timeList << ui->listWidgetTimes->item(i)->text(); } } QString x = ui->comboBoxVariable->currentText(); vv->sendDataFrameSeriesFormatted(ui->comboBoxVariable->currentText(),ui->comboBoxVariableID->currentText(),timeList,rconn); setupChartView("Time Series Plot",x, new QWidget()); QString command; try { command = QString("gr<-ggplot(dframe, aes(times, %1 , group = ID, colour = ID)) + geom_line()").arg(x); qDebug() << command; rconn.parseEvalQ(command.toStdString()); printGraph(rconn,11,6); } catch (...) { } close(); }
void Qtilities::Testing::DebugWidget::on_btnAddFilterExpression_clicked() { bool ok; QString text = QInputDialog::getText(this, "Add filter expression","Filter expression:", QLineEdit::Normal,"", &ok); if (ok && !text.isEmpty()) { QRegExp reg_exp(text); reg_exp.setPatternSyntax(QRegExp::Wildcard); while (!reg_exp.isValid()) { QString msg_string = QString("You entered an invalid regular expression:\n\nError: %1\n\nNew expression:").arg(reg_exp.errorString()); QString text = QInputDialog::getText(this, "Expression Is Not Valid",msg_string, QLineEdit::Normal,reg_exp.pattern(), &ok); if (ok && !text.isEmpty()) reg_exp.setPattern(text); else return; } QStringList list = d->filtered_plugins_model.stringList(); list << text; list.removeDuplicates(); d->filtered_plugins_model.setStringList(list); } }
SettingsFrame::SettingsFrame(QWidget *parent) : QFrame(parent), ui(new Ui::SettingsFrame) { ui->setupUi(this); WindowsRegistry wr; QString err = wr.open(HKEY_LOCAL_MACHINE, "Software\\Npackd\\Npackd\\InstallationDirs", false, KEY_READ); QStringList dirs; if (err.isEmpty()) { dirs = wr.loadStringList(&err); } dirs.append(WPMUtils::getInstallationDirectory()); dirs.append(WPMUtils::getProgramFilesDir()); if (WPMUtils::is64BitWindows()) dirs.append(WPMUtils::getShellDir(CSIDL_PROGRAM_FILESX86)); dirs.removeDuplicates(); this->ui->comboBoxDir->addItems(dirs); }
QString Cutelyst::ActionRESTPrivate::getAllowedMethods(Controller *controller, const QString &methodName) const { QStringList methods; const QString name = methodName % QLatin1Char('_'); const ActionList actions = controller->actions(); Q_FOREACH (Action *action, actions) { const QString method = action->name(); if (method.startsWith(name)) { methods.append(method.mid(name.size())); } } if (methods.contains(QStringLiteral("GET"))) { methods.append(QStringLiteral("HEAD")); } methods.removeAll(QStringLiteral("not_implemented")); methods.sort(); methods.removeDuplicates(); return methods.join(QStringLiteral(", ")); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); // load translation for Qt QTranslator qtTranslator; qtTranslator.load("qt_"+QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); app.installTranslator(&qtTranslator); // load itmages-dolphin-extension translation if (QLocale::system().name().contains(QRegExp("ru"))) { QTranslator *translator = new QTranslator; translator->load("/usr/share/itmages/itmages-dolphin-extension_ru"); qApp->installTranslator(translator); } QStringList tempList = QApplication::arguments(); tempList.removeFirst(); tempList.replaceInStrings("file://", ""); tempList.removeDuplicates(); QStringList images; for (int i = 0; i < tempList.count(); ++i) if (tempList.at(i).contains(QRegExp("png$|jpeg$|jpg$|gif$", Qt::CaseInsensitive))) images.append(tempList.at(i)); if (!images.isEmpty()) { ITmagesUploader *w = new ITmagesUploader(images); w->show(); } else { QMessageBox::critical(0, "Error - ITmages Uploader", QObject::tr("No images are selected.\n" "Program will be closed."), QMessageBox::Ok); return 0; } return app.exec(); }