int main(int argc, char *argv[])
{
    QQmlDebuggingEnabler::StartMode block = QQmlDebuggingEnabler::DoNotWaitForClient;
    int portFrom = 0;
    int portTo = 0;

    QCoreApplication app(argc, argv);
    QStringList arguments = app.arguments();
    arguments.removeFirst();

    if (arguments.size() && arguments.first() == QLatin1String("-block")) {
        block = QQmlDebuggingEnabler::WaitForClient;
        arguments.removeFirst();
    }

    if (arguments.size() >= 2) {
        portFrom = arguments.takeFirst().toInt();
        portTo = arguments.takeFirst().toInt();
    }

    if (!portFrom || !portTo)
        qFatal("Port range has to be specified.");

    while (portFrom <= portTo)
        QQmlDebuggingEnabler::startTcpDebugServer(portFrom++, block);
    QQmlEngine engine;
    Q_UNUSED(engine);
    return app.exec();
}
Exemple #2
0
void sJarvisNode::parseEvent(QStringList args)
{
    if(!args.count())return;
    QString component = args.first();
    args.removeFirst();
    if(!args.count())return;
    jarvisEvents event = jarvisEvents(args.first().toInt());
    args.removeFirst();
    emit incomingEvent(component,event,args);
}
int main(int argc, char *argv[]) {
    QCoreApplication app(argc, argv);
    app.setOrganizationName("QDailymotion");
    app.setApplicationName("QDailymotion");
    
    QStringList args = app.arguments();
    
    if (args.size() < 3) {
        qWarning() << "Usage: resources-update RESOURCEPATH RESOURCE";
        return 0;
    }
    
    args.removeFirst();
    
    QString resourcePath = args.takeFirst();
    QVariantMap resource = QtJson::Json::parse(args.takeFirst()).toMap();
    
    QSettings settings;

    QDailymotion::ResourcesRequest request;
    request.setClientId(settings.value("Authentication/clientId").toString());
    request.setClientSecret(settings.value("Authentication/clientSecret").toString());
    request.setAccessToken(settings.value("Authentication/accessToken").toString());
    request.setRefreshToken(settings.value("Authentication/refreshToken").toString());
    request.update(resourcePath, resource);
    QObject::connect(&request, SIGNAL(finished()), &app, SLOT(quit()));

    return app.exec();
}
void UDPServer::supportedDevices(const QString cmd)
{
    QString msg = "10;";
    QMap<QString, int> map;
    QString cmdStr;
    QString methodString;
    qDebug() << "cmd" << cmd;

    QStringList cmdList;
    cmdList = cmd.split(' ');
    cmdList.removeFirst();

    for(int i = 0; i < cmdList.size(); i++)
    {
        int intPos = cmdList[i].size() - 1;
        int number = cmdList[i].toLower().data()[intPos].digitValue();

        cmdStr = cmdList[i].remove(intPos,1);

        map[cmdStr] =  number;
    }

    methodString.append(QString("b %1,").arg(map.value("b", 0)));
    methodString.append(QString("p %1,").arg(map.value("p", 0)));
    methodString.append(QString("v %1").arg(map.value("v", 0)));

    qDebug() << "methodString: " << methodString;

    msg += SupportedDevices::instance()->printDevicesWithString(methodString);

    sendDatagram(msg.toLatin1());
}
static bool startDaemon()
{
    bool success;
    QStringList args = QCoreApplication::arguments();
    args.removeAll("-d");
#ifdef Q_OS_WIN
    PROCESS_INFORMATION pinfo;
    STARTUPINFOW startupInfo = { sizeof(STARTUPINFO), 0, 0, 0,
                                 (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
                                 (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
                                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    };
    success = CreateProcess(0, (wchar_t*)args.join(" ").utf16(),
                            0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT, 0,
                            (wchar_t*)QDir::currentPath().utf16(),
                            &startupInfo, &pinfo);
    if (success) {
        CloseHandle(pinfo.hThread);
        CloseHandle(pinfo.hProcess);
    }
#else
    args.removeFirst();  // Removes the program name
    success = QProcess::startDetached(QCoreApplication::applicationFilePath(), args, QDir::currentPath());
#endif

    return success;
}
void
APIWebService::service(HttpRequest &request, HttpResponse &response)
{
    // remove trailing '/' from request, just to be consistent
    QString fullPath = request.getPath();
    while (fullPath.endsWith("/")) fullPath.chop(1);

    // get the paths
    QStringList paths = QString(request.getPath()).split("/");

    // we need to look at the first path to determine action
    if (paths.count() < 2) return; // impossible really

    // get ride of first blank, all URLs start with a '/'
    paths.removeFirst();

    // ROOT PATH RETURNS A LIST OF ATHLETES
    if (paths[0] == "") {
        listAthletes(response); // return csv list of all athlete and their characteristics
        return;
    }

    // we don't have a fave icon
    if (paths[0] == "favicon.ico") return;

    // Call to retreive athlete data, downstream will resolve
    // which functions to call for different data requests
    athleteData(paths, response);
}
Exemple #7
0
int main(int argc, char *argv[]) {
    QCoreApplication app(argc, argv);
    app.setOrganizationName("QYouTube");
    app.setApplicationName("QYouTube");
    
    QStringList args = app.arguments();
    
    if (args.size() < 4) {
        qWarning() << "Usage: resources-insert RESOURCE RESOURCEPATH PART [PARAMS]";
        return 0;
    }
    
    args.removeFirst();
    
    QVariantMap resource = QtJson::Json::parse(args.takeFirst()).toMap();
    QString resourcePath = args.takeFirst();
    QStringList part = QtJson::Json::parse(args.takeFirst()).toStringList();
    QVariantMap params = args.isEmpty() ? QVariantMap() : QtJson::Json::parse(args.takeFirst()).toMap();

    QSettings settings;

    QYouTube::ResourcesRequest request;
    request.setClientId(settings.value("Authentication/clientId").toString());
    request.setClientSecret(settings.value("Authentication/clientSecret").toString());
    request.setApiKey(settings.value("Authentication/apiKey").toString());
    request.setAccessToken(settings.value("Authentication/accessToken").toString());
    request.setRefreshToken(settings.value("Authentication/refreshToken").toString());
    request.insert(resource, resourcePath, part, params);
    QObject::connect(&request, SIGNAL(finished()), &app, SLOT(quit()));

    return app.exec();
}
Exemple #8
0
void PerforceSubmitEditor::updateFields()
{
    PerforceSubmitEditorWidget *widget = submitEditorWidget();
    widget->setData(m_entries.value(QLatin1String("Change")).trimmed(),
                    m_entries.value(QLatin1String("Client")).trimmed(),
                    m_entries.value(QLatin1String("User")).trimmed());

    const QString newLine = QString(QLatin1Char('\n'));
    QStringList lines = m_entries.value(QLatin1String("Description")).split(newLine);
    lines.removeFirst(); // that is the line break after 'Description:'
    lines.removeLast(); // that is the empty line at the end

    const QRegExp leadingTabPattern = QRegExp(QLatin1String("^\\t"));
    QTC_ASSERT(leadingTabPattern.isValid(), /**/);

    lines.replaceInStrings(leadingTabPattern, QString());
    widget->setDescriptionText(lines.join(newLine));

    lines = m_entries.value(QLatin1String("Files")).split(newLine);
    // split up "file#add" and store complete spec line as user data
    foreach (const QString &specLine, lines) {
        const QStringList list = specLine.split(QLatin1Char('#'));
        if (list.size() == 2) {
            const QString file = list.at(0).trimmed();
            const QString state = list.at(1).trimmed();
            m_fileModel->addFile(file, state).at(0)->setData(specLine, FileSpecRole);
        }
    }
}
WifiInfoParseResult WifiDataParser::parseWifiConnectionsInfo(QString data)
{
    WifiInfoParseResult result;
    QStringList buffer = data.split(linuxDivider, QString::SkipEmptyParts);
    result.connectedIndexes = findAllConnectedIndexes(buffer);
    result.columnNames = buffer.first().split(whitespace, QString::SkipEmptyParts);
    deleteConnectMark(result.columnNames);
    int columnsCount = result.columnNames.length();
    QStringList buff;

    for (int i = 0; i < columnsCount; i++)
        result.params.append(buff);

    for (int i = 0; i < columnsCount; i++)
        result.columnIndexes[result.columnNames[i].toLower()] = i;

    buffer.removeFirst(); // remove title line

    for (int i = 0; i < buffer.length(); i++) {
        QStringList strParse = buffer.at(i).split(whitespace, QString::SkipEmptyParts);
        deleteConnectMark(strParse);
        int realRateIndex = combineRateStr(strParse);
        int ssidLength = realRateIndex - result.columnIndexes["rate"] + 1;
        combineSsid(strParse, result.columnIndexes["ssid"],
                    ssidLength);

        if (strParse.length() == columnsCount)
            pushToParamsList(result, strParse, columnsCount);
    }

    qDebug() << result.params;
    return result;
}
void QuazaaIRC::numericMessageReceived(QString sender, uint code, QStringList list)
{
	switch (code)
	{
		case Irc::Rfc::RPL_NAMREPLY:
			emit channelNames(list);
		break;
		case Irc::Rfc::RPL_BOUNCE:
		{
			for (int i = 0 ; i<list.size() ; ++i) {
				QString opt = list.at(i);
				if (opt.startsWith("PREFIX=", Qt::CaseInsensitive))
				{
					QString prefstr	= opt.split("=")[1];
					QString modes	= prefstr.mid(1, prefstr.indexOf(")")-1);
					QString mprefs	= prefstr.right(modes.length());
					emit setPrefixes(modes, mprefs);
				}
			}
		}
		default:
		{
			// append to status
			list.removeFirst();
			emit appendMessage(qobject_cast<Irc::Buffer*>(QObject::sender()), sender, "[" + QString::number(code) + "] " + list.join(" "), QuazaaIRC::Status);
		}
	}
}
Exemple #11
0
/*!
    Returns the current absolute url of this service depending on the request \a event.
 */
QUrl QxtWebSlotService::self(QxtWebRequestEvent* event)

{
    QStringList  u = event->url.path().split('/');
    QStringList  o = event->originalUrl.path().split('/');
    u.removeFirst();
    o.removeFirst();
    for (int i = 0;i < u.count();i++)
        o.removeLast();


    QString r = "/";
    foreach(const QString& d, o)
    {
        r += d + '/';
    }
Exemple #12
0
// private:
Phantom::Phantom(QObject *parent)
    : REPLCompletable(parent)
    , m_terminated(false)
    , m_returnValue(0)
    , m_filesystem(0)
    , m_system(0)
{
    // Skip the first argument, i.e. the application executable (phantomjs).
    QStringList args = QApplication::arguments();
    args.removeFirst();

    // Prepare the configuration object based on the command line arguments.
    // Because this object will be used by other classes, it needs to be ready ASAP.
    m_config.init(&args);

    // initialize key map
    QMetaEnum keys = staticQtMetaObject.enumerator( staticQtMetaObject.indexOfEnumerator("Key") );
    for(int i = 0; i < keys.keyCount(); ++i) {
        QString name = keys.key(i);
        if (name.startsWith("Key_")) {
            name.remove(0, 4);
        }
        m_keyMap[name] = keys.value(i);
    }
}
Cloud::Cloud( QString& pFile ){
	// TODO Auto-generated constructor stub
	QFile mFile(pFile);

	//load file content
	if(!mFile.open(QIODevice::ReadOnly)) {
		qWarning()<<"Error opening file";
		return;
	}

	//work on the file
	QString lDatas =  mFile.readAll();
	QStringList lTokens = lDatas.split(QRegExp("[ |\n]"), QString::SkipEmptyParts);
	QString nbInt = lTokens.at(0);
	mNbPoints = nbInt.toInt();
	//remove first item (size) from the list
	lTokens.removeFirst();

	QStringListIterator lTokIterator(lTokens);
	while(lTokIterator.hasNext()) {
                mPointList << lTokIterator.next().toFloat();
	}
        qWarning()<<mPointList.size()<<mNbPoints;

        glPointSize(5.0f);
        mGLBatch.Begin(GL_POINTS, mNbPoints);
        for(int i=0;i<mNbPoints;i++)
        {
            mGLBatch.Vertex3f(mPointList[i*3],mPointList[i*3+1], mPointList[i*3+2]);
        }
        mGLBatch.End();

}
Exemple #14
0
QT_BEGIN_NAMESPACE

QEdidParser::QEdidParser()
{
    // Cache vendors list from pnp.ids
    const QString fileName = QLatin1String("/usr/share/hwdata/pnp.ids");
    if (QFile::exists(fileName)) {
        QFile file(fileName);

        if (file.open(QFile::ReadOnly)) {
            while (!file.atEnd()) {
                QString line = QString::fromUtf8(file.readLine()).trimmed();

                if (line.startsWith(QLatin1Char('#')))
                    continue;

                QStringList parts = line.split(QLatin1Char('\t'));
                if (parts.count() > 1) {
                    QString pnpId = parts.at(0);
                    parts.removeFirst();
                    m_vendorCache[pnpId] = parts.join(QLatin1Char(' '));
                }
            }

            file.close();
        }
    }
}
QStringList     Arguments::toStringList() const
{
    QStringList result = this->raw;

    result.removeFirst();
    return (result);
}
Exemple #16
0
//collision
void Zombie::collision(){
    QList<QGraphicsItem *> colliding = collidingItems();
    for(int i=0, n=colliding.size();i<n;++i){

        //collision between zombie and player
        if(typeid(*(colliding[i])) == typeid(Player)){
            //stopping the game
            gameTimer->stop();
            moveTimer->stop();

            //deleting
            delete gameTimer;
            delete moveTimer;
            delete player1;
            delete game;
            delete score;
            delete scene();

            //restarting the game
            qApp->closeAllWindows();
            QStringList args = QApplication::arguments();
            args.removeFirst();
            QCoreApplication::quit();
            QProcess::startDetached(QApplication::applicationFilePath(), args);
        }
    }
}
Exemple #17
0
int main(int argc, char *argv[]) {
    QCoreApplication app(argc, argv);
    app.setOrganizationName("QSoundCloud");
    app.setApplicationName("QSoundCloud");
    
    QStringList args = app.arguments();
    
    if (args.size() < 2) {
        qWarning() << "Usage: streams-get ID";
        return 0;
    }
    
    args.removeFirst();
    
    QSettings settings;

    QSoundCloud::StreamsRequest request;
    request.setClientId(settings.value("Authentication/clientId").toString());
    request.setClientSecret(settings.value("Authentication/clientSecret").toString());
    request.setAccessToken(settings.value("Authentication/accessToken").toString());
    request.setRefreshToken(settings.value("Authentication/refreshToken").toString());
    request.get(args.takeFirst());
    QObject::connect(&request, SIGNAL(finished()), &app, SLOT(quit()));

    return app.exec();
}
Exemple #18
0
bool CBC::download(QString filename)
{
    if(!compile(filename))
        return false;
    
    qWarning("Calling gcc...");
    m_gcc.reset();
    
    m_gcc.start(m_gccPath, QStringList() << "-E" << "-Wp,-MM" << filename);
    m_gcc.waitForFinished();
    
    qWarning("Gcc finished...");
    
    QString depString = QString::fromLocal8Bit(m_gcc.readAllStandardOutput());
    
    QStringList deps = getPaths(depString);
    
    deps.removeFirst();
    qWarning("deps.size()=%d", deps.size());
    
    qWarning("deps=\"%s\"", qPrintable(deps.join(",")));
    
    qWarning("Calling sendFile");
    
    if(!QSerialPort(m_defaultPort).open(QIODevice::ReadWrite)) {
        emit requestPort();
        if(!QSerialPort(m_defaultPort).open(QIODevice::ReadWrite))
            return false;
    }
    
    m_serial.setPort(m_defaultPort);
    return m_serial.sendFile(filename, deps);
}
Exemple #19
0
QStringList NewKeyCommand::cutListAtIndex(QStringList &list, int index)
{
	for(int i = 0; i < index; i++)
		list.removeFirst();

	return list;
}
Exemple #20
0
void SessionTimesWidget::loadDriversList()
{
    QStringList list = SeasonData::getInstance().getDriversList();
    list.removeFirst();

    ui->driversListWidget->clear();
    ui->driversListWidget->addItems(list);

    for (int i = ui->timesTableWidget->columnCount(); i < list.size(); ++i)
    {
        ui->timesTableWidget->insertColumn(i);
    }

    if (list.size() < ui->timesTableWidget->columnCount())
    {
        for (int i = ui->timesTableWidget->columnCount(); i >= list.size(); --i)
            ui->timesTableWidget->removeColumn(i);
    }
    ui->timesTableWidget->clear();

    for (int i = 0; i < ui->driversListWidget->count(); ++i)
    {
        ui->driversListWidget->item(i)->setFlags(ui->driversListWidget->item(i)->flags() | Qt::ItemIsUserCheckable);

        QTableWidgetItem *item = ui->timesTableWidget->horizontalHeaderItem(i);
        if (item == 0)
        {
            item = new QTableWidgetItem();
            ui->timesTableWidget->setHorizontalHeaderItem(i, item);
        }
        item->setText(getName(i));
    }
    restoreCheckedArray();
}
void LoadToolScriptsThread::run() {
  QStringList directories;
  directories.append(QDir::currentPath());

  while (!directories.isEmpty()) {

    // Pop the first directory from the worklist
    QDir directory = QDir(directories.first());
    directories.removeFirst();

    // Find the list of all object files in this directory
    QStringList files
        = directory.entryList(QStringList(kToolScriptFileFilter),
                              QDir::Files | QDir::NoSymLinks);

    // Pass this list to the load objects panel
    panel_->addToolScripts(directory.absolutePath(), files);

    // Add subdirectories to worklist
    QStringList folders = directory.entryList(QStringList("*"), QDir::Dirs|QDir::NoDotAndDotDot);
    for (int i = 0; i < folders.size(); ++i) {
      directories.append(directory.absolutePath() + QDir::separator() + folders.at(i));
    }
  }
}
Exemple #22
0
void Client::getMessage()
{
	QDataStream in(tcpSocket);
	in.setVersion(QDataStream::Qt_4_0);

	QString message;
	in >> message;

	enum class COMMAND { NONE, USERLIST};
	COMMAND cmd = COMMAND::NONE;

	QStringRef checkCmd(&message, 0, 5);
	if (checkCmd == "_LST_")
		cmd = COMMAND::USERLIST;

	QStringList commandList;

	switch (cmd)
	{
	case COMMAND::USERLIST:
		commandList = message.split(" ", QString::SkipEmptyParts);
		commandList.removeFirst();
		ui.userList->clear();
		for (auto i : commandList)
		{
			new QListWidgetItem(i, ui.userList);
		}
		break;
	default:
		//in >> message;

		new QListWidgetItem(message, ui.messageList);
		ui.messageList->scrollToBottom();
	}
}
void WidgetChatMiddle::on_actionDisconnect_triggered()
{
	QStringList tempChannelList = channelList;
        if (!tempChannelList.isEmpty())
            tempChannelList.removeFirst();
	if (!tempChannelList.isEmpty())
		quazaaSettings.Chat.AutoJoinChannels = tempChannelList;
	quazaaSettings.saveSettings();
	quazaaIrc->stopIrc();
	ui->actionConnect->setEnabled(true);
	ui->actionDisconnect->setEnabled(false);
	QList<WidgetChatRoom*> allRooms = ui->stackedWidgetChatRooms->findChildren<WidgetChatRoom*>();
	for(int i = 0; i < allRooms.size(); ++i)
	{
		if (allRooms.at(i) != 0)
		{
			ui->stackedWidgetChatRooms->removeWidget(allRooms.at(i));
			allRooms.at(i)->~WidgetChatRoom();
		}
	}
	channelList.clear();
	channelListModel->setStringList(channelList);
	systemLog.postLog(LogSeverity::Debug, QString("Trying to disconnect from IRC"));
	//qDebug() << "Trying to disconnect from IRC";
}
Exemple #24
0
void SettingsEditorForm::updateTreeList(QString path, QStringList newDirs, QStringList newElements)
{
    QStringList dirs = path.split("/");
    dirs.removeFirst();
    QTreeWidgetItem* iter = ui->treeWidget->topLevelItem(0);
    for(QString dir : dirs)
    {
        for(int i=0; i<iter->childCount(); i++)
        {
            if(iter->child(i)->type() == TWT_DIR
                    && iter->child(i)->text(0) == dir)
            {
                iter = iter->child(i);
            }
        }
    }

    for(QString dir : newDirs)
    {
        QTreeWidgetItem * newItem = new QTreeWidgetItem(TWT_DIR);
        newItem->setText(0, dir);
        iter->addChild( newItem );
    }

    for(QString element : newElements)
    {
        QTreeWidgetItem * newItem = new QTreeWidgetItem(TWT_RES);
        newItem->setText(0, element);
        iter->addChild( newItem );
    }

    ui->treeWidget->expandAll();
}
Exemple #25
0
void LinksReader::takeLinks()
{
    QStringList fullLinks;
    QString links  = "";

    QString beginTN    = "<link>";
    QString endTN      = "</link>";
    QString tagContent = "";

    int beginTP = 0;
    int endTP   = 0;

    while(1)
    {
        beginTP = mPage.indexOf(beginTN);
        endTP   = mPage.indexOf(endTN);
        if (beginTP == -1 || endTP == -1) break;

        tagContent = mPage.mid(beginTP + beginTN.length(), endTP - beginTP - endTN.length() + 1);

        links += tagContent;
        mPage.remove(0, endTP + endTN.length());
    }

    fullLinks = links.split("http://");
    fullLinks.removeFirst();

    for(int i = 0; i < fullLinks.size(); i++)
    {
        fullLinks[i].remove(fullLinks[i].indexOf("/"), fullLinks[i].length());
        mLinks.push_back(fullLinks[i]);
    }
}
Exemple #26
0
int main(int argc, char **argv)
{
    QCoreApplication app(argc, argv);

    if (app.arguments().size() < 4) {
        qWarning() << "usage: " << app.applicationName()
                   << " GAMMARAY INJECTOR DEBUGGEE [DEBUGGEE_ARGS]";
        return 1;
    }

    QStringList args = app.arguments();
    // remove path to this bin
    args.removeFirst();
    // gammaray
    const QString gammaray = args.takeFirst();
    // injector
    const QString injector = args.takeFirst();
    // app to run
    const QString debuggee = args.takeFirst();

    // run the self-test first, and skip the test if that fails
    // this prevents failures with Yama ptrace_scope activated for example
    if (QProcess::execute(gammaray,
                          QStringList() << QStringLiteral("--self-test") << injector) == 1) {
        qWarning() << "Skipping test due to injector self-test failure!";
        return 0;
    }

    AttachHelper helper(gammaray, injector, debuggee, args);

    return app.exec();
}
Exemple #27
0
bool PredicatXUVParmis::chargerParametres(QStringList &list)
{
    minimumUV = list.first().toInt();
    list.removeFirst();
    candidats = list;
    return true;
}
Exemple #28
0
Status StatusParser::parse(QString data) {
    data = stripResponseHeader(data);
    QStringList playerList = data.split("\n");

    QString variableData = playerList.first();
    playerList.removeFirst();
    QStringList variableList = variableData.split("\\", QString::SkipEmptyParts);
    QStringListIterator it(variableList);
    Status status;
    while (it.hasNext()) {
        QString key = it.next();
        if(it.hasNext()) {
            QString value = it.next();
            status.variables.insert(key, value);
        }
    }

    QStringListIterator itP(playerList);
    while (itP.hasNext()) {
        QString line = itP.next();
        QStringList playerData = line.split(" ");
        if(playerData.size() >= 3) {
            QString playerName = QStringList(playerData.mid(2)).join(" ");
            playerName.chop(1); // remove first "
            playerName.remove(0, 1); // remove last "
            status.players.append(std::move(Player(playerName,
                                                   playerData[0].toInt(),
                                                   playerData[1].toInt())));
        }
    }

    return status;
}
void TrainScheduleEngine::dataReceived(KIO::Job *job, const QByteArray &data)
{
	Q_UNUSED(job);

	QString source = QString("schedule-%1-%2-%3").arg(m_station).arg(m_nb).arg(m_start);

	QString rep = QString::fromUtf8(data);

	QStringList strings = rep.split(QRegExp("&ligne[0-9]="));

	// Remove blabla...
	if (!strings.isEmpty())
		strings.removeFirst();

	// If there is something left in the list it deserves
	// to be treated!
	if (!strings.isEmpty()) {
		QVariantList * trainList = new QVariantList();
		for (int i = 0 ; i < strings.count() ; i++) {
			*trainList << parseLine(strings[i]);
		}

		setData(source, "items", *trainList);
		delete(trainList);
	}
}
void SeafileApplet::restartApp()
{
    if (in_exit_ || QCoreApplication::closingDown()) {
        return;
    }

    in_exit_ = true;

    QStringList args = QApplication::arguments();

    args.removeFirst();

    // append delay argument
    bool found = false;
    Q_FOREACH(const QString& arg, args)
    {
        if (arg == "--delay" || arg == "-D") {
            found = true;
            break;
        }
    }

    if (!found)
        args.push_back("--delay");

    QProcess::startDetached(QApplication::applicationFilePath(), args);
    QCoreApplication::quit();
}