当前位置: 首页>>代码示例>>C++>>正文


C++ QStringList::takeLast方法代码示例

本文整理汇总了C++中QStringList::takeLast方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringList::takeLast方法的具体用法?C++ QStringList::takeLast怎么用?C++ QStringList::takeLast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QStringList的用法示例。


在下文中一共展示了QStringList::takeLast方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Connection

Connection::Connection(QString uri, QObject *parent) :
    Connection(parent)
{
    uri.remove(0, 5);//remove the prefix "ss://" from uri
    QStringList resultList = QString(QByteArray::fromBase64(QByteArray(uri.toStdString().c_str()))).split(':');
    profile.method = resultList.takeFirst().toUpper();
    profile.serverPort = resultList.takeLast().toUShort();
    QStringList ser = resultList.join(':').split('@');//there are lots of ':' in IPv6 address
    profile.serverAddress = ser.takeLast();
    profile.password = ser.join('@');//incase there is a '@' in password
}
开发者ID:rubyrubyruby,项目名称:shadowsocks-qt5,代码行数:11,代码来源:connection.cpp

示例2: findObject

 QObject* Utils::findObject(const QString& path)
 {
     const QString separator("::");
     QStringList parts = path.split(separator);
     if (parts.isEmpty())
     {
         return NULL;
     }
     const QString name = parts.takeLast();
     const QObject * parent = NULL;
     if (parts.isEmpty())
     {
         {
             const QString childObjectName = Utils::objectName(Application::instance());
             if (childObjectName == name)
             {
                 return Application::instance();
             }
         }
         // Top level widget
         Q_FOREACH(QObject * const object, Application::instance()->children())
         {
             const QString childObjectName = Utils::objectName(object);
             if (childObjectName == name)
             {
                 return object;
             }
         }
         return NULL;
     }
开发者ID:setiawand,项目名称:labs-truphone-cascades-test,代码行数:30,代码来源:Utils.cpp

示例3: readStdout

void OcaOctaveController::readStdout()
{
  char buf[ 1024 ];
  //fprintf( stderr, "OcaOctaveController::readStdout $$$ %d (%d)\n", result, m_pipeFd );
  int result = -1;
  do {
    result = read( m_pipeFd, buf, 1023 );
    if( 0 < result ) {
      //fprintf( stderr, "OcaOctaveController::readStdout\n" );
      //fwrite( buf, 1, result, stderr );
      //fprintf( stderr, "OcaOctaveController::readStdout - END\n" );
      buf[ result ] = 0;

      m_stdoutBuf += QString::fromLocal8Bit( buf );
      QStringList lines = m_stdoutBuf.split( '\n' );
      m_stdoutBuf = lines.takeLast();
      //Q_ASSERT( ! lines.isEmpty() );
      /*
      if( '\n' != m_stdoutBuf[ m_stdoutBuf.length() - 1 ] ) {
        m_stdoutBuf = lines.takeLast();
      }
      else {
        m_stdoutBuf.clear();
        QString s = lines.takeLast();
        Q_ASSERT( s.isEmpty() );
      }
      */
      while( ! lines.isEmpty() ) {
        QString s = lines.takeFirst();
        //fprintf( stderr, "readStdout: %s\n", s.toLocal8Bit().data() );
        emit outputReceived( s, 0 );
      }
    }
  } while( ( 1023 == result ) && ( e_StateReady == m_state ) );
}
开发者ID:antonrunov,项目名称:octaudio,代码行数:35,代码来源:OcaOctaveController.cpp

示例4: testString

 void testString(const QString &message)
 {
     qDebug() << Utils::normalizeMarkup(message, Utils::NoMarkup);
     SnoreCore &snore = SnoreCore::instance();
     QStringList backends = snore.pluginNames(SnorePlugin::Backend);
     auto notify = [&backends, &snore, &message, this](Notification n) {
         qDebug() << n << "closed";
         qDebug() << backends.size();
         if (backends.empty()) {
             return;
         }
         QString old = snore.primaryNotificationBackend();
         while (snore.primaryNotificationBackend() == old) {
             QString p = backends.takeLast();
             snore.setSettingsValue(QStringLiteral("PrimaryBackend"), p, LocalSetting);
             SnoreCorePrivate::instance()->syncSettings();
             if (snore.primaryNotificationBackend() == p) {
                 qDebug() << p;
                 snore.broadcastNotification(Notification(app, app.defaultAlert(), QStringLiteral("Title"), message, app.icon()));
             }
         }
     };
     auto con = connect(&snore, &SnoreCore::notificationClosed, notify);
     notify(Notification());
     while (!backends.empty()) {
         QTest::qWait(100);
     }
     QTest::qWait(100);
     disconnect(con);
 }
开发者ID:G-VAR,项目名称:snorenotify,代码行数:30,代码来源:display_test.cpp

示例5: configuraAmbienteROS

void AmbienteExternoROSBridge::configuraAmbienteROS()
{
    bool ok;
    QString endereco = QInputDialog::getText(0x0, QString("Configuracao ROSBridge"), QString("Endereco:"), QLineEdit::Normal, "ws://localhost:9090", &ok);
    endereco = endereco.trimmed();
    if (ok && !endereco.isEmpty())
    {
        string ip;
        int porta;
        if (endereco.contains(QRegExp(QLatin1String(":([0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{1,4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$"))))
        {
            QStringList splitted = endereco.split(':');
            porta = splitted.takeLast().toUInt();
            ip = splitted.join(":").toStdString();
        }
        else
        {
            ip = endereco.toStdString();
            porta = 80;
        }
        cout << "IP: " << ip << " porta " << porta << endl;

        m_ros.conecta(ip, porta);
    }
}
开发者ID:matheusbg8,项目名称:RedePetri,代码行数:25,代码来源:AmbienteExternoROSBridge.cpp

示例6: tr

void
RestStateWidget::updatePlayerNames()
{
#ifdef WIN32
    QStringList plugins = The::settings().allPlugins( false );
    plugins.removeAll( "" );

    if ( plugins.count() )
    {
        QString last_plugin = plugins.takeLast();

        if ( plugins.count() )
        {
            QString text = tr( "or listen to your music in %1 or %2.",
                    "%1 is a list of plugins, eg. 'Foobar, Winamp, Windows Media Player'" );

            ui.label2->setText( text.arg( plugins.join( ", " ) ).arg( last_plugin ) );
        }
        else
            ui.label2->setText( tr( "or listen to your music in %1.", "%1 is a media player" ).arg( last_plugin ) );
    }
    else
        ui.label2->setText( tr( "or install a player plugin to scrobble music from your media player." ) );
#endif
}
开发者ID:RJ,项目名称:lastfm-desktop,代码行数:25,代码来源:RestStateWidget.cpp

示例7: newMessage

void Server::newMessage()
{
    if(QTcpSocket *c = dynamic_cast<QTcpSocket*> (sender())) {
        data[c].append(c->readAll());
        if(!data[c].contains(QChar(23)))
            return;
        QStringList l = data[c].split(QChar(23));
        data[c] = l.takeLast();
        foreach(QString s, l) {
            string sss = s.toStdString();
            stringstream ss(sss);
            int a;
            ss >> a;
            if(a == 2 || a == 5 || a == 12) {
                s.append(QChar(23));
                c1->write(s.toLocal8Bit());
                c2->write(s.toLocal8Bit());
            }
            else if(a == 7) { //team selection
                if(num == 1 && t1 == "n") {
                    string str;
                    ss >> str;
                    t1 = QString::fromStdString(str);
                    QString s = "11";
                    s.append(QChar(23));
                    c1->write(s.toLocal8Bit());
                }
                else if(num == 2) {
开发者ID:AmirHo3ein13,项目名称:AP_FinalProject,代码行数:28,代码来源:server.cpp

示例8: traffic

QStringList CSite::traffic(quint16 &busy) const {
    QStringList zeeiList = m_zeei.split("\n");
    QStringList btsList = zeeiList.filter("BTS-");

    busy = 0;
    QStringList btss;

    for (int i = 0; i < btsList.count(); i++) {
        QStringList btsLine = btsList[i].split(" ");
        btsLine.removeAll("");

        QString state = btsLine[btsLine.indexOf(btsLine.filter("BTS-").first()) + 2];
        if (state.contains("BL-")) {
            btss << state;
            continue;
        }

        QString fr = btsLine.takeLast();
        QString hr = btsLine.takeLast();

        quint8 btsBusy = fr.toUShort() + hr.toUShort();

        if (!btsBusy)
            btss << "EMPTY";
        else if (i < m_caps.count() && btsBusy > m_caps[i] - BUSY_LIMIT)
            btss << "FULL";
        else
            btss << QString::number(btsBusy);

        busy += btsBusy;
    }

    return btss;
}
开发者ID:jmodares,项目名称:BTSMon,代码行数:34,代码来源:Site.cpp

示例9: parseLinksFile

/*!
* parse a text file and return a links list in html format:
* left the names and right the contact address
* the html table can be "split" in sections
* @param QString fileName the file to be parsed
* @return QString the html table
*/
QString About::parseLinksFile(QString fileName)
{
	QString result;
	QString file;
	QFile linksFile(fileName);
	if (linksFile.open(QIODevice::ReadOnly | QIODevice::Text))
	{
		QTextStream inTS(&linksFile);
		inTS.setCodec("UTF-8");
		inTS.setAutoDetectUnicode(true);
		QString lineTS;
		bool isTitle = true;
		result = "<table>";
		while (!inTS.atEnd())
		{
			lineTS = inTS.readLine();
			// convert (r) "�" to &#174, "�" to &#8482
			// lineTS = QString::fromUtf8(lineTS);
			lineTS.replace("<", "&lt;");
			lineTS.replace(">", "&gt;");
			lineTS.replace("�", "&#174;");
			lineTS.replace("�", "&#8482;");
			if (!lineTS.isEmpty())
			{
				if (isTitle)
				{
					isTitle = false;
					result += "<tr><td><b>"+About::trLinksTitle(lineTS)+"</b></td></tr>";

				} // if is title
				else
				{
					result += "<tr><td><a href=\""+lineTS+"\">"+lineTS+"</a></td></tr>";
				} // else is title
			} // if is empty line
			else
			{
				// empty lines switch to title (one line)
			  result += "<tr><td></td></tr>";
			  isTitle = true;
			} // else is empty line
		} // while ! atEnd
		result += "<table>";
	} // if file found
	else
	{
		if (!fileName.isEmpty())
		{
			QStringList field = fileName.split("/");
			if (!field.isEmpty())
			{
				file = field.takeLast();
			}
		}
		result = tr("Unable to open %1 file. Please check your install directory or the Scribus website for %1 information.").arg(file);
		result = "";
	} // else file found
	return result;
} // parseLinksFile()
开发者ID:Fahad-Alsaidi,项目名称:scribus,代码行数:66,代码来源:about.cpp

示例10: contentIndexUp

 // FIXME: this should actually be a member function of ContentIndex
 int contentIndexUp( KMime::ContentIndex &index )
 {
   Q_ASSERT( index.isValid() );
   QStringList ids = index.toString().split( QLatin1Char('.') );
   QString lastId = ids.takeLast();
   index = KMime::ContentIndex( ids.join( QLatin1String(".") ) );
   return lastId.toInt();
 }
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:9,代码来源:mimetreemodel.cpp

示例11: notify

	void UpdatesNotificationManager::notify ()
	{
		NotifyScheduled_ = false;

		auto em = Proxy_->GetEntityManager ();

		const auto upgradableCount = UpgradablePackages_.size ();
		QString bodyText;
		if (!upgradableCount)
		{
			auto cancel = Util::MakeANCancel ("org.LeechCraft.LackMan", "org.LeechCraft.LackMan");
			em->HandleEntity (cancel);

			return;
		}
		else if (upgradableCount <= 3)
		{
			QStringList names;
			for (auto id : UpgradablePackages_)
				names << Core::Instance ().GetListPackageInfo (id).Name_;
			names.sort ();

			if (upgradableCount == 1)
				bodyText = tr ("A new version of %1 is available.")
						.arg ("<em>" + names.value (0) + "</em>");
			else
			{
				const auto& lastName = names.takeLast ();
				bodyText = tr ("New versions of %1 and %2 are available.")
						.arg ("<em>" + names.join ("</em>, <em>") + "</em>")
						.arg ("<em>" + lastName + "</em>");
			}
		}
		else
			bodyText = tr ("New versions are available for %n package(s).",
					0, upgradableCount);

		auto entity = Util::MakeAN ("Lackman",
				bodyText,
				PInfo_,
				"org.LeechCraft.LackMan",
				AN::CatPackageManager,
				AN::TypePackageUpdated,
				"org.LeechCraft.LackMan",
				{ "Lackman" },
				0,
				upgradableCount);

		auto nah = new Util::NotificationActionHandler (entity, this);
		nah->AddFunction (tr ("Open LackMan"),
				[this, entity, em] () -> void
				{
					emit openLackmanRequested ();
					em->HandleEntity (Util::MakeANCancel (entity));
				});

		em->HandleEntity (entity);
	}
开发者ID:zhao07,项目名称:leechcraft,代码行数:58,代码来源:updatesnotificationmanager.cpp

示例12: qMin

void
TrackDashboard::onArtistGotTopTags( WsReply* reply )
{
    ui.tags->clear();
    QStringList tags = Tag::list( reply ).values();
    int x = qMin( 8, tags.count() );
    while (x--)
        ui.tags->addItem( tags.takeLast() );
}
开发者ID:AICIDNN,项目名称:lastfm-desktop,代码行数:9,代码来源:TrackDashboard.cpp

示例13: createGccProfile

static Profile createGccProfile(const QString &compilerFilePath, Settings *settings,
                                const QStringList &toolchainTypes,
                                const QString &profileName = QString())
{
    const QString machineName = gccMachineName(compilerFilePath);
    const QStringList compilerTriplet = machineName.split(QLatin1Char('-'));
    const bool isMingw = toolchainTypes.contains(QLatin1String("mingw"));
    const bool isClang = toolchainTypes.contains(QLatin1String("clang"));

    if (isMingw) {
        if (!validMinGWMachines().contains(machineName)) {
            throw ErrorInfo(Tr::tr("Detected gcc platform '%1' is not supported.")
                    .arg(machineName));
        }
    } else if (compilerTriplet.count() < 2) {
        throw qbs::ErrorInfo(Tr::tr("Architecture of compiler for platform '%1' at '%2' not understood.")
                             .arg(machineName, compilerFilePath));
    }

    Profile profile(!profileName.isEmpty() ? profileName : machineName, settings);
    profile.removeProfile();
    if (isMingw) {
        profile.setValue(QLatin1String("qbs.targetOS"), QStringList(QLatin1String("windows")));
    }

    const QString compilerName = QFileInfo(compilerFilePath).fileName();
    QString toolchainPrefix;
    if (compilerName.contains(QLatin1Char('-'))) {
        QStringList nameParts = compilerName.split(QLatin1Char('-'));
        profile.setValue(QLatin1String("cpp.compilerName"), nameParts.takeLast());
        toolchainPrefix = nameParts.join(QLatin1Char('-')) + QLatin1Char('-');
        profile.setValue(QLatin1String("cpp.toolchainPrefix"), toolchainPrefix);
    }
    profile.setValue(QLatin1String("cpp.linkerName"),
                     isClang ? QLatin1String("clang++") : QLatin1String("g++"));
    setCommonProperties(profile, compilerFilePath, toolchainPrefix, toolchainTypes,
                        compilerTriplet.first());

    // Check whether auxiliary tools reside within the toolchain's install path.
    // This might not be the case when using icecc or another compiler wrapper.
    const QString compilerDirPath = QFileInfo(compilerFilePath).absolutePath();
    const ToolPathSetup toolPathSetup(&profile, compilerDirPath, toolchainPrefix);
    toolPathSetup.apply(QLatin1String("ar"), QLatin1String("cpp.archiverPath"));
    toolPathSetup.apply(QLatin1String("nm"), QLatin1String("cpp.nmPath"));
    if (HostOsInfo::isOsxHost())
        toolPathSetup.apply(QLatin1String("dsymutil"), QLatin1String("cpp.dsymutilPath"));
    else
        toolPathSetup.apply(QLatin1String("objcopy"), QLatin1String("cpp.objcopyPath"));
    toolPathSetup.apply(QLatin1String("strip"), QLatin1String("cpp.stripPath"));

    qStdout << Tr::tr("Profile '%1' created for '%2'.").arg(profile.name(), compilerFilePath)
            << endl;
    return profile;
}
开发者ID:AtlantisCD9,项目名称:Qt,代码行数:54,代码来源:probe.cpp

示例14: run

AbstractCommand::ReturnCodes Move::run()
{
    if (! checkInRepository())
        return NotInRepo;
    moveToRoot();
    // Move in git is really remove and add. Git will auto detect that being a move.

    typedef QPair<QString, QString> RenamePair;

    QList<RenamePair> renamePairs;
    QStringList files = rebasedArguments();
    if (files.count() < 2) { // not sure what that would mean...
        Logger::error() << "Vng failed: you must specify at least two arguments for mv\n";
        return InvalidOptions;
    }
    QString target = files.takeLast();
    QFileInfo path(target);
    if (files.count() > 1) { // multiple files into a dir.
        if (! path.isDir()) {
            Logger::error() << "Vng failed:  The target directory '" << target <<
                "` does not seem to be an existing directory\n";
            return InvalidOptions;
        }
    }
    else { // target is a file
        if(File::fileKnownToGit(path)) {
            Logger::error() << "Vng failed: The file named '"<<  target <<
                "` already exists in working directory.\n";
            return InvalidOptions;
        }
    }
    foreach (QString arg, files) {
        if (canMoveFile(arg)) {
            if (files.count() > 1)
                renamePairs.append(qMakePair(arg, target + QDir::separator() + arg));
            else
                renamePairs.append(qMakePair(arg, target));
        }
    }

    if (dryRun())
        return Ok;

    QProcess git;
    QStringList arguments;
    arguments << "update-index" << "--add" << "--remove";
    foreach(RenamePair p, renamePairs) {
        Logger::debug() << "rename " << p.first << " => " << p.second << endl;
        if (QFile::rename(p.first, p.second))
            arguments << p.first << p.second;
        else
            Logger::error() << "Vng failed: Could not rename '" << p.first << "` to '" <<
                    p.second << "`, check permissions\n";
    }
开发者ID:ruphy,项目名称:plasma-studio,代码行数:54,代码来源:Move.cpp

示例15: addFileToRecentlyOpen

void Controller::addFileToRecentlyOpen(QString fileName){
    QStringList recentlyOpen = Settings::getInstance().lastImportedFiles();
    if(recentlyOpen.contains(fileName)){
        recentlyOpen.removeAll(fileName);
    }
    recentlyOpen.prepend(fileName);
    while(recentlyOpen.size() > RECENTLY_OPEN_MAX){
        recentlyOpen.takeLast();
    }
    emit recentlyImportedFilesChanged(recentlyOpen);
    Settings::getInstance().setLastImportedFiles(recentlyOpen);
}
开发者ID:szkudi,项目名称:pca_mbi,代码行数:12,代码来源:controller.cpp


注:本文中的QStringList::takeLast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。