本文整理汇总了C++中QStringList::sort方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringList::sort方法的具体用法?C++ QStringList::sort怎么用?C++ QStringList::sort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStringList
的用法示例。
在下文中一共展示了QStringList::sort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepareMenu
void QgsColorRampButton::prepareMenu()
{
mMenu->clear();
QAction *invertAction = new QAction( tr( "Invert color ramp" ), this );
invertAction->setEnabled( !isNull() && !isRandomColorRamp() );
mMenu->addAction( invertAction );
connect( invertAction, &QAction::triggered, this, &QgsColorRampButton::invertColorRamp );
if ( mShowNull )
{
QAction *nullAction = new QAction( tr( "Clear current ramp" ), this );
mMenu->addAction( nullAction );
connect( nullAction, &QAction::triggered, this, &QgsColorRampButton::setToNull );
}
mMenu->addSeparator();
//show default color option if set
if ( mDefaultColorRamp )
{
QAction *defaultColorRampAction = new QAction( tr( "Default color ramp" ), this );
defaultColorRampAction->setIcon( createMenuIcon( mDefaultColorRamp ) );
mMenu->addAction( defaultColorRampAction );
connect( defaultColorRampAction, &QAction::triggered, this, &QgsColorRampButton::setToDefaultColorRamp );
}
if ( mShowRandomColorRamp )
{
QAction *randomColorRampAction = new QAction( tr( "Random color ramp" ), this );
randomColorRampAction->setCheckable( true );
randomColorRampAction->setChecked( isRandomColorRamp() );
mMenu->addAction( randomColorRampAction );
connect( randomColorRampAction, &QAction::triggered, this, &QgsColorRampButton::setRandomColorRamp );
if ( isRandomColorRamp() || dynamic_cast<QgsLimitedRandomColorRamp *>( mColorRamp ) )
{
QAction *shuffleRandomColorRampAction = new QAction( tr( "Shuffle random colors" ), this );
mMenu->addAction( shuffleRandomColorRampAction );
connect( shuffleRandomColorRampAction, &QAction::triggered, this, &QgsColorRampButton::colorRampChanged );
}
}
mMenu->addSeparator();
QStringList rampNames = mStyle->symbolsOfFavorite( QgsStyle::ColorrampEntity );
rampNames.sort();
for ( QStringList::iterator it = rampNames.begin(); it != rampNames.end(); ++it )
{
std::unique_ptr< QgsColorRamp > ramp( mStyle->colorRamp( *it ) );
if ( !mShowGradientOnly || ( ramp->type() == QLatin1String( "gradient" ) || ramp->type() == QLatin1String( "cpt-city" ) ) )
{
QIcon icon = QgsSymbolLayerUtils::colorRampPreviewIcon( ramp.get(), QSize( 16, 16 ) );
QAction *ra = new QAction( *it, this );
ra->setIcon( icon );
connect( ra, &QAction::triggered, this, &QgsColorRampButton::loadColorRamp );
mMenu->addAction( ra );
}
}
mMenu->addSeparator();
mAllRampsMenu->clear();
mMenu->addMenu( mAllRampsMenu );
rampNames = mStyle->colorRampNames();
rampNames.sort();
for ( QStringList::iterator it = rampNames.begin(); it != rampNames.end(); ++it )
{
std::unique_ptr< QgsColorRamp > ramp( mStyle->colorRamp( *it ) );
if ( !mShowGradientOnly || ( ramp->type() == QLatin1String( "gradient" ) || ramp->type() == QLatin1String( "cpt-city" ) ) )
{
QIcon icon = QgsSymbolLayerUtils::colorRampPreviewIcon( ramp.get(), QSize( 16, 16 ) );
QAction *ra = new QAction( *it, this );
ra->setIcon( icon );
connect( ra, &QAction::triggered, this, &QgsColorRampButton::loadColorRamp );
mAllRampsMenu->addAction( ra );
}
}
mMenu->addSeparator();
QAction *newColorRampAction = new QAction( tr( "Create new color ramp..." ), this );
connect( newColorRampAction, &QAction::triggered, this, &QgsColorRampButton::createColorRamp );
mMenu->addAction( newColorRampAction );
QAction *editColorRampAction = new QAction( tr( "Edit color ramp..." ), this );
editColorRampAction->setEnabled( !isNull() && !isRandomColorRamp() );
connect( editColorRampAction, &QAction::triggered, this, &QgsColorRampButton::showColorRampDialog );
mMenu->addAction( editColorRampAction );
QAction *saveColorRampAction = new QAction( tr( "Save color ramp..." ), this );
saveColorRampAction->setEnabled( !isNull() && !isRandomColorRamp() );
connect( saveColorRampAction, &QAction::triggered, this, &QgsColorRampButton::saveColorRamp );
mMenu->addAction( saveColorRampAction );
}
示例2: populateUI
void Wizard::populateUI()
{
QStringList formats = Types::paperFormats().keys();
formats.sort();
m_paperFormatComboBox->addItems(formats);
}
示例3: QString
/**
* Stream operator for QDebug
*/
QDebug operator<<(QDebug dbg, RStorage& s) {
dbg.nospace() << "RStorage(" << QString("%1").arg((long int)&s, 0, 16) << ", ";
dbg.nospace() << "\n";
//dbg.nospace() << "current block ID: " << s.getCurrentBlockId() << "\n";
QSharedPointer<RBlock> block = s.queryCurrentBlock();
if (block.isNull()) {
dbg.nospace() << "current block: INVALID\n";
}
else {
dbg.nospace() << "current block: " << block->getName() << "\n";
}
//dbg.nospace() << "current layer ID: " << s.getCurrentLayerId() << "\n";
QSharedPointer<RLayer> layer = s.queryCurrentLayer();
if (layer.isNull()) {
dbg.nospace() << "current layer: INVALID\n";
}
else {
dbg.nospace() << "current layer: " << layer->getName() << "\n";
}
dbg.nospace() << "current view ID: " << s.getCurrentViewId() << "\n";
dbg.nospace() << "drawing unit: " << s.getUnit() << "\n";
dbg.nospace() << "bounding box: " << s.getBoundingBox() << "\n";
{
QSet<RLayer::Id> layers = s.queryAllLayers(true);
QSetIterator<RLayer::Id> i(layers);
while (i.hasNext()) {
RLayer::Id id = i.next();
QSharedPointer<RLayer> l = s.queryObjectDirect(id).dynamicCast<RLayer>();
if (l.isNull()) {
dbg.nospace() << "layer not found: " << id;
continue;
}
dbg.nospace() << *l.data() << "\n";
}
}
{
QSet<RLayer::Id> views = s.queryAllViews(true);
QSetIterator<RView::Id> i(views);
while (i.hasNext()) {
RView::Id id = i.next();
QSharedPointer<RView> v = s.queryObjectDirect(id).dynamicCast<RView>();
if (v.isNull()) {
dbg.nospace() << "view not found: " << id;
continue;
}
dbg.nospace() << *v.data() << "\n";
}
}
{
QSet<RLayer::Id> blocks = s.queryAllBlocks(true);
QSetIterator<RBlock::Id> i(blocks);
while (i.hasNext()) {
RBlock::Id id = i.next();
QSharedPointer<RBlock> b = s.queryObjectDirect(id).dynamicCast<RBlock>();
if (b.isNull()) {
dbg.nospace() << "block not found: " << id;
continue;
}
dbg.nospace() << *b.data() << "\n";
}
}
{
QSet<REntity::Id> entities = s.querySelectedEntities();
if (entities.size()==0) {
entities = s.queryAllEntities(true, true);
}
QSetIterator<REntity::Id> i(entities);
while (i.hasNext()) {
REntity::Id id = i.next();
QSharedPointer<REntity> e = s.queryObjectDirect(id).dynamicCast<REntity>();
if (e.isNull()) {
dbg.nospace() << "entity not found: " << id;
continue;
}
dbg.nospace() << "Bounding Box: " << e->getBoundingBox() << "\n";
dbg.nospace() << *e.data() << "\n\n";
}
}
dbg.nospace() << "lastTransactionId: " << s.getLastTransactionId() << "\n";
for (int a = 0; a <= s.getMaxTransactionId(); ++a) {
RTransaction t = s.getTransaction(a);
dbg.nospace() << t << "\n";
}
dbg.nospace() << "variables: \n";
{
QStringList vars = s.getVariables();
vars.sort();
QListIterator<QString> i(vars);
while (i.hasNext()) {
QString key = i.next();
//.........这里部分代码省略.........
示例4: createNetlist
/*!
* \brief Xyce::createNetlist
* \param[out] stream QTextStream that associated with spice netlist file
* \param[in] simulations The list of simulations that need to included in netlist.
* \param[out] vars The list of output variables and node names.
* \param[out] outputs The list of spice output raw text files.
*/
void Xyce::createNetlist(QTextStream &stream, int , QStringList &simulations,
QStringList &vars, QStringList &outputs)
{
QString s;
bool hasParSweep = false;
if(!prepareSpiceNetlist(stream,true)) return; // Unable to perform spice simulation
startNetlist(stream,true);
// set variable names for named nodes and wires
vars.clear();
for(Node *pn = Sch->DocNodes.first(); pn != 0; pn = Sch->DocNodes.next()) {
if(pn->Label != 0) {
if (!vars.contains(pn->Label->Name)) {
vars.append(pn->Label->Name);
}
}
}
for(Wire *pw = Sch->DocWires.first(); pw != 0; pw = Sch->DocWires.next()) {
if(pw->Label != 0) {
if (!vars.contains(pw->Label->Name)) {
vars.append(pw->Label->Name);
}
}
}
for(Component *pc = Sch->DocComps.first(); pc != 0; pc = Sch->DocComps.next()) {
if (pc->isProbe) {
QString var_pr = pc->getProbeVariable(true);
if (!vars.contains(var_pr)) {
vars.append(var_pr);
}
}
/*if (pc->isEquation) {
Equation *eq = (Equation *)pc;
QStringList vars_eq;
eq->getDepVars(vars_eq);
vars.append(vars_eq);
}*/
}
vars.sort();
qDebug()<<vars;
//execute simulations
QFileInfo inf(Sch->DocName);
QString basenam = inf.baseName();
QString nod,nods;
nods.clear();
foreach (nod,vars) {
if (!nod.startsWith("I(")) {
nods += QString("v(%1) ").arg(nod);
} else {
nods += nod + " ";
}
}
QString sim = simulations.first();
for(Component *pc = Sch->DocComps.first(); pc != 0; pc = Sch->DocComps.next()) { // Xyce can run
if(pc->isSimulation) { // only one simulations per time.
QString sim_typ = pc->Model; // Multiple simulations are forbidden.
QString s = pc->getSpiceNetlist(true);
if ((sim_typ==".AC")&&(sim=="ac")) stream<<s;
if ((sim_typ==".TR")&&(sim=="tran")){
stream<<s;
Q3PtrList<Component> comps(Sch->DocComps); // find Fourier tran
for(Component *pc1 = comps.first(); pc1 != 0; pc1 = comps.next()) {
if (pc1->Model==".FOURIER") {
if (pc1->Props.at(0)->Value==pc->Name) {
QString s1 = pc1->getSpiceNetlist(true);
outputs.append("spice4qucs.tran.cir.four");
stream<<s1;
}
}
}
}
if ((sim_typ==".HB")&&(sim=="hb")) stream<<s;
if (sim_typ==".SW") {
QString SwpSim = pc->Props.at(0)->Value;
if (SwpSim.startsWith("DC")&&(sim=="dc")) stream<<s;
else if (SwpSim.startsWith("AC")&&(sim=="ac")) {
stream<<s;
hasParSweep = true;
} else if (SwpSim.startsWith("TR")&&(sim=="tran")) {
stream<<s;
hasParSweep = true;
} if (SwpSim.startsWith("HB")&&(sim=="hb")) {
stream<<s;
hasParSweep = true;
}
}
if ((sim_typ==".DC")) stream<<s;
}
//.........这里部分代码省略.........
示例5: readSettings
void SystemOptions::readSettings(bool reload) {
QSettings settings(m_settingsFileName,QSettings::IniFormat);
settings.setIniCodec("UTF-8");
settings.beginGroup(m_section);
m_contentsLinked->setChecked(settings.value(SID_SYSTEM_CONTENTS_LINKED,true).toBool());
m_lexicon->setText(settings.value(SID_SYSTEM_DATABASE,"lexicon.sqlite").toString());
m_docked->setChecked(settings.value(SID_SYSTEM_DOCKED,true).toBool());
m_importCheck->setChecked(settings.value(SID_SYSTEM_IMPORTLINKS_IGNORE,false).toBool());
m_importShow->setChecked(settings.value(SID_SYSTEM_IMPORTLINKS_SHOW_WARNING,false).toBool());
m_minimalInterface->setChecked(settings.value(SID_SYSTEM_MINIMAL,true).toBool());
m_restoreBookmarks->setChecked(settings.value(SID_SYSTEM_RESTORE_BOOKMARKS,true).toBool());
m_restoreTabs->setChecked(settings.value(SID_SYSTEM_RESTORE_TABS,true).toBool());
// m_saveSettings->setChecked(settings.value(SID_SYSTEM_SAVE_SETTINGS,true).toBool());
m_saveTabs->setChecked(settings.value(SID_SYSTEM_SAVE_TABS,true).toBool());
m_rootNavigation->setChecked(settings.value(SID_SYSTEM_BY_ROOT,true).toBool());
m_interval->setText(settings.value(SID_SYSTEM_MESSAGE_TIMEOUT,2).toString());
m_appendNewTab->setChecked(settings.value(SID_SYSTEM_APPEND_NEW_TABS,true).toBool());
m_insertNewTab->setChecked(! m_appendNewTab->isChecked());
QString newStyle = m_qtStyle->currentText();
m_qtStyle->setCurrentText(settings.value(SID_SYSTEM_QT_STYLE).toString());
if (reload) {
QString oldStyle = m_qtStyle->currentText();
if (oldStyle != newStyle) {
QApplication::setStyle(QStyleFactory::create(oldStyle));
}
}
#ifndef STANDALONE
m_keyboard->addItems(getLexicon()->getKeyboards());
m_keyboard->setCurrentText(getLexicon()->getDefaultKeyboard());
QStringList themes = getLexicon()->getThemes();
themes.sort();
m_theme->addItems(themes);
m_theme->setCurrentText(getLexicon()->currentTheme());
#endif
// QString d = settings.value(SID_SYSTEM_RUN_DATE,QString()).toString();
// m_runDate->setDateTime(QDateTime::fromString(d,Qt::ISODate));
m_allowDuplicates->setChecked(settings.value(SID_SYSTEM_ALLOW_DUPLICATES,false).toBool());
m_showInterfaceWarning->setChecked(settings.value(SID_SYSTEM_INTERFACE_WARNING,true).toBool());
m_css->setText(settings.value(SID_SYSTEM_STYLESHEET,"app.css").toString());
m_title->setText(settings.value(SID_SYSTEM_TITLE,"Lane's Lexicon").toString());
m_toolbarText->setChecked(settings.value(SID_SYSTEM_TOOLBAR_TEXT,true).toBool());
m_optionsWarning->setChecked(settings.value(SID_SYSTEM_OPTIONS_CLOSE,true).toBool());
settings.endGroup();
settings.beginGroup("Notes");
// m_useNotes->setChecked(settings.value(SID_NOTES_ENABLED,false).toBool());
m_notesDb->setText(settings.value(SID_NOTES_DATABASE,"notes.sqlite").toString());
settings.endGroup();
settings.beginGroup("Splash");
m_splashScreen->setChecked(settings.value(SID_SPLASH_ENABLED,true).toBool());
m_splashDuration->setText(settings.value(SID_SPLASH_DELAY,3).toString());
settings.endGroup();
settings.beginGroup("History");
m_historyDb->setText(settings.value(SID_HISTORY_DATABASE,"history.sqlite").toString());
settings.endGroup();
settings.beginGroup("Help");
m_onlineUrl->setText(settings.value(SID_HELP_ONLINE_PREFIX).toString());
m_onlineCurrentPage->setText(settings.value(SID_HELP_ONLINE_URL,QUrl()).toUrl().toString());
m_offlineLocation->setText(settings.value(SID_HELP_LOCAL_LOCATION,"site").toString());
QDir dd(m_offlineLocation->text());
// QUrl u = settings.value(SID_HELP_LOCAL_URL,QUrl()).toUrl();
// m_offlineCurrentPage->setText(dd.relativeFilePath(u.fileName()));
m_offlineCurrentPage->setText(settings.value(SID_HELP_LOCAL_URL,"index.html").toString());
//u.tom_offlineLocation->text();
m_localDocs->setChecked(settings.value(SID_HELP_LOCAL,true).toBool());
m_dirty = false;
}
示例6: readSettings
void ApplicationSettings::readSettings()
{
KSharedConfigPtr config = d->config;
// ---------------------------------------------------------------------
KConfigGroup group = config->group(d->configGroupDefault);
QStringList collectionList = group.readEntry(d->configAlbumCollectionsEntry, QStringList());
if (!collectionList.isEmpty())
{
collectionList.sort();
d->albumCategoryNames = collectionList;
}
d->albumSortRole = ApplicationSettings::AlbumSortRole(group.readEntry(d->configAlbumSortRoleEntry,
(int)ApplicationSettings::ByFolder));
d->imageSortOrder = group.readEntry(d->configImageSortOrderEntry, (int)ImageSortSettings::SortByFileName);
d->imageSorting = group.readEntry(d->configImageSortingEntry, (int)ImageSortSettings::AscendingOrder);
d->imageGroupMode = group.readEntry(d->configImageGroupModeEntry, (int)ImageSortSettings::CategoryByAlbum);
d->imageGroupSortOrder = group.readEntry(d->configImageGroupSortOrderEntry, (int)ImageSortSettings::AscendingOrder);
d->itemLeftClickAction = ApplicationSettings::ItemLeftClickAction(group.readEntry( d->configItemLeftClickActionEntry,
(int)ApplicationSettings::ShowPreview));
d->thumbnailSize = group.readEntry(d->configDefaultIconSizeEntry, (int)ThumbnailSize::Medium);
d->treeThumbnailSize = group.readEntry(d->configDefaultTreeIconSizeEntry, 22);
d->treeviewFont = group.readEntry(d->configTreeViewFontEntry, QFontDatabase::systemFont(QFontDatabase::GeneralFont));
d->currentTheme = group.readEntry(d->configThemeEntry, ThemeManager::instance()->defaultThemeName());
d->sidebarTitleStyle = (DMultiTabBar::TextStyle)group.readEntry(d->configSidebarTitleStyleEntry,
(int)DMultiTabBar::ActiveIconText);
d->ratingFilterCond = group.readEntry(d->configRatingFilterConditionEntry,
(int)ImageFilterSettings::GreaterEqualCondition);
d->recursiveAlbums = group.readEntry(d->configRecursiveAlbumsEntry, false);
d->recursiveTags = group.readEntry(d->configRecursiveTagsEntry, true);
d->iconShowName = group.readEntry(d->configIconShowNameEntry, false);
d->iconShowResolution = group.readEntry(d->configIconShowResolutionEntry, false);
d->iconShowAspectRatio = group.readEntry(d->configIconShowAspectRatioEntry, false);
d->iconShowSize = group.readEntry(d->configIconShowSizeEntry, false);
d->iconShowDate = group.readEntry(d->configIconShowDateEntry, true);
d->iconShowModDate = group.readEntry(d->configIconShowModificationDateEntry, true);
d->iconShowTitle = group.readEntry(d->configIconShowTitleEntry, true);
d->iconShowComments = group.readEntry(d->configIconShowCommentsEntry, true);
d->iconShowTags = group.readEntry(d->configIconShowTagsEntry, true);
d->iconShowOverlays = group.readEntry(d->configIconShowOverlaysEntry, true);
d->iconShowFullscreen = group.readEntry(d->configIconShowFullscreenEntry, true);
d->iconShowRating = group.readEntry(d->configIconShowRatingEntry, true);
d->iconShowImageFormat = group.readEntry(d->configIconShowImageFormatEntry, false);
d->iconShowCoordinates = group.readEntry(d->configIconShowCoordinatesEntry, false);
d->iconviewFont = group.readEntry(d->configIconViewFontEntry, QFontDatabase::systemFont(QFontDatabase::GeneralFont));
d->toolTipsFont = group.readEntry(d->configToolTipsFontEntry, QFontDatabase::systemFont(QFontDatabase::GeneralFont));
d->showToolTips = group.readEntry(d->configShowToolTipsEntry, false);
d->tooltipShowFileName = group.readEntry(d->configToolTipsShowFileNameEntry, true);
d->tooltipShowFileDate = group.readEntry(d->configToolTipsShowFileDateEntry, false);
d->tooltipShowFileSize = group.readEntry(d->configToolTipsShowFileSizeEntry, false);
d->tooltipShowImageType = group.readEntry(d->configToolTipsShowImageTypeEntry, false);
d->tooltipShowImageDim = group.readEntry(d->configToolTipsShowImageDimEntry, true);
d->tooltipShowImageAR = group.readEntry(d->configToolTipsShowImageAREntry, true);
d->tooltipShowPhotoMake = group.readEntry(d->configToolTipsShowPhotoMakeEntry, true);
d->tooltipShowPhotoDate = group.readEntry(d->configToolTipsShowPhotoDateEntry, true);
d->tooltipShowPhotoFocal = group.readEntry(d->configToolTipsShowPhotoFocalEntry, true);
d->tooltipShowPhotoExpo = group.readEntry(d->configToolTipsShowPhotoExpoEntry, true);
d->tooltipShowPhotoMode = group.readEntry(d->configToolTipsShowPhotoModeEntry, true);
d->tooltipShowPhotoFlash = group.readEntry(d->configToolTipsShowPhotoFlashEntry, false);
d->tooltipShowPhotoWb = group.readEntry(d->configToolTipsShowPhotoWBEntry, false);
d->tooltipShowAlbumName = group.readEntry(d->configToolTipsShowAlbumNameEntry, false);
d->tooltipShowComments = group.readEntry(d->configToolTipsShowCommentsEntry, true);
d->tooltipShowTags = group.readEntry(d->configToolTipsShowTagsEntry, true);
d->tooltipShowLabelRating = group.readEntry(d->configToolTipsShowLabelRatingEntry, true);
d->tooltipShowVideoAspectRatio = group.readEntry(d->configToolTipsShowVideoAspectRatioEntry, true);
d->tooltipShowVideoAudioBitRate = group.readEntry(d->configToolTipsShowVideoAudioBitRateEntry, true);
d->tooltipShowVideoAudioChannelType = group.readEntry(d->configToolTipsShowVideoAudioChannelTypeEntry, true);
d->tooltipShowVideoAudioCompressor = group.readEntry(d->configToolTipsShowVideoAudioCompressorEntry, true);
d->tooltipShowVideoDuration = group.readEntry(d->configToolTipsShowVideoDurationEntry, true);
d->tooltipShowVideoFrameRate = group.readEntry(d->configToolTipsShowVideoFrameRateEntry, true);
d->tooltipShowVideoVideoCodec = group.readEntry(d->configToolTipsShowVideoVideoCodecEntry, true);
d->showAlbumToolTips = group.readEntry(d->configShowAlbumToolTipsEntry, false);
d->tooltipShowAlbumTitle = group.readEntry(d->configToolTipsShowAlbumTitleEntry, true);
d->tooltipShowAlbumDate = group.readEntry(d->configToolTipsShowAlbumDateEntry, true);
d->tooltipShowAlbumCollection = group.readEntry(d->configToolTipsShowAlbumCollectionEntry, true);
d->tooltipShowAlbumCategory = group.readEntry(d->configToolTipsShowAlbumCategoryEntry, true);
d->tooltipShowAlbumCaption = group.readEntry(d->configToolTipsShowAlbumCaptionEntry, true);
d->tooltipShowAlbumPreview = group.readEntry(d->configToolTipsShowAlbumPreviewEntry, false);
if (group.readEntry(d->configPreviewLoadFullImageSizeEntry, true))
{
d->previewSettings.quality = PreviewSettings::HighQualityPreview;
if (group.readEntry(d->configPreviewRawUseEmbeddedPreview, false))
{
d->previewSettings.rawLoading = PreviewSettings::RawPreviewFromEmbeddedPreview;
}
//.........这里部分代码省略.........
示例7: initSettings
bool
QMakeProperty::exec()
{
bool ret = true;
if(Option::qmake_mode == Option::QMAKE_QUERY_PROPERTY) {
if(Option::prop::properties.isEmpty()) {
initSettings();
settings->beginGroup(keyBase(false));
QStringList subs = settings->childGroups();
settings->endGroup();
subs.sort();
for(int x = subs.count() - 1; x >= 0; x--) {
QString s = subs[x];
if(s.isEmpty())
continue;
settings->beginGroup(keyBase(false) + s);
QStringList keys = settings->childKeys();
settings->endGroup();
for(QStringList::ConstIterator it2 = keys.begin(); it2 != keys.end(); it2++) {
QString ret = settings->value(keyBase(false) + s + "/" + (*it2)).toString();
if(s != qmake_version())
fprintf(stdout, "%s/", s.toLatin1().constData());
fprintf(stdout, "%s:%s\n", (*it2).toLatin1().constData(), ret.toLatin1().constData());
}
}
QStringList specialProps;
specialProps.append("QT_INSTALL_PREFIX");
specialProps.append("QT_INSTALL_DATA");
specialProps.append("QT_INSTALL_DOCS");
specialProps.append("QT_INSTALL_HEADERS");
specialProps.append("QT_INSTALL_LIBS");
specialProps.append("QT_INSTALL_BINS");
specialProps.append("QT_INSTALL_PLUGINS");
specialProps.append("QT_INSTALL_IMPORTS");
specialProps.append("QT_INSTALL_TRANSLATIONS");
specialProps.append("QT_INSTALL_CONFIGURATION");
specialProps.append("QT_INSTALL_EXAMPLES");
specialProps.append("QT_INSTALL_DEMOS");
specialProps.append("QMAKE_MKSPECS");
specialProps.append("QMAKE_VERSION");
#ifdef QT_VERSION_STR
specialProps.append("QT_VERSION");
#endif
foreach (QString prop, specialProps)
fprintf(stdout, "%s:%s\n", prop.toLatin1().constData(), value(prop).toLatin1().constData());
return true;
}
for(QStringList::ConstIterator it = Option::prop::properties.begin();
it != Option::prop::properties.end(); it++) {
if(Option::prop::properties.count() > 1)
fprintf(stdout, "%s:", (*it).toLatin1().constData());
if(!hasValue((*it))) {
ret = false;
fprintf(stdout, "**Unknown**\n");
} else {
fprintf(stdout, "%s\n", value((*it)).toLatin1().constData());
}
}
} else if(Option::qmake_mode == Option::QMAKE_SET_PROPERTY) {
for(QStringList::ConstIterator it = Option::prop::properties.begin();
it != Option::prop::properties.end(); it++) {
QString var = (*it);
it++;
if(it == Option::prop::properties.end()) {
ret = false;
break;
}
if(!var.startsWith("."))
setValue(var, (*it));
}
} else if(Option::qmake_mode == Option::QMAKE_UNSET_PROPERTY) {
for(QStringList::ConstIterator it = Option::prop::properties.begin();
it != Option::prop::properties.end(); it++) {
QString var = (*it);
if(!var.startsWith("."))
remove(var);
}
}
return ret;
}
示例8: listValuesFromNode
QStringList Attribute::listValuesFromNode(const QDomElement &m_node)
{
QStringList result;
if (m_references.size() == 0) {
// Parse the content of the attribute
QDomElement content = m_node.firstChildElement();
if ((content.tagName() == "choice") && (m_name != "style:text-emphasize")) {
QDomElement valueChild = content.firstChildElement();
do {
if (valueChild.tagName() == "value") {
result << valueChild.text();
} else if (valueChild.tagName() == "ref") {
m_references << valueChild.attribute("name");
} else if (valueChild.tagName() == "list") {
// Parse that sublist
if (valueChild.childNodes().length() != 1) {
kFatal() << "Unrecognized list element in " << m_name;
}
QDomElement subElement = valueChild.firstChildElement();
if (subElement.nodeName() == "oneOrMore") {
// Build a list of each sub item
QStringList allowedValues;
QDomElement subChoices = subElement.firstChildElement();
if (subChoices.nodeName() != "choice") {
kFatal() << "Unrecognized oneOrMore element in " << m_name;
}
QDomElement subValueChild = subChoices.firstChildElement();
do {
if (subValueChild.nodeName() == "value") {
allowedValues << subValueChild.text();
} else {
kFatal() << "Unrecognized oneOrMore element in " << m_name;
}
subValueChild = subValueChild.nextSiblingElement();
} while (!subValueChild.isNull());
QStringList mergedAllowedValues;
while (mergedAllowedValues.length() != (pow((double) allowedValues.length(), allowedValues.length()))) {
foreach (QString baseValue, allowedValues) {
if (!mergedAllowedValues.contains(baseValue))
mergedAllowedValues << baseValue;
foreach (QString knownValue, mergedAllowedValues) {
if ((knownValue == baseValue) || (knownValue.contains(baseValue + ' ')) || (knownValue.contains(' ' + baseValue))) {
continue;
}
QString builtValue = knownValue + ' ' + baseValue;
if (!mergedAllowedValues.contains(builtValue))
mergedAllowedValues << builtValue;
}
}
}
foreach (QString allowedValue, mergedAllowedValues) {
QStringList equivalenceList;
equivalenceList << allowedValue;
QStringList currentList = allowedValue.split(' ');
currentList.sort();
foreach (QString otherAllowedValue, mergedAllowedValues) {
if (otherAllowedValue == allowedValue)
continue;
QStringList otherList = otherAllowedValue.split(' ');
otherList.sort();
if (otherList == currentList)
equivalenceList << otherAllowedValue;
}
equivalenceList.sort();
if (!m_equivalences.contains(equivalenceList))
m_equivalences << equivalenceList;
}
result << mergedAllowedValues;
}
} else {
示例9: file
bool
DspMakefileGenerator::writeDspParts(QTextStream &t)
{
QString dspfile;
if ( !project->variables()["DSP_TEMPLATE"].isEmpty() ) {
dspfile = project->first("DSP_TEMPLATE");
} else {
dspfile = project->first("MSVCDSP_TEMPLATE");
}
if (dspfile.startsWith("\"") && dspfile.endsWith("\""))
dspfile = dspfile.mid(1, dspfile.length() - 2);
QString dspfile_loc = findTemplate(dspfile);
QFile file(dspfile_loc);
if(!file.open(IO_ReadOnly)) {
fprintf(stderr, "Cannot open dsp file: %s\n", dspfile.latin1());
return FALSE;
}
QTextStream dsp(&file);
QString platform = "Win32";
if ( !project->variables()["QMAKE_PLATFORM"].isEmpty() )
platform = varGlue("QMAKE_PLATFORM", "", " ", "");
// Setup PCH variables
precompH = project->first("PRECOMPILED_HEADER");
QString namePCH = QFileInfo(precompH).fileName();
usePCH = !precompH.isEmpty() && project->isActiveConfig("precompile_header");
if (usePCH) {
// Created files
QString origTarget = project->first("QMAKE_ORIG_TARGET");
origTarget.replace(QRegExp("-"), "_");
precompObj = "\"$(IntDir)\\" + origTarget + Option::obj_ext + "\"";
precompPch = "\"$(IntDir)\\" + origTarget + ".pch\"";
// Add PRECOMPILED_HEADER to HEADERS
if (!project->variables()["HEADERS"].contains(precompH))
project->variables()["HEADERS"] += precompH;
// Add precompile compiler options
project->variables()["PRECOMPILED_FLAGS_REL"] = "/Yu\"" + namePCH + "\" /FI\"" + namePCH + "\" ";
project->variables()["PRECOMPILED_FLAGS_DEB"] = "/Yu\"" + namePCH + "\" /FI\"" + namePCH + "\" ";
// Return to variable pool
project->variables()["PRECOMPILED_OBJECT"] = precompObj;
project->variables()["PRECOMPILED_PCH"] = precompPch;
}
int rep;
QString line;
while ( !dsp.eof() ) {
line = dsp.readLine();
while((rep = line.find(QRegExp("\\$\\$[a-zA-Z0-9_-]*"))) != -1) {
QString torep = line.mid(rep, line.find(QRegExp("[^\\$a-zA-Z0-9_-]"), rep) - rep);
QString variable = torep.right(torep.length()-2);
t << line.left(rep); //output the left side
line = line.right(line.length() - (rep + torep.length())); //now past the variable
if(variable == "MSVCDSP_SOURCES") {
if(project->variables()["SOURCES"].isEmpty())
continue;
QString mocpath = var( "QMAKE_MOC" );
mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " ";
QStringList list = project->variables()["SOURCES"] + project->variables()["DEF_FILE"];
if(!project->isActiveConfig("flat"))
list.sort();
QStringList::Iterator it;
for( it = list.begin(); it != list.end(); ++it) {
beginGroupForFile((*it), t);
t << "# Begin Source File\n\nSOURCE=" << (*it) << endl;
if (usePCH && (*it).endsWith(".c"))
t << "# SUBTRACT CPP /FI\"" << namePCH << "\" /Yu\"" << namePCH << "\" /Fp" << endl;
if ( project->isActiveConfig("moc") && (*it).endsWith(Option::cpp_moc_ext)) {
QString base = (*it);
base.replace(QRegExp("\\..*$"), "").upper();
base.replace(QRegExp("[^a-zA-Z]"), "_");
QString build = "\n\n# Begin Custom Build - Moc'ing " + findMocSource((*it)) +
"...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + (*it) + "\""
" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n"
"\t" + mocpath + findMocSource((*it)) + " -o " +
(*it) + "\n\n" "# End Custom Build\n\n";
t << "USERDEP_" << base << "=\".\\" << findMocSource((*it)) << "\" \"$(QTDIR)\\bin\\moc.exe\"" << endl << endl;
t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build
<< "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\""
<< build << "!ENDIF " << endl << endl;
}
t << "# End Source File" << endl;
}
endGroups(t);
} else if(variable == "MSVCDSP_IMAGES") {
if(project->variables()["IMAGES"].isEmpty())
continue;
t << "# Begin Source File\n\nSOURCE=" << project->first("QMAKE_IMAGE_COLLECTION") << endl;
t << "# End Source File" << endl;
} else if(variable == "MSVCDSP_HEADERS") {
if(project->variables()["HEADERS"].isEmpty())
continue;
QStringList list = project->variables()["HEADERS"];
//.........这里部分代码省略.........
示例10: scanDir
/**
* @brief Scans the given path for concert files.
* Results are in a list which contains a QStringList for every concert.
* @param startPath Scanning started at this path
* @param path Path to scan
* @param contents List of contents
* @param separateFolders Are concerts in separate folders
* @param firstScan When this is true, subfolders are scanned, regardless of separateFolders
*/
void ConcertFileSearcher::scanDir(QString startPath, QString path, QList<QStringList> &contents, bool separateFolders, bool firstScan)
{
emit currentDir(path.mid(startPath.length()));
QDir dir(path);
foreach (const QString &cDir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
if (m_aborted)
return;
// Skip "Extras" folder
if (QString::compare(cDir, "Extras", Qt::CaseInsensitive) == 0 ||
QString::compare(cDir, ".actors", Qt::CaseInsensitive) == 0 ||
QString::compare(cDir, "extrafanarts", Qt::CaseInsensitive) == 0)
continue;
// Handle DVD
if (Helper::isDvd(path + QDir::separator() + cDir)) {
contents.append(QStringList() << QDir::toNativeSeparators(path + "/" + cDir + "/VIDEO_TS/VIDEO_TS.IFO"));
continue;
}
// Handle BluRay
if (Helper::isBluRay(path + QDir::separator() + cDir)) {
contents.append(QStringList() << QDir::toNativeSeparators(path + "/" + cDir + "/BDMV/index.bdmv"));
continue;
}
// Don't scan subfolders when separate folders is checked
if (!separateFolders || firstScan)
scanDir(startPath, path + "/" + cDir, contents, separateFolders);
}
QStringList files;
QStringList entries = getFiles(path);
foreach (const QString &file, entries) {
if (m_aborted)
return;
// Skip Trailers and Sample files
if (file.contains("-trailer", Qt::CaseInsensitive) || file.contains("-sample", Qt::CaseInsensitive))
continue;
files.append(file);
}
files.sort();
if (separateFolders) {
QStringList concertFiles;
foreach (const QString &file, files)
concertFiles.append(QDir::toNativeSeparators(path + "/" + file));
if (concertFiles.count() > 0)
contents.append(concertFiles);
return;
}
QRegExp rx("((part|cd)[\\s_]*)(\\d+)", Qt::CaseInsensitive);
for (int i=0, n=files.size() ; i<n ; i++) {
if (m_aborted)
return;
QStringList concertFiles;
QString file = files.at(i);
if (file.isEmpty())
continue;
concertFiles << QDir::toNativeSeparators(path + QDir::separator() + file);
int pos = rx.indexIn(file);
if (pos != -1) {
QString left = file.left(pos) + rx.cap(1);
QString right = file.mid(pos+rx.cap(1).size()+rx.cap(2).size());
for (int x=0 ; x<n ; x++) {
QString subFile = files.at(x);
if (subFile != file) {
if (subFile.startsWith(left) && subFile.endsWith(right)) {
concertFiles << QDir::toNativeSeparators(path + QDir::separator() + subFile);
files[x] = ""; // set an empty file name, this way we can skip this file in the main loop
}
}
}
}
if (concertFiles.count() > 0 )
contents.append(concertFiles);
}
}
示例11: status
void CliApplication::status() const
{
// Output the status of all the plugins that should (have) normally be(en)
// loaded, so first make sure that we have at least one of them
if (mPluginManager->loadedPlugins().isEmpty()) {
std::cout << "No plugins could be found." << std::endl;
return;
}
// First, we retrieve all the plugins information
QStringList pluginsInfo = QStringList();
for (auto plugin : mPluginManager->plugins()) {
// Retrieve the plugin and its status
QString pluginInfo = plugin->name()+": ";
// Retrieve the plugin's status
switch (plugin->status()) {
case Plugin::Status::NotWanted:
pluginInfo += "the plugin is not wanted.";
break;
case Plugin::Status::NotNeeded:
pluginInfo += "the plugin is not needed.";
break;
case Plugin::Status::Loaded:
pluginInfo += "the plugin is loaded and fully functional.";
break;
case Plugin::Status::NotLoaded:
pluginInfo += QString("the plugin could not be loaded due to the following problem: %1.").arg(formatMessage(plugin->statusErrors()));
break;
case Plugin::Status::NotPlugin:
pluginInfo += "this is not a plugin.";
break;
case Plugin::Status::OldPlugin:
pluginInfo += "the plugin could not be loaded (one or several of the interfaces it supports are too old).";
break;
case Plugin::Status::NotCorePlugin:
pluginInfo += "the plugin claims to be the core plugin, but it is not.";
break;
case Plugin::Status::InvalidCorePlugin:
pluginInfo += "the plugin should be the core plugin, but it does not support the core interface.";
break;
case Plugin::Status::NotCliPluginNoCliSupport:
pluginInfo += "the plugin supports the CLI interface, but it does not claim to be CLI-capable.";
break;
case Plugin::Status::NotCliPluginNoCliInterface:
pluginInfo += "the plugin claims to be CLI-capable, but it does not support the CLI interface.";
break;
case Plugin::Status::MissingOrInvalidDependencies:
if (plugin->statusErrorsCount() == 1) {
pluginInfo += QString("the plugin could not be loaded due to the %1 plugin being missing or invalid.").arg(plugin->statusErrors());
} else {
pluginInfo += QString("the plugin could not be loaded due to missing or invalid plugins:\n%1").arg(plugin->statusErrors());
}
break;
}
// Add the plugin information to our list
pluginsInfo << pluginInfo;
}
// Now, we can output the plugin information in alphabetical order
pluginsInfo.sort(Qt::CaseInsensitive);
if (pluginsInfo.count() == 1) {
std::cout << "The following plugin is available:" << std::endl;
} else {
std::cout << "The following plugins are available:" << std::endl;
}
for (const auto &pluginInfo : pluginsInfo) {
std::cout << " - " << pluginInfo.toStdString() << std::endl;
}
}
示例12: addNode
void BranchesTree::addNode(ItemType headerType, Reference::Type type)
{
// получаем нужную инфу по типу
QStringList tempList = g->getAllRefNames(type, !Git::optOnlyLoaded);
// делаем хедер и добавляем на верхний уровень
BranchesTreeItem *node;
switch (headerType) {
case (BranchesTree::HeaderBranches):
node = new BranchesTreeItem(this, QStringList("Branches"), headerType);
break;
case (BranchesTree::HeaderRemotes):
node = new BranchesTreeItem(this, QStringList("Remotes"), headerType);
break;
case (BranchesTree::HeaderTags):
node = new BranchesTreeItem(this, QStringList("Tags"), headerType);
break;
default:
break;
}
tempList.sort();
QFont font = node->font(0);
font.setBold(true);
node->setFont(0, font);
addTopLevelItem(node);
BranchesTreeItem *tempItemList;
// заполняем дерево потомками
FOREACH_SL (it, tempList) {
bool isCurrent = (g->currentBranch().compare(*it) == 0);
switch (headerType) {
case (HeaderBranches):
tempItemList = new BranchesTreeItem(node, QStringList(QString(*it)), LeafBranch);
if (isCurrent) {
QFont font = tempItemList->font(0);
font.setBold(true);
tempItemList->setFont(0, font);
tempItemList->setForeground(0, Qt::red);
}
tempItemList->setIcon(0, branchIcon);
if (*it == "master") {
tempItemList->setIcon(0, masterBranchIcon);
}
break;
case (HeaderRemotes):
tempItemList = new BranchesTreeItem(node, QStringList(QString(*it)), LeafRemote);
tempItemList->setIcon(0, branchIcon);
break;
case (HeaderTags):
tempItemList = new BranchesTreeItem(node, QStringList(QString(*it)), LeafTag);
tempItemList->setIcon(0, tagIcon);
break;
default:
break;
}
tempItemList->setBranch(QString(*it));
}
示例13: setAttributes
void FunctionWidget::setAttributes(DatabaseModel *model, OperationList *op_list, Schema *schema, Function *func)
{
vector<BaseObject *> languages;
Language *lang=nullptr;
QStringList list;
unsigned count=0, i;
Parameter param;
PgSQLType aux_type;
connect(parameter_wgt, SIGNAL(finished(int)), this, SLOT(handleParameter(int)));
BaseObjectWidget::setAttributes(model, op_list, func, schema);
languages=model->getObjects(OBJ_LANGUAGE);
while(!languages.empty())
{
lang=dynamic_cast<Language *>(languages.back());
languages.pop_back();
list.append(lang->getName());
}
list.sort();
language_cmb->addItems(list);
if(func)
{
aux_type=func->getReturnType();
language_cmb->setCurrentIndex(language_cmb->findText(func->getLanguage()->getName()));
func_type_cmb->setCurrentIndex(func_type_cmb->findText(~func->getFunctionType()));
window_func_chk->setChecked(func->isWindowFunction());
leakproof_chk->setChecked(func->isLeakProof());
exec_cost_spb->setValue(func->getExecutionCost());
rows_ret_spb->setValue(func->getRowAmount());
behavior_cmb->setCurrentIndex(behavior_cmb->findText(~func->getBehaviorType()));
security_cmb->setCurrentIndex(security_cmb->findText(~func->getSecurityType()));
if(func->isReturnSetOf())
set_rb->setChecked(true);
else if(func->isReturnTable())
table_rb->setChecked(true);
else
simple_rb->setChecked(true);
count=func->getParameterCount();
parameters_tab->blockSignals(true);
return_tab->blockSignals(true);
for(i=0; i < count; i++)
{
parameters_tab->addRow();
param=func->getParameter(i);
showParameterData(param,parameters_tab,i);
}
parameters_tab->clearSelection();
count=func->getReturnedTableColumnCount();
if(count > 0)
{
ret_table_gb->setVisible(true);
ret_type->setVisible(false);
for(i=0; i < count; i++)
{
return_tab->addRow();
param=func->getReturnedTableColumn(i);
showParameterData(param,return_tab,i);
}
}
return_tab->clearSelection();
if(!func->getLibrary().isEmpty())
{
symbol_edt->setText(func->getSymbol());
library_edt->setText(func->getLibrary());
}
else
{
source_code_txt->setPlainText(Utf8String::create(func->getSourceCode()));
}
parameters_tab->blockSignals(false);
return_tab->blockSignals(false);
}
ret_type->setAttributes(aux_type, model);
}
示例14: getReport
QString SettingsManager::getReport()
{
QString report;
QTextStream stream(&report);
stream.setFieldAlignment(QTextStream::AlignLeft);
stream << QLatin1String("Settings:\n");
QStringList excludeValues;
QSettings defaults(QLatin1String(":/schemas/options.ini"), QSettings::IniFormat);
const QStringList defaultsGroups = defaults.childGroups();
for (int i = 0; i < defaultsGroups.count(); ++i)
{
defaults.beginGroup(defaultsGroups.at(i));
const QStringList keys = defaults.childGroups();
for (int j = 0; j < keys.count(); ++j)
{
const QString type = defaults.value(QStringLiteral("%1/type").arg(keys.at(j))).toString();
if (type == QLatin1String("string") || type == QLatin1String("path"))
{
excludeValues.append(QStringLiteral("%1/%2").arg(defaultsGroups.at(i)).arg(keys.at(j)));
}
}
defaults.endGroup();
}
QHash<QString, int> overridenValues;
QSettings overrides(m_overridePath, QSettings::IniFormat);
const QStringList overridesGroups = overrides.childGroups();
for (int i = 0; i < overridesGroups.count(); ++i)
{
overrides.beginGroup(overridesGroups.at(i));
const QStringList keys = overrides.allKeys();
for (int j = 0; j < keys.count(); ++j)
{
if (overridenValues.contains(keys.at(j)))
{
++overridenValues[keys.at(j)];
}
else
{
overridenValues[keys.at(j)] = 1;
}
}
overrides.endGroup();
}
QStringList keys = m_defaults.keys();
keys.sort();
for (int i = 0; i < keys.count(); ++i)
{
stream << QLatin1Char('\t');
stream.setFieldWidth(50);
stream << keys.at(i);
stream.setFieldWidth(20);
if (excludeValues.contains(keys.at(i)))
{
stream << QLatin1Char('-');
}
else
{
stream << m_defaults[keys.at(i)].toString();
}
stream << ((m_defaults[keys.at(i)] == getValue(keys.at(i))) ? QLatin1String("default") : QLatin1String("non default"));
stream << (overridenValues.contains(keys.at(i)) ? QStringLiteral("%1 override(s)").arg(overridenValues[keys.at(i)]) : QLatin1String("no overrides"));
stream.setFieldWidth(0);
stream << QLatin1Char('\n');
}
stream << QLatin1Char('\n');
return report;
}
示例15: compareToImportFrom
// Returns true if both are equal.
QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportFrom(const QString &makefile)
{
QMakeStep *qs = qmakeStep();
if (QFileInfo(makefile).exists() && qs) {
FileName qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(makefile);
BaseQtVersion *version = QtKitInformation::qtVersion(target()->kit());
if (!version)
return MakefileForWrongProject;
if (QtSupport::QtVersionManager::makefileIsFor(makefile, qs->project()->projectFilePath().toString())
!= QtSupport::QtVersionManager::SameProject) {
if (debug) {
qDebug() << "different profile used to generate the Makefile:"
<< makefile << " expected profile:" << qs->project()->projectFilePath();
}
return MakefileIncompatible;
}
if (version->qmakeCommand() == qmakePath) {
// same qtversion
QPair<BaseQtVersion::QmakeBuildConfigs, QString> result =
QtVersionManager::scanMakeFile(makefile, version->defaultBuildConfig());
if (qmakeBuildConfiguration() == result.first) {
// The qmake Build Configuration are the same,
// now compare arguments lists
// we have to compare without the spec/platform cmd argument
// and compare that on its own
QString workingDirectory = QFileInfo(makefile).absolutePath();
QStringList actualArgs;
QString userArgs = qs->userArguments();
// This copies the settings from userArgs to actualArgs (minus some we
// are not interested in), splitting them up into individual strings:
extractSpecFromArguments(&userArgs, workingDirectory, version, &actualArgs);
actualArgs = qs->deducedArguments() + actualArgs + qs->deducedArgumentsAfter();
FileName actualSpec = qs->mkspec();
QString qmakeArgs = result.second;
QStringList parsedArgs;
FileName parsedSpec = extractSpecFromArguments(&qmakeArgs, workingDirectory, version, &parsedArgs);
if (debug) {
qDebug() << "Actual args:" << actualArgs;
qDebug() << "Parsed args:" << parsedArgs;
qDebug() << "Actual spec:" << actualSpec.toString();
qDebug() << "Parsed spec:" << parsedSpec.toString();
}
// Comparing the sorted list is obviously wrong
// Though haven written a more complete version
// that managed had around 200 lines and yet faild
// to be actually foolproof at all, I think it's
// not feasible without actually taking the qmake
// command line parsing code
// Things, sorting gets wrong:
// parameters to positional parameters matter
// e.g. -o -spec is different from -spec -o
// -o 1 -spec 2 is diffrent from -spec 1 -o 2
// variable assignment order matters
// variable assignment vs -after
// -norecursive vs. recursive
actualArgs.sort();
parsedArgs.sort();
if (actualArgs == parsedArgs) {
// Specs match exactly
if (actualSpec == parsedSpec)
return MakefileMatches;
// Actual spec is the default one
// qDebug() << "AS vs VS" << actualSpec << version->mkspec();
if ((actualSpec == version->mkspec() || actualSpec == FileName::fromLatin1("default"))
&& (parsedSpec == version->mkspec() || parsedSpec == FileName::fromLatin1("default") || parsedSpec.isEmpty()))
return MakefileMatches;
}
return MakefileIncompatible;
} else {
if (debug)
qDebug() << "different qmake buildconfigurations buildconfiguration:"
<< qmakeBuildConfiguration() << " Makefile:" << result.first;
return MakefileIncompatible;
}
} else {
if (debug)
qDebug() << "different Qt versions, buildconfiguration:" << version->qmakeCommand().toString()
<< " Makefile:"<< qmakePath.toString();
return MakefileForWrongProject;
}
}
return MakefileMissing;
}