void MainWindow::setupWindowSize()
{
    m_settings->beginGroup("DesktopGui");
    if(SDK::Core::instance()->arguments().contains("--window-size"))
    {
        const QString& value = SDK::Core::instance()->arguments().value("--window-size");
        if(value == "auto")
        {
            setGeometry(qApp->desktop()->screenGeometry());
        }
        else
        {
            QStringList data = value.split("x");
            if(data.length() == 2)
            {
                const int width = data[0].toInt();
                const int height = data[1].toInt();
                setGeometry(0, 0, width, height);
            }
            else
            {
                WARN() << "Incorrect agrument value" << value << ". '--window-size' value should be either WIDTHxHEIGHT or auto.";
                restoreGeometry(m_settings->value("geometry").toByteArray());
            }
        }
    }
    else
        restoreGeometry(m_settings->value("geometry").toByteArray());
    restoreState(m_settings->value("window_state").toByteArray());

    m_mouse_border_threshold = m_settings->value("mouse_border_threshold", 50).toInt();
    m_settings->endGroup();

}
Example #2
0
/**
 * Inserts @p type into the type-combobox.
 * The combobox is cleared and all types together with the optional new one
 * sorted and then added again.
 * @param type   a new type to add and selected
 */
void UMLTemplateDialog::insertTypesSorted(const QString& type)
{
    QStringList types;
    // "class" is the nominal type of template parameter
    types << "class";
    // add the active data types to combo box
    UMLDoc *pDoc = UMLApp::app()->document();
    UMLClassifierList namesList( pDoc->concepts() );
    foreach (UMLClassifier* obj, namesList) {
        types << obj->name();
    }
    // add the given parameter
    if ( !types.contains(type) ) {
        types << type;
    }
    types.sort();

    m_pTypeCB->clear();
    m_pTypeCB->insertItems(-1, types);

    // select the given parameter
    int currentIndex = m_pTypeCB->findText(type);
    if (currentIndex > -1) {
        m_pTypeCB->setCurrentIndex(currentIndex);
    }
}
Example #3
0
static QList<CMakeTool *> autoDetectCMakeTools()
{
    QList<FileName> suspects;

    Utils::Environment env = Environment::systemEnvironment();

    QStringList path = env.path();
    path.removeDuplicates();

    QStringList execs = env.appendExeExtensions(QLatin1String("cmake"));

    foreach (QString base, path) {
        const QChar slash = QLatin1Char('/');
        if (base.isEmpty())
            continue;
        // Avoid turning '/' into '//' on Windows which triggers Windows to check
        // for network drives!
        if (!base.endsWith(slash))
            base += slash;

        foreach (const QString &exec, execs) {
            QFileInfo fi(base + exec);
            if (fi.exists() && fi.isFile() && fi.isExecutable())
                suspects << FileName::fromString(fi.absoluteFilePath());
        }
    }
QStringList CommandExecutionEngine::tokenize(const QString& string, const QString& quoteSymbols, const QString& escapeSymbols)
{
	QStringList result;
	QString str;

	QChar quote;

	for (int i = 0; i < string.size(); ++i)
	{
		if ( quote.isNull() )
		{
			if ( quoteSymbols.contains(string[i]) )
			{
				if ( !str.isNull() ) result.append(tokenizeNonQuoted(str.simplified()));
				quote = string[i];
				str = quote;
			}
			else str.append(string[i]);
		}
		else
		{
			if ( string[i] == quote && !isEscaped(string, i, escapeSymbols) )
			{
				result.append(str + quote);
				quote = QChar();
				str = QString();
			}
		}
	}

	if ( !str.isNull() ) result.append(tokenizeNonQuoted(str.simplified()));
	return result;
}
Example #5
0
void MingwMakefileGenerator::writeLibDirPart(QTextStream &t)
{
    QStringList libDirs = project->values("QMAKE_LIBDIR");
    for (int i = 0; i < libDirs.size(); ++i)
        libDirs[i].remove("\"");
    t << valGlue(libDirs,"-L"+quote,quote+" -L" +quote,quote) << " ";
}
void SendMessagesDialog::on_sendButton_clicked()
{
    QList<SendMessagesRecipient> recipients;
    bool valid = true;

    if(!model)
        return;

    valid = validate();

    for(int i = 0; i < ui->entries->count(); ++i)
    {
        SendMessagesEntry *entry = qobject_cast<SendMessagesEntry*>(ui->entries->itemAt(i)->widget());
        if(entry)
        {
            if(entry->validate())
                recipients.append(entry->getValue());
            else
                valid = false;
        }
    }

    if(!valid || recipients.isEmpty())
        return;

    // Format confirmation message
    QStringList formatted;
    foreach(const SendMessagesRecipient &rcp, recipients)
    {
        formatted.append(tr("<b>%1</b> to %2 (%3)").arg(rcp.message, Qt::escape(rcp.label), rcp.address));
    }
Example #7
0
QString KeyUnit::assembleReport()
{
    statsActiveKeys = 0;
    statsKeyTotal = 0;
    statsTempKeys = 0;
    for (auto it = mKeyRootNodeList.begin(); it != mKeyRootNodeList.end(); it++) {
        TKey* pChild = *it;
        if (pChild->isActive())
            statsActiveKeys++;
        if (pChild->isTempKey())
            statsTempKeys++;
        statsKeyTotal++;
        list<TKey*>* childrenList = pChild->mpMyChildrenList;
        for (auto it2 = childrenList->begin(); it2 != childrenList->end(); it2++) {
            TKey* pT = *it2;
            _assembleReport(pT);
            if (pT->isActive())
                statsActiveKeys++;
            if (pT->isTempKey())
                statsTempKeys++;
            statsKeyTotal++;
        }
    }
    QStringList msg;
    msg << "Keys current total: " << QString::number(statsKeyTotal) << "\n"
        << "tempKeys current total: " << QString::number(statsTempKeys) << "\n"
        << "active Keys: " << QString::number(statsActiveKeys) << "\n";
    return msg.join("");
}
/*!
*  \brief Instancie une faute et l'ajoute a la liste de faute
*
*  \param id_fault : identificateur du type de faute
*  \param id_target : identificateur de la cible de la faute
*/
void Fault_factory::add_fault(QString id_fault, QString id_target, QString pok_path){
  
  QString name = id_fault + "-" + id_target + ".fault";
  QFile fichier(name);
  QString line;
  QString fault_file_data;
  QStringList vars;
  QString var_tag("#VARIABLES");

  fichier.open(QIODevice::ReadOnly);
  QTextStream in(&fichier);
  line = in.readLine();
  
  Fault* fault = new Fault(id_fault, id_target, pok_path + "/" + line);
  fault_file_data = in.readAll();
  vars = fault_file_data.section("#VARIABLES", -1).split('\n');

  for(int i = 0; i < vars.length(); i++)
    {
      if(!vars.at(i).isEmpty())
        {
          fault->add_obs_var(vars.at(i));
        }
    }

  faults.append(fault);

}
void MainWindow::downloadFiles(const QVector<mtp::ObjectId> &objects)
{
	if (objects.isEmpty())
		return;

	QFileDialog d(this);
	QSettings settings;
	{
		QVariant ld = settings.value("the-latest-download-directory");
		if (ld.isValid())
			d.setDirectory(ld.toString());
	}

	d.setAcceptMode(QFileDialog::AcceptSave);
	d.setFileMode(QFileDialog::Directory);
	d.setOption(QFileDialog::ShowDirsOnly, true);
	restoreGeometry("download-files", d);
	if (!d.exec())
		return;

	QStringList selected = d.selectedFiles();
	if (selected.isEmpty())
		return;

	QString path = selected.at(0);
	saveGeometry("download-files", d);
	settings.setValue("the-latest-download-directory", path);
	downloadFiles(path, objects);
}
Example #10
0
bool PredicatXUVParmis::chargerParametres(QStringList &list)
{
    minimumUV = list.first().toInt();
    list.removeFirst();
    candidats = list;
    return true;
}
void WaypointImpFilterDialog::loadAirfieldComboBox()
{
    int searchList[] = { MapContents::GliderfieldList, MapContents::AirfieldList };

    airfieldDict.clear();
    airfieldRefBox->clear();

    QStringList airfieldList;

    for( int l = 0; l < 2; l++ )
    {
        for( int loop = 0; loop < _globalMapContents->getListLength(searchList[l]); loop++ )
        {
            SinglePoint *hitElement = (SinglePoint *) _globalMapContents->getElement(searchList[l], loop );
            airfieldList.append( hitElement->getName() );
            airfieldDict.insert( hitElement->getName(), hitElement );
        }
    }

    airfieldList.sort();
    airfieldRefBox->addItems( airfieldList );

    // try to find the last selection in the new content.
    int newIndex = airfieldRefBox->findText( airfieldRefTxt );

    if( newIndex != -1 )
    {
        // Try to find the last selection.
        airfieldRefBox->setCurrentIndex( newIndex );
    }
    else
    {
        airfieldRefBox->setCurrentIndex( 0 );
    }
}
Example #12
0
void TransportCpu::run() {
    while(isRunning()) {
#ifdef Q_OS_WIN
        Transport::perfCpu = 0;
        Transport::perfMem = 0;
#else
        QProcess process;
        process.start("ps", QStringList() << "-eo" << "pid,pcpu,pmem,command");
        process.waitForFinished();
        QStringList perfs = QString(process.readAllStandardOutput()).split("\n", QString::SkipEmptyParts);
        foreach(const QString &perf, perfs) {
            bool isPid = false;
            QStringList perfInfos = perf.split(" ", QString::SkipEmptyParts);
            for(quint16 i = 0 ; i < perfInfos.count() ; i++) {
                const QString &perfInfo = perfInfos.at(i);
                if((i== 0) && (perfInfo.toInt() == QCoreApplication::applicationPid()))
                    isPid = true;
                else if((isPid) && (i == 1))    Transport::perfCpu = perfInfo.toDouble();
                else if((isPid) && (i == 2))    Transport::perfMem = perfInfo.toDouble();
            }
            if(isPid)
                break;
        }
#endif
        sleep(3);
    }
void
MetaQueryWidget::populateComboBox( QStringList results )
{
    QObject* query = sender();
    if( !query )
        return;

    QWeakPointer<KComboBox> combo = m_runningQueries.value(query);
    if( combo.isNull() )
        return;

    // note: adding items seems to reset the edit text, so we have
    //   to take care of that.
    disconnect( combo.data(), 0, this, 0 );

    // want the results unique and sorted
    const QSet<QString> dataSet = results.toSet();
    QStringList dataList = dataSet.toList();
    dataList.sort();
    combo.data()->addItems( dataList );

    KCompletion* comp = combo.data()->completionObject();
    comp->setItems( dataList );

    // reset the text and re-enable the signal
    combo.data()->setEditText( m_filter.value );
    connect( combo.data(), SIGNAL(editTextChanged( const QString& ) ),
            SLOT(valueChanged(const QString&)) );
}
QStringList Dialog::showOpenDialog(bool singleSelect, const QString& filters, const QString& directory, const QString& caption) const
{
    QStringList result;

    if (singleSelect)
    {
        QString filename = QFileDialog::getOpenFileName(QApplication::activeWindow(),
                                                        caption.isEmpty() ? QCoreApplication::applicationName() : caption,
                                                        directory.isEmpty() ? openDialogDirectory : directory,
                                                        filters, NULL, QFlags<QFileDialog::Option>());
        if (!filename.isEmpty())
            result << filename;
    }
    else
    {
        result = QFileDialog::getOpenFileNames(QApplication::activeWindow(),
                                               caption.isEmpty() ? QCoreApplication::applicationName() : caption,
                                               directory.isEmpty() ? openDialogDirectory : directory,
                                               filters, NULL, QFlags<QFileDialog::Option>());
    }

    if (!result.isEmpty())
        openDialogDirectory = QFileInfo(result.at(0)).canonicalPath();

    return result;
}
Example #15
0
QStringList gpu::getGLXInfo(QString gpuName) const {
    QStringList data, gpus = globalStuff::grabSystemInfo("lspci").filter(QRegExp(".+VGA.+|.+3D.+"));
    gpus.removeAt(gpus.indexOf(QRegExp(".+Audio.+"))); //remove radeon audio device

    // loop for multi gpu
    for (int i = 0; i < gpus.count(); i++)
        data << "VGA:"+gpus[i].split(":",QString::SkipEmptyParts)[2];

    QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
    if (!gpuName.isEmpty())
        env.insert("DRI_PRIME",gpuName.at(gpuName.length()-1));
    QStringList driver = globalStuff::grabSystemInfo("xdriinfo",env).filter("Screen 0:",Qt::CaseInsensitive);
    if (!driver.isEmpty())  // because of segfault when no xdriinfo
        data << "Driver:"+ driver.filter("Screen 0:",Qt::CaseInsensitive)[0].split(":",QString::SkipEmptyParts)[1];

    switch (currentDriver) {
    case XORG:
        data << dXorg::getGLXInfo(gpuName, env);
        break;
    case FGLRX:
        data << dFglrx::getGLXInfo();
        break;
    case DRIVER_UNKNOWN:
        break;
    }
    return data;
}
void MainWindow::uploadAlbum()
{
	QFileDialog d(this);
	QSettings settings;
	{
		QVariant ld = settings.value("the-latest-directory");
		if (ld.isValid())
			d.setDirectory(ld.toString());
	}

	d.setAcceptMode(QFileDialog::AcceptOpen);
	d.setFileMode(QFileDialog::Directory);
	d.setOption(QFileDialog::ShowDirsOnly, true);
	d.setOption(QFileDialog::ReadOnly, true);
	restoreGeometry("upload-albums", d);
	if (!d.exec())
		return;

	saveGeometry("upload-albums", d);
	settings.setValue("the-latest-directory", d.directory().absolutePath());
	QStringList selected = d.selectedFiles();
	if (selected.isEmpty())
		return;

	for(const auto &path : selected)
	{
		uploadAlbum(path);
		back();
	}
}
static QString absPath(const QString &path)
{
    QString ret;
    if (path[0] != QChar('/')) { // Not an absolute path
        int slashpos;
        if ((slashpos = path.lastIndexOf('/')) != -1) { // Relative path
            QDir dir = QDir::current();
            dir.cd(path.left(slashpos));
            ret = dir.absolutePath();
        } else { // Need to search $PATH
            char *envPath = ::getenv("PATH");
            if (envPath) {
                QStringList envPaths = QString::fromLocal8Bit(envPath).split(':');
                for (int i = 0; i < envPaths.size(); ++i) {
                    if (QFile::exists(envPaths.at(i) + QLatin1String("/") + QString(path))) {
                        QDir dir(envPaths.at(i));
                        ret = dir.absolutePath();
                        break;
                    }
                }
            }
        }
    } else {
        QFileInfo fi(path);
        ret = fi.absolutePath();
    }
    return ret;
}
Example #18
0
QString fetchPythonException()
{
    static PyObject *tracebackFunc = NULL;
    PyObject *ptype, *pvalue, *ptraceback;
    QStringList tracebacks;

    // Get error data
    PyErr_Fetch(&ptype, &pvalue, &ptraceback);
    PyErr_NormalizeException(&ptype, &pvalue, &ptraceback);

    // See if we can get a full traceback
    if (tracebackFunc == NULL)
    {
        PyObject *pyth_module = PyImport_ImportModule("traceback");
        if (pyth_module)
            tracebackFunc = PyObject_GetAttrString(pyth_module, "format_exception");
    }
    if (tracebackFunc && PyCallable_Check(tracebackFunc)) {
        PyObject *retVal = PyObject_CallFunctionObjArgs(tracebackFunc, ptype, pvalue, ptraceback, NULL);
        tracebacks = PyList_AsQStringList(retVal);
        Py_DecRef(retVal);
    }

    Py_DecRef(ptype);
    Py_DecRef(pvalue);
    Py_DecRef(ptraceback);

    return tracebacks.join("");
}
Example #19
0
void XMPCategories::applyMetadata(QByteArray& xmpData)
{
    QStringList newCategories;
    KExiv2 exiv2Iface;
    exiv2Iface.setXmp(xmpData);

    if (d->categoryCheck->isChecked())
        exiv2Iface.setXmpTagString("Xmp.photoshop.Category", d->categoryEdit->text());
    else
        exiv2Iface.removeXmpTag("Xmp.photoshop.Category");

    for (int i = 0 ; i < d->subCategoriesBox->count(); i++)
    {
        QListWidgetItem *item = d->subCategoriesBox->item(i);
        newCategories.append(item->text());
    }

    // We remove in first all existing sub-categories.
    exiv2Iface.removeXmpTag("Xmp.photoshop.SupplementalCategories");

    // And add new list if necessary.
    if (d->categoryCheck->isChecked() && d->subCategoriesCheck->isChecked())
        exiv2Iface.setXmpSubCategories(newCategories);

    xmpData = exiv2Iface.getXmp();
}
Example #20
0
FormatFactory::FormatFactory()
{
    mFormatList.setAutoDelete(true);

    // dummy entry for default format
    FormatInfo *info = new FormatInfo;
    info->library = "<NoLibrary>";
    info->nameLabel = i18n("vCard");
    info->descriptionLabel = i18n("vCard Format");
    mFormatList.insert("vcard", info);

    const QStringList list = KGlobal::dirs()->findAllResources("data", "kabc/formats/*.desktop", true, true);
    for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
    {
        KSimpleConfig config(*it, true);

        if(!config.hasGroup("Misc") || !config.hasGroup("Plugin"))
            continue;

        info = new FormatInfo;

        config.setGroup("Plugin");
        QString type = config.readEntry("Type");
        info->library = config.readEntry("X-KDE-Library");

        config.setGroup("Misc");
        info->nameLabel = config.readEntry("Name");
        info->descriptionLabel = config.readEntry("Comment", i18n("No description available."));

        mFormatList.insert(type, info);
    }
}
Example #21
0
void OpenDialog::stream( bool b_transcode_only )
{
//    QString soutMRL = getMRL( false );
//    if( soutMRL.isEmpty() ) return;

    for( int i = 0; i < OPEN_TAB_MAX; i++ )
        qobject_cast<OpenPanel*>( ui.Tab->widget( i ) )->onAccept();

    QStringList soutMRLS = getMRLs(false);
    if(soutMRLS.empty())
    {
        return;
    }

    toggleVisible();

    /* Dbg and send :D */
    msg_Dbg( p_intf, "MRL(s) passed to the Sout: %i", soutMRLS.length() );
    for(int i = 0; i < soutMRLS.length(); i++)
    {
        msg_Dbg( p_intf, "MRL(s) passed to the Sout: %s", qtu( soutMRLS[i] ) );
    }
    THEDP->streamingDialog( this, soutMRLS, b_transcode_only,
                            getOptions().split( " :" ) );
}
Example #22
0
void Translator::validate()
{
    qDebug("Validate\n");
    if(test.length()==0) return;

    //! разобъем весь код на подстроки
    //QStringList lines = test.split("\n", QString::KeepEmptyParts);
    QStringList lines = test.split("\n",QString::KeepEmptyParts);

    int sum=0;
    rootNodesTrans->child.clear();
    for(int i=0;i<lines.size();i++)
    {
        qDebug("analysisLine()\n");
        sum=lines[i].length()+sum+1;
        QString tempLine=lines[i];//.remove(QChar(' '));
        if(tempLine.length()!=0)
        {
            if(analysisLine(tempLine,sum)==true)//формирование дерева с узлами
            {
                qDebug("Good line\n");
            }
            else
            {
                emit signalMessage(tr("Ошибка в строке line=")+QString::number(i)+1,2);
            }
        }
    }
}
Example #23
0
bool RemovableBackend::plug(const QString &devNode, const QString &label)
{
    QString name = generateName(devNode);
    QString id = generateId(devNode);

    if(!m_removableIds.contains(id))
    {
        Medium *medium = new Medium(id, name);
        medium->mountableState(devNode, QString::null, QString::null, false);

        QStringList words = QStringList::split(" ", label);

        QStringList::iterator it = words.begin();
        QStringList::iterator end = words.end();

        QString tmp = (*it).lower();
        tmp[0] = tmp[0].upper();
        QString new_label = tmp;

        ++it;
        for(; it != end; ++it)
        {
            tmp = (*it).lower();
            tmp[0] = tmp[0].upper();
            new_label += " " + tmp;
        }

        medium->setLabel(new_label);
        medium->setMimeType("media/removable_unmounted");

        m_removableIds.append(id);
        return !m_mediaList.addMedium(medium).isNull();
    }
    return false;
}
Example #24
0
void parseCommandLine(QCoreApplication &app, CmdLineOptions *opts)
{
    QCommandLineParser parser;

    parser.setApplicationDescription("remove db key at specified path");
    parser.addHelpOption();
    parser.addVersionOption();

    parser.addPositionalArgument("key", QCoreApplication::translate("main", "key"));

    QCommandLineOption debugOption(QStringList() << "d" << "debug",
                                   QCoreApplication::translate("main", "enable debug/verbose logging"));
    parser.addOption(debugOption);

    parser.process(app);

    opts->debuggingEnabled = parser.isSet(debugOption);

    const QStringList posArgs = parser.positionalArguments();
    if (posArgs.size() < 1)
    {
        qCritical("invalid arguments");
        exit(1);
    }

    opts->key = posArgs.at(0);

    DbdLogging::logger()->debugMode =  opts->debuggingEnabled;

    qDebug() << "debugging enabled:" << opts->debuggingEnabled;
    qDebug() << "key:" << opts->key;
}
Example #25
0
void ProjectManager::SaveProjectAs()
{
    if(m_pBoek == NULL)
    {
        QMessageBox box(QMessageBox::Information, "Geen project", "Er is geen project geopend!");
        box.exec();
        return;
    }

    QFileDialog fileDialog;
    fileDialog.setFileMode(QFileDialog::AnyFile);
    fileDialog.setAcceptMode(QFileDialog::AcceptSave);

    if(fileDialog.exec())
    {
        QStringList files = fileDialog.selectedFiles();
        if(files.size() >= 1)
        {
            m_saveLocation = files.first();
            save(m_saveLocation);
        }
        else
        {
            qWarning("No files selected in QFileDialog but user still managed to click save?");
        }
    }
}
Example #26
0
/**
 * Handles command line arguments that might not require a GUI.
 *
 * @return list of files to load on startup.
 */
QStringList handleArgs(int argc, char** argv) {
        RS_DEBUG->print("main: handling args..");
        QStringList ret;

        bool doexit = false;
        QString machine;
        QString input;
        QString output;

        for (int i=1; i<argc; i++) {
                if (QString(argv[i]).startsWith("-")==false) {
                        QString fname = QDir::toNativeSeparators(
                                QFileInfo(QFile::decodeName(argv[i])).absoluteFilePath() );
                        ret.append(fname);
                }
                else if (QString(argv[i])=="--exit") {
                        doexit = true;
                }
        }

        if (doexit) {
                exit(0);
        }

        RS_DEBUG->print("main: handling args: OK");
        return ret;
}
/**
 * Simple open
 ***/
QStringList DialogsProvider::showSimpleOpen( const QString& help,
                                             int filters,
                                             const QString& path )
{
    QString fileTypes = "";
    if( filters & EXT_FILTER_MEDIA ) {
        ADD_EXT_FILTER( fileTypes, EXTENSIONS_MEDIA );
    }
    if( filters & EXT_FILTER_VIDEO ) {
        ADD_EXT_FILTER( fileTypes, EXTENSIONS_VIDEO );
    }
    if( filters & EXT_FILTER_AUDIO ) {
        ADD_EXT_FILTER( fileTypes, EXTENSIONS_AUDIO );
    }
    if( filters & EXT_FILTER_PLAYLIST ) {
        ADD_EXT_FILTER( fileTypes, EXTENSIONS_PLAYLIST );
    }
    if( filters & EXT_FILTER_SUBTITLE ) {
        ADD_EXT_FILTER( fileTypes, EXTENSIONS_SUBTITLE );
    }
    ADD_EXT_FILTER( fileTypes, EXTENSIONS_ALL );
    fileTypes.replace( ";*", " *");

    QStringList files = QFileDialog::getOpenFileNames( NULL,
        help.isEmpty() ? qtr(I_OP_SEL_FILES ) : help,
        path.isEmpty() ? p_intf->p_sys->filepath : path,
        fileTypes );

    if( !files.isEmpty() ) savedirpathFromFile( files.last() );

    return files;
}
Example #28
0
bool ImportNative::keyPressEvent(QKeyEvent *event)
{
    if (GetFocusWidget()->keyPressEvent(event))
        return true;

    bool handled = false;
    QStringList actions;
    handled = GetMythMainWindow()->TranslateKeyPress("Global", event, actions);

    for (int i = 0; i < actions.size() && !handled; i++)
    {
        QString action = actions[i];
        handled = true;

        if (action == "MENU")
        {
        }
        else
            handled = false;
    }

    if (!handled && MythScreenType::keyPressEvent(event))
        handled = true;

    return handled;
}
Example #29
0
void SearchWidget::changeList2(QNetworkReply *reply)
{
    qDebug()<<"danny error type"<<reply->error();

    if(reply->error()== QNetworkReply::NoError)
    {
        lyricList.clear();
        //QString text = reply->readAll();

        QByteArray bytes = reply->readAll();  //获取字节
        QString result(bytes);  //转化为字符串
        qDebug()<<"changeList2 result:"<<result;
        qDebug()<<"changeList2 reply:"<<bytes;
        QTextCodec *codec = QTextCodec::codecForName("utf-8");
        //QString str = "0891683108500145F1240D91685143256178F0000831214281659423044F60597D";
        QString t = result;
        QStringList s;

        for(int i = 0;i < t.length();i += 4) {
        s.append(t.mid(i,4));
        }
        QString t1;

        foreach (const QString &t, s) {
        t1.append(t.toUShort(0,16));
        }
Example #30
0
	void PendingManager::EnablePackageInto (int id, PendingManager::Action action)
	{
		DepTreeBuilder builder (id);
		if (!builder.IsFulfilled ())
		{
			QStringList unful = builder.GetUnfulfilled ();
			qWarning () << Q_FUNC_INFO
					<< id
					<< "isn't fulfilled, aborting:"
					<< unful;
			QString list = QString ("<ul><li>%1</li></ul>")
					.arg (unful.join ("</li><li>"));
			throw std::runtime_error (tr ("Package dependencies "
					"could not be fulfilled: %1").arg (list)
					.toUtf8 ().constData ());
		}

		const auto& deps = builder.GetPackagesToInstall ();
		Deps_ [id] = deps;

		ScheduledForAction_ [action] << id;

		ListPackageInfo info = Core::Instance ().GetListPackageInfo (id);
		QStandardItem *packageItem = new QStandardItem (QString ("%1 (%2)")
				.arg (info.Name_)
				.arg (info.ShortDescription_));
		packageItem->setIcon (Core::Instance ().GetIconForLPI (info));
		Q_FOREACH (int dep, deps)
		{
			info = Core::Instance ().GetListPackageInfo (dep);
			QStandardItem *item = new QStandardItem (QString ("%1 (%2)")
					.arg (info.Name_)
					.arg (info.ShortDescription_));
			packageItem->appendRow (item);
		}