示例#1
0
//====================================
// setMouse
//------------------------------------
void SaXManipulateMice::setMouse ( const QString& group ) {
	// .../
	//! set all mouse data associated with the given group name to
	//! the current pointer data. The group name consists of the
	//! vendor and model name separated by a colon
	// ----
	if ( ! mCDBMice ) {
		mCDBMice = new SaXProcess ();
		mCDBMice -> start (CDB_POINTERS);
	}
	QList< QDict<QString> > data;
	data = mCDBMice -> getTablePointerCDB_DATA (
		group
	);
	// .../
	// move the data record to the correct position
	// refering to the section ID -> mPointer
	// ----
	QDict<QString>* record = data.take(0);
	for (int n=0;n < mPointer;n++) {
		data.append(new QDict<QString>());
	}
	data.append ( record );
	// .../
	// merge the data into the current section now
	// ----
	if (data.isEmpty()) {
		excCDBRecordNotFound (group);
		qError (errorString(),EXC_CDBRECORDNOTFOUND);
		return;
	}
	mImport -> merge ( data );
	// .../
	// set vendor and name tag
	// ----
	QStringList nameList = QStringList::split ( ":", group );
	mImport -> setItem ( "Vendor", nameList.first() );
	mImport -> setItem ( "Name"  , nameList.last()  );
}
示例#2
0
std::streamsize OutputStream::xsputn(char const *s, std::streamsize count)
{
    QString str = QString(s).left(count);

    if(str.contains("\n"))
    {
        QStringList strList = str.split("\n");

        addLine(m_buffer + strList[0]);

        for(int i = 1; i < strList.size() - 1; ++i)
           addLine(strList[i]);

        scrollToBottom();

        m_buffer = strList.last();
    }
    else
        m_buffer += str;

    return count;
}
示例#3
0
void ZDLIWadList::newDrop(QStringList fileList){
	for(int i = 0; i < fileList.size(); i++){
		ZDLNameListable *zList = NULL;
		QString entry = fileList[i];
		QStringList pathParts = entry.split("/");
		if(pathParts.size() > 1){
			QString file = pathParts.last();
			QStringList fileParts = file.split(".");
			if(fileParts.size() > 1){
				QString name = fileParts[0];
				zList = new ZDLNameListable(pList, 1001, entry, name);
			}else{
				zList = new ZDLNameListable(pList, 1001, entry, file);
			}
		}else{
			zList = new ZDLNameListable(pList, 1001, entry, entry);
		}
		if(zList){
			insert(zList, -1);
		}
	}
}
示例#4
0
void FolderWizardTargetPage::slotUpdateDirectories(QStringList list)
{
    QFileIconProvider prov;
    QIcon folderIcon = prov.icon(QFileIconProvider::Folder);

    QString webdavFolder = QUrl(ownCloudInfo::instance()->webdavUrl()).path();
    connect(_ui.folderTreeWidget, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(slotItemExpanded(QTreeWidgetItem*)));

    QTreeWidgetItem *root = _ui.folderTreeWidget->topLevelItem(0);
    if (!root) {
        root = new QTreeWidgetItem(_ui.folderTreeWidget);
        root->setText(0, tr("Root (\"/\")", "root folder"));
        root->setIcon(0, folderIcon);
        root->setToolTip(0, tr("Choose this to sync the entire account"));
        root->setData(0, Qt::UserRole, "/");
    }
    foreach (QString path, list) {
        path.remove(webdavFolder);
        QStringList paths = path.split('/');
        if (paths.last().isEmpty()) paths.removeLast();
        recursiveInsert(root, paths, path);
    }
示例#5
0
/*!
    Any actions that can be delayed until the window is visible
 */
void BrowserApplication::postLaunch()
{
    QString directory = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
    if (directory.isEmpty())
        directory = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName();
    QWebSettings::setIconDatabasePath(directory);
    QWebSettings::setOfflineStoragePath(directory);

    setWindowIcon(QIcon(QLatin1String(":browser.svg")));

    loadSettings();

    // newMainWindow() needs to be called in main() for this to happen
    if (m_mainWindows.count() > 0) {
        QStringList args = QCoreApplication::arguments();
        if (args.count() > 1)
            mainWindow()->loadPage(args.last());
        else
            mainWindow()->slotHome();
    }
    BrowserApplication::historyManager();
}
示例#6
0
文件: infopanel.cpp 项目: KDE/ark
void InfoPanel::setIndex(const QModelIndex& index)
{
    if (!index.isValid()) {
        updateWithDefaults();
    } else {
        const Archive::Entry *entry = m_model->entryForIndex(index);

        QMimeDatabase db;
        QMimeType mimeType;
        if (entry->isDir()) {
            mimeType = db.mimeTypeForName(QStringLiteral("inode/directory"));
        } else {
            mimeType = db.mimeTypeForFile(entry->fullPath(), QMimeDatabase::MatchExtension);
        }

        iconLabel->setPixmap(getDesktopIconForName(mimeType.iconName()));
        if (entry->isDir()) {
            int dirs;
            int files;
            const int children = m_model->childCount(index, dirs, files);
            additionalInfo->setText(KIO::itemsSummaryString(children, files, dirs, 0, false));
        } else if (!entry->property("link").toString().isEmpty()) {
            additionalInfo->setText(i18n("Symbolic Link"));
        } else {
            if (entry->property("size") != 0) {
                additionalInfo->setText(KIO::convertSize(entry->property("size").toULongLong()));
            } else {
                additionalInfo->setText(i18n("Unknown size"));

            }
        }

        const QStringList nameParts = entry->fullPath().split(QLatin1Char( '/' ), QString::SkipEmptyParts);
        const QString name = (nameParts.count() > 0) ? nameParts.last() : entry->fullPath();
        fileName->setText(name);

        showMetaDataFor(index);
    }
}
示例#7
0
void S2Controller::processMessage(){
    // once a fullMessage is made, this method should only be called as a slot
    // because it unblocks the ability to send tcp commands
    // - parse the message here, extracting the returned message
    message = QString("");
    QStringList mList;
    mList = stringMessage.split("ACK\r\n");
    message = QString(mList.last().split("DONE\r\n").first());//  still has carriage return
    message.remove("\r\n");
    // and emitting the message, including updating text fields, etc.
    emit newMessage(message);

    // clear the fullMessage buffer  [this should be OK- only this method
    // and checkForMessages should ever access it]  note this is not scalable-
    // there's only one fullMessage at a time.

    stringMessage.clear();
    // unblock commands
    okToSend = true;
    sendCommandButton->setEnabled(true);

}
示例#8
0
WebBrowserApp::WebBrowserApp(int argc,char **argv) :
    QApplication(argc,argv),
    m_pLocalServer(0)
{
    QLocalSocket *socket = new QLocalSocket;
    QString strAppName = QCoreApplication::applicationName();

    socket->connectToServer(strAppName);

    if(socket->waitForConnected(500))
    {
        QTextStream s(socket);
        QStringList args = QCoreApplication::arguments();

        if(args.count() > 1) {
            s << args.last();
        }else{
            s <<QString();
        }

        s.flush();
        socket->waitForBytesWritten();
        return;
    }

    m_pLocalServer = new QLocalServer(this);
    connect(m_pLocalServer,SIGNAL(newConnection()),
            this,SLOT(newConnection()));

    if(!m_pLocalServer->listen(strAppName)) {
        if (m_pLocalServer->serverError() == QAbstractSocket::AddressInUseError
            && QFile::exists(m_pLocalServer->serverName())) {
            QFile::remove(m_pLocalServer->serverName());
            m_pLocalServer->listen(strAppName);
        }
    }

}
示例#9
0
void ParametersToolBox::setupUi(const ParametersMap & parameters)
{
	parameters_ = parameters;
	QWidget * currentItem = 0;
	QStringList groups;
	for(ParametersMap::const_iterator iter=parameters.begin();
			iter!=parameters.end();
			++iter)
	{
		QStringList splitted = QString::fromStdString(iter->first).split('/');
		QString group = splitted.first();

		QString name = splitted.last();
		if(currentItem == 0 || currentItem->objectName().compare(group) != 0)
		{
			groups.push_back(group);
			QScrollArea * area = new QScrollArea(this);
			stackedWidget_->addWidget(area);
			currentItem = new QWidget();
			currentItem->setObjectName(group);
			QVBoxLayout * layout = new QVBoxLayout(currentItem);
			layout->setSizeConstraint(QLayout::SetMinimumSize);
			layout->setContentsMargins(0,0,0,0);
			layout->setSpacing(0);
			area->setWidget(currentItem);

			addParameter(layout, iter->first, iter->second);
		}
		else
		{
			addParameter((QVBoxLayout*)currentItem->layout(), iter->first, iter->second);
		}
	}
	comboBox_->addItems(groups);
	connect(comboBox_, SIGNAL(currentIndexChanged(int)), stackedWidget_, SLOT(setCurrentIndex(int)));

	updateParametersVisibility();
}
示例#10
0
void MagicalObjectWindow::updateTreeView(QString raceDir)
{
    // get list of existing models to verify if some exist
    QDir* modelDir = new QDir(MAGICAL_OBJECT_PATH + "/" + raceDir);
    QStringList existingObjects;
    MagicalObject obj;
    objectList.clear();

    if (modelDir->exists())
    {
        existingObjects = modelDir->entryList();
        for(int i = 0; i <existingObjects.size(); ++i)
        {
            QStringList pieces = existingObjects[i].split(".");
            if(pieces.last() == "om")
            {
                obj.load(MAGICAL_OBJECT_PATH + "/" + raceDir + "/" + existingObjects[i]);
                objectList.append(obj);
            }
        }
    }
    if(existingObjects.isEmpty())
    {
        QLog_Info(LOG_ID_INFO, "on_comboBoxRace_currentIndexChanged() : No magical object found in race : " + raceDir);
    }

    objects->clear();
    for(int i = 0 ; i < objectList.size() ; i++)
    {
        QList<QStandardItem *> newObject;

        newObject<<new QStandardItem(objectList[i].getName())
                <<new QStandardItem(QString::number(objectList[i].getPoints()))
                <<new QStandardItem(objectList[i].getSpecialRules());
        objects->appendRow(newObject);
    }
    objects->setHorizontalHeaderLabels(OBJECT_HEADER);
}
示例#11
0
void NameCompiler::visitTemplateArgument(TemplateArgumentAST *node)
{
    if (node->type_id && node->type_id->type_specifier) {
        TypeCompiler type_cc(_M_binder);
        type_cc.run(node->type_id->type_specifier);

        DeclaratorCompiler decl_cc(_M_binder);
        decl_cc.run(node->type_id->declarator);

        if (type_cc.isConstant())
            _M_name.last() += "const ";

        QStringList q = type_cc.qualifiedName();

        if (q.count() == 1) {
#if defined (RXX_RESOLVE_TYPEDEF) // ### it'll break :(
            TypeInfo tp;
            tp.setQualifiedName(q);
            tp = TypeInfo::resolveType(tp, _M_binder->currentScope()->toItem());
            q = tp.qualifiedName();
#endif

            if (CodeModelItem item = _M_binder->model()->findItem(q, _M_binder->currentScope()->toItem())) {
                if (item->name() == q.last())
                    q = item->qualifiedName();
            }
        }

        _M_name.last() += q.join("::");

        if (decl_cc.isReference())
            _M_name.last() += "&";
        if (decl_cc.indirection())
            _M_name.last() += QString(decl_cc.indirection(), '*');

        _M_name.last() += QLatin1String(",");
    }
}
示例#12
0
void ChatEdit::complete()
{
    QString completionPrefix = textUnderCursor();

    if (completionPrefix.isEmpty()) {
        if (cc->popup()->isVisible())
            cc->popup()->hide();

        return;
    }

    if (!cc->popup()->isVisible() || completionPrefix.length() < cc->completionPrefix().length()) {
        QString pattern = QString("(\\[.*\\])?%1.*").arg( QRegExp::escape(completionPrefix) );
        QStringList nicks = cc_model->findItems(pattern, Qt::MatchRegExp, 0);

        if (nicks.isEmpty())
            return;

        if (nicks.count() == 1) {
            insertToPos(nicks.last(), textCursor().position() - completionPrefix.length());
            return;
        }

        NickCompletionModel *tmpModel = new NickCompletionModel(nicks, cc);
        cc->setModel(tmpModel);
    }

    if (completionPrefix != cc->completionPrefix()) {
        cc->setCompletionPrefix(completionPrefix);
        cc->popup()->setCurrentIndex(cc->completionModel()->index(0, 0));
    }

    QRect cr = cursorRect();
    cr.setWidth(cc->popup()->sizeHintForColumn(0)
                + cc->popup()->verticalScrollBar()->sizeHint().width());

    cc->complete(cr);
}
void MiniSceneRule::assign(QStringList &generals, QStringList &generals2, QStringList &kingdoms, Room *room) const
{
    QStringList generalnames = Sanguosha->getRandomGenerals(999);
    for (int i = 0; i < players.length(); i++) {
        QMap<QString, QString> sp = players.at(i);
        QString name = sp["general"];
        QString name2 = sp["general2"];
        generalnames.removeOne(name);
        generalnames.removeOne(name2);
    }
    QList<ServerPlayer *> splayers = room->getAllPlayers();
    int count = qFloor(generalnames.length() / players.length());
    count = qMin(count, 9);
    for (int i = 0; i < players.length(); i++) {
        QMap<QString, QString> sp = players.at(i);
        QString name = sp["general"];
        QString name2 = sp["general2"];
        if (name == "select" || name2 == "select") {
            QStringList choices;
            for (int index = 0; index < generalnames.length(); index++) {
                if (index >= i * count && index < (i + 1) * count)
                    choices << generalnames.at(index);
            }
            if (name == "select") {
                QStringList names = room->askForGeneral(splayers.at(i), choices, QString(), name2 != "select").split("+");
                name = names.first();
                if (name2 == "select")
                    name2 = names.last();
            }
            if (name2 == "select")
                name2 = room->askForGeneral(splayers.at(i), choices);
        }
        generals << name;
        generals2 << name2;
        QString k = sp["nationality"].isEmpty() ? Sanguosha->getGeneral(name)->getKingdom() : sp["nationality"];
        kingdoms << k;
    }
}
void CallStringOffsetProvider::setOffset(int offset)
{
	if (offset == 0)
	{
		vis_->moveCursor( Visualization::Item::MoveOnPosition, QPoint(0,0));
		return;
	}

	QStringList components = this->components();

	if (offset == components.join("").size())
	{
		vis_->moveCursor( Visualization::Item::MoveOnPosition, QPoint(vis_->xEnd(),0));
		return;
	}

	int listOffest = 0;
	int listIndex = components[1] == "." ? 3 : 1;
	for(int i = 0; i< listIndex; ++i)
		listOffest += components[i].size();

	if (offset <= listOffest)
	{
		SequentialVisualizationStringOffsetProvider::setOffset(offset);
		return;
	}
	else offset -= listOffest;

	if ( setOffsetInListItem(offset, vis_->arguments(), "(", ",", ")"))
		return;

	if (offset == components.last().size())
	{
		vis_->moveCursor( Visualization::Item::MoveOnPosition, QPoint(vis_->xEnd(),0));
	}
	else
		Q_ASSERT(false);
}
QString QmlTextGenerator::toQml(const ModelNode &node, int indentDepth) const
{
    QString type = node.type();
    QString url;
    if (type.contains('.')) {
        QStringList nameComponents = type.split('.');
        url = nameComponents.first();
        type = nameComponents.last();
    }

    QString alias;
    if (!url.isEmpty()) {
        foreach (const Import &import, node.model()->imports()) {
            if (import.url() == url) {
                alias = import.alias();
                break;
            }
            if (import.file() == url) {
                alias = import.alias();
                break;
            }
        }
    }
示例#16
0
QString NewClassDialog::getGradeString(QString *classGradeData)
{
    QString returnString;

    foreach(QCheckBox *input, gradeInput)
    {
        if(input->isChecked())
        {
            classGradeData->append( QString("%1 ").arg(input->text()) );
        }
    }

    QStringList gradeString = classGradeData->split(" ", QString::SkipEmptyParts);

    if(gradeString.size() == 1)
        returnString.append( gradeString.first() );
    else if(gradeString.size() > 1)
        returnString.append( QString("%1 - %2").arg( gradeString.first() ).arg( gradeString.last() ) );
    else if(gradeString.size() < 1)
        returnString.append( QString("xx - xx") );

    return returnString;
}
示例#17
0
void SnpStreamReader::_readOptions() {
    if (_isValidFile == false)
        return;

    QStringList options = _readLine();
    if (options.isEmpty() == false
            && options.first() == "#"
            && options.size() >= 4)
    {
        _parseFrequencyPrefix(options[1]);
        _parseNetworkParameter(options[2]);
        _parseComplexFormat(options[3]);
        if (options.size() == 6)
            _parseImpedance(options.last());
        else
            _impedance_Ohms = 50;
        if (_isValidFile)
            _valuesToRead = 1 + 2*pow(int(_ports), 2.0);
    }
    else {
        _isValidFile = false;
    }
}
示例#18
0
/**
  * Tries to find library path corresponding to version set as parameter.
  * If not found return newest library path.
  */
QString OpenModelica::getLibraryPath(QString version)
{
    const char *omlibrary = getenv("OPENMODELICALIBRARY");
    QString omLibraryFolder(omlibrary);

    QDir omLibDir(omlibrary);
    QStringList omLibDirs = omLibDir.entryList(QDir::AllDirs| QDir::NoDotAndDotDot);
    omLibDirs = omLibDirs.filter(QRegExp("^Modelica .*"));
    if(omLibDirs.isEmpty())
        return QString();
    else
    {
        int iVersion = omLibDirs.indexOf("Modelica "+version);
        if(iVersion>-1)
            return omLibDir.absoluteFilePath(omLibDirs.at(iVersion)+QDir::separator()+"package.mo");

        else
        {
            omLibDirs.sort();
            return omLibDir.absoluteFilePath(omLibDirs.last()+QDir::separator()+"package.mo");
        }
    }
}
void YoutubeProtocolHandler::execute(const QUrl &uri, bool queue)
{
    QStringList parts = uri.path().split('/');
    QUrlQuery query;
    if (parts.count()) {
        query.addQueryItem("action", "play_video");
        query.addQueryItem("videoid", parts.last());
    }

    if (query.isEmpty()) {
        return;
    }

    PlaylistItem item;
    item.setFile("plugin://plugin.video.youtube/?" + query.toString());

    Player *player = Kodi::instance()->videoPlayer();
    if (queue) {
        player->playlist()->addItems(item);
    } else {
        player->open(item);
    }
}
示例#20
0
QVector< QVector<int> > NormFilterDialog::getMatrixFromLineEdit(QTextEdit *edit) const
{	// 文字列から行列を得る
	QVector< QVector<int> > result;
	QTextCursor cr = edit->textCursor();
	cr.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
	for (QTextBlock block = cr.block(); block.isValid(); block = block.next()) {	// 行の走査
		const QString line = block.text();
		const QRegExp regExpSpTab(tr("[ \\t]+"));
		QStringList tokens = line.split(regExpSpTab);	// スペースでトークン分割
		if (!tokens.isEmpty() && tokens.first().isEmpty()) { tokens.removeFirst(); }
		if (!tokens.isEmpty() && tokens.last().isEmpty()) { tokens.removeLast(); }
		if (tokens.isEmpty()) { continue; }

		const QRegExp regExpInt(tr("^-?\\d+$"));
		QVector<int> row;
		for (QStringList::Iterator it = tokens.begin(); it != tokens.end(); ++it) {
			if (!regExpInt.exactMatch(*it)) { result.clear(); return result; }
			row.append(it->toInt());
		}
		result.append(row);
	}
	return result;
}
EnvironmentDisplayDialog::EnvironmentDisplayDialog(QWidget* parent, const char* name, bool modal, WFlags fl)
: EnvironmentDisplayDialogBase(parent,name, modal,fl)
{
	QStringList environment;
	char ** e = ::environ;
	
	while ( *e ) 
	{
		environment << *e;
		e++;
	}

	QStringList::ConstIterator it = environment.begin();
	while( it !=environment.end() )
	{
		QStringList pair = QStringList::split( QChar('='), *it );
		if ( pair.count() == 2 )
		{
			new QListViewItem( environmentListView, pair.first(), pair.last() );
		}
		++it;
	}
}
示例#22
0
void KeySetDlg::Init(){
	SetupKeyTable();
	ui.name->setText(mpAct->text());
	QStringList keys = mpAct->shortcut().toString().split("+");
	int fixKeyNum = 0;
	if(keys.contains("Ctrl")){
		ui.ctrl->setCheckState(Qt::Checked);
		++fixKeyNum;
	}
	if(keys.contains("Alt")){
		ui.alt->setCheckState(Qt::Checked);
		++fixKeyNum;
	}
	if(keys.contains("Shift")){
		ui.shift->setCheckState(Qt::Checked);
		++fixKeyNum;
	}
	if(fixKeyNum<keys.size()){
		ui.key->setCurrentText(keys.last());
	}else{
		ui.key->setCurrentText(sKeyTable[0]);
	}
}
示例#23
0
    void SyndicationActivity::addFeed()
    {
        bool ok = false;
        QString url = KInputDialog::getText(i18n("Enter the URL"), i18n("Please enter the URL of the RSS or Atom feed."),
                                            QString(), &ok, sp->getGUI()->getMainWindow());
        if (!ok || url.isEmpty())
            return;

        Syndication::Loader* loader = Syndication::Loader::create(this, SLOT(loadingComplete(Syndication::Loader*, Syndication::FeedPtr, Syndication::ErrorCode)));
        QStringList sl = url.split(":COOKIE:");
        if (sl.size() == 2)
        {
            FeedRetriever* retr = new FeedRetriever();
            retr->setAuthenticationCookie(sl.last());
            loader->loadFrom(KUrl(sl.first()), retr);
            downloads.insert(loader, url);
        }
        else
        {
            loader->loadFrom(KUrl(url));
            downloads.insert(loader, url);
        }
    }
示例#24
0
SkinDocument::SkinDocument(QLabel* statusLabel, QString file,
                           ProjectModel* project, QWidget *parent)
                               :TabContent(parent), fileName(file),
                               statusLabel(statusLabel), project(project)
{
    setupUI();
    blockUpdate = false;

    /* Loading the file */
    if(QFile::exists(fileName))
    {
        QFile fin(fileName);
        fin.open(QFile::ReadOnly);
        editor->document()->setPlainText(QString(fin.readAll()));
        saved = editor->document()->toPlainText();
        editor->setTextCursor(QTextCursor(editor->document()->begin()));
        fin.close();
    }

    /* Setting the title */
    QStringList decomposed = fileName.split('/');
    titleText = decomposed.last();
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicImportEclipseCaseFeature::onActionTriggered(bool isChecked)
{
    RiaApplication* app = RiaApplication::instance();

    QString defaultDir = app->defaultFileDialogDirectory("BINARY_GRID");
    QStringList fileNames = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Import Eclipse File", defaultDir, "Eclipse Grid Files (*.GRID *.EGRID)");
    if (fileNames.size()) defaultDir = QFileInfo(fileNames.last()).absolutePath();
    app->setDefaultFileDialogDirectory("BINARY_GRID", defaultDir);

    int i;
    for (i = 0; i < fileNames.size(); i++)
    {
        QString fileName = fileNames[i];

        if (!fileNames.isEmpty())
        {
            if (app->openEclipseCaseFromFile(fileName))
            {
                RiuMainWindow::instance()->addRecentFiles(fileName);
            }
        }
    }
}
void EmulatorSettingsReader::AddSetting(const QString& category,const QString &rawSetting)
{
    QStringList settingParts(rawSetting.split("': ('"));
    QString name(settingParts[0].remove("'"));
    QString value("");
    QStringList availSettings;
    QString foo;
    if (settingParts.length() == 2)
    {
        name = settingParts[0].remove("'");

        settingParts = (foo = settingParts[1]).split("', {'");
        if (settingParts.length() == 2)
        {
            value = settingParts[0];
            settingParts = settingParts[1].split("', '");
            availSettings.clear();
            qDebug() <<"\t"<< name;
            foreach(const QString& str, settingParts)
            {
                availSettings.append(str.split("': '")[0]);
                qDebug() <<"\t\t"<< availSettings.last();
            }
示例#27
0
文件: TrayUI.cpp 项目: yater/pcbsd
// ===============
//            PRIVATE
// ===============
void TrayUI::UpdateAUNotice(){
  QString val = pcbsd::Utils::getValFromPCBSDConf("AUTO_UPDATE").simplified().toLower();
  if(val=="all"){
    AUNotice = tr("Auto-Update: Everything");
  }else if(val=="security"){
    AUNotice = tr("Auto-Update: Security Only");
  }else if(val=="pkg"){
    AUNotice = tr("Auto-Update: Packages Only");
  }else if(val=="disabled"){
    AUNotice = tr("Auto-Update: Disabled");
  }else{ // "securitypkg" is default
    val = "securitypkg";
    AUNotice = tr("Auto-Update: Security & Packages");
  }
  AUval = val; //save this for later
  //Now add info about the most recent update attempt
  QStringList info = pcbsd::Utils::runShellCommand("beadm list -H").filter("-up-");
  if(!info.isEmpty()){
    AUNotice.append("\n"+tr("Last Update: %1") );
    AUNotice = AUNotice.arg( info.last().section("\t",4,5) ); //only put the date/time here
  }
  UpdateIcon();
}
示例#28
0
Number BlockParser::parseProcessForRobots(QString stream, int &pos, Id curId)
{
	mCurrentId = curId;

	if (checkForEmptiness(stream, pos)) {
		error(emptyProcess);
		return Number(0, Number::intType);
	}
	parseVarPart(stream, pos);
	if (hasParseErrors) {
		return Number(0, Number::intType);
	}
	QString newStream = stream.mid(pos, stream.length());
	if (newStream.isEmpty()){
		hasParseErrors = true;
		mErrorReporter->addCritical(QObject::tr("No value of expression"), mCurrentId);
		return Number(0, Number::intType);
	}
	QStringList exprs = newStream.split(";", QString::SkipEmptyParts);
	for (int i = 0; i < (exprs.length()-1); ++i) {
		if (hasParseErrors)
			return Number(0, Number::intType);
		int position = 0;
		QString expr = exprs[i];
		skip(expr, position);
		parseCommand(expr + ";", position);
	}
	int position = 0;
	QString valueExpression = exprs.last();
	if(!valueExpression.contains("="))
		return parseExpression(valueExpression, position);
	else {
		hasParseErrors = true;
		mErrorReporter->addCritical(QObject::tr("No value of expression"), mCurrentId);
		return Number(0, Number::intType);
	}
}
示例#29
0
//=========================================
// Member call for handleNotificationEvent
//-----------------------------------------
bool Notify::sendSignal (int fd,int flag) {
	sigprocmask(SIG_BLOCK, &block_set,0);
	if ( mNotifyDirs[fd] ) {
		QString* pFolder = mNotifyDirs[fd];
		QPoint*  count   = mNotifyCount[fd];
		QStringList tokens = pFolder->split ( "/" );
		QString folder  = tokens.first();
		QString dirname = tokens.last();
		switch (flag) {
			case QBIFF_CREATE:
				printf ("________create %s %p\n",pFolder->toLatin1().data(),count);
				if (dirname == "new") {
					count -> rx()++;
				} else {
					count -> ry()++;
				}
				sigCreate ( &folder,count );
			break;
			case QBIFF_DELETE:
				printf ("________delete %s %p\n",pFolder->toLatin1().data(),count);
				if (dirname == "new") {
					count -> rx()--;
				} else {
					count -> ry()--;
				}
				sigDelete ( &folder,count );
			break;
			default:
			break;
		}
		sigNotify ( &folder,count );
		sigprocmask(SIG_UNBLOCK, &block_set,0);
		return true;
	}
	sigprocmask(SIG_UNBLOCK, &block_set,0);
	return false;
}
示例#30
0
void WicdAccessPoint::Private::recacheInformation()
{
    QDBusReply< QString > essidr = WicdDbusInterface::instance()->wireless().call("GetWirelessProperty", networkid, "essid");
    QDBusReply< QString > bssidr = WicdDbusInterface::instance()->wireless().call("GetWirelessProperty", networkid, "bssid");
    QDBusReply< QString > channelr = WicdDbusInterface::instance()->wireless().call("GetWirelessProperty", networkid, "channel");
    QDBusReply< QString > bitrater = WicdDbusInterface::instance()->wireless().call("GetWirelessProperty", networkid, "bitrates");
    QDBusReply< QString > moder = WicdDbusInterface::instance()->wireless().call("GetWirelessProperty", networkid, "mode");
    QDBusReply< int > strengthr = WicdDbusInterface::instance()->wireless().call("GetWirelessProperty", networkid, "strength");
    QDBusReply< int > qualityr = WicdDbusInterface::instance()->wireless().call("GetWirelessProperty", networkid, "quality");
    QDBusReply< QString > encryption_methodr = WicdDbusInterface::instance()->wireless().call("GetWirelessProperty", networkid, "encryption_method");
    QDBusReply< QString > enctyper = WicdDbusInterface::instance()->wireless().call("GetWirelessProperty", networkid, "enctype");

    if (essidr.value() != essid) {
        essid = essidr.value();
        emit q->ssidChanged(essid);
    }
    bssid = bssidr.value();
    channel = channelr.value().toInt();
    mode = moder.value();
    if (strength != strengthr.value()) {
        strength = strengthr.value();
        emit q->signalStrengthChanged(strength);
    }
    quality = qualityr.value();
    encryption_method = encryption_methodr.value();
    enctype = enctyper.value();
    if (frequency != chanToFreq[channel]) {
        frequency = chanToFreq[channel];
        emit q->frequencyChanged(frequency);
    }
    QStringList bitrates = bitrater.value().split(" Mb/s; ");
    bitrates.last().remove(" Mb/s");
    int bitrate_new = 0;

    foreach(const QString &b, bitrates) {
        bitrate_new = qMax(bitrate_new, b.toInt() * 1000);
    }