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


C++ XdgDesktopFile::isValid方法代码示例

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


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

示例1: it

RazorConfig::MainWindow::MainWindow() : QMainWindow()
{
    setupUi(this);
        
    qDebug() << "Reading desktop files from dir:" << RAZOR_CONFIG_MODULES_DIR;
    
    QDirIterator it(RAZOR_CONFIG_MODULES_DIR, QStringList() << "*.desktop");
    int ix = 0;
    QString name;

    while (it.hasNext()) {
        name = it.next();
        XdgDesktopFile *xdg = new XdgDesktopFile();
        xdg->load(name);
        if (!xdg->isValid())
        {
            qDebug() << "INVALID DESKTOP FILE:" << name;
            delete xdg;
            continue;
        }
        
        new ConfigItem(xdg, listWidget);

        ++ix;
    }
    
    if (listWidget->count() == 0)
        statusBar()->showMessage(tr("No config modules found in: ") + RAZOR_CONFIG_MODULES_DIR);
    
    connect(listWidget, SIGNAL(itemActivated(QListWidgetItem*)),//SIGNAL(itemDoubleClicked(QListWidgetItem*)),
            this, SLOT(listWidget_itemDoubleClicked(QListWidgetItem *)));
}
开发者ID:grimtraveller,项目名称:netbas,代码行数:32,代码来源:mainwindow.cpp

示例2: execAction

void QuickLaunchAction::execAction()
{
    QString exec(data().toString());
    qDebug() << "execAction" << exec;
    switch (m_type)
    {
        case ActionLegacy:
            QProcess::startDetached(exec);
            break;
        case ActionXdg:
        {
            XdgDesktopFile * xdg = XdgDesktopFileCache::getFile(exec);
            if (xdg->isValid())
                xdg->startDetached();
            break;
        }
        case ActionFile:
            QDesktopServices::openUrl(QUrl(exec));
            break;
    }
}
开发者ID:ActionLuzifer,项目名称:razor-qt,代码行数:21,代码来源:quicklaunchaction.cpp

示例3: loadDesktopFile

QVariantMap XdgModule::loadDesktopFile(const QString &fileName){
  QVariantMap result;

  XdgDesktopFile desktop;
  desktop.load(fileName);
  switch(desktop.type()){
  case XdgDesktopFile::UnknownType:
    result["type"] = "unknown";
    break;
  case XdgDesktopFile::ApplicationType:
    result["type"] = "application";
    break;
  case XdgDesktopFile::LinkType:
    result["type"] = "link";
    break;
  case XdgDesktopFile::DirectoryType:
    result["type"] = "directory";
  }
  result["valid"] = desktop.isValid();
  result["categories"] = desktop.categories();
  result["icon"] = desktop.icon().pixmap(icon_size, icon_size);
  result["icon_name"] = desktop.iconName();
  result["name"] = desktop.name();
  result["comment"] = desktop.comment();
  QString url = desktop.url();
  QVariant exec = desktop.value("Exec");
  QVariant no_display = desktop.value("NoDisplay");
  if(!url.isEmpty())
    result["url"] = url;
  if(exec.isValid())
    result["exec"] = exec;
  if(no_display.isValid())
    result["no_display"] = no_display;

  return result;
}
开发者ID:Icenowy,项目名称:Cubway,代码行数:36,代码来源:xdg.cpp

示例4: currentMimetypeChanged

void MimetypeViewer::currentMimetypeChanged()
{
    widget.iconLabel->hide();
    widget.descriptionLabel->setText(tr("None"));
    widget.mimetypeGroupBox->setEnabled(false);

    widget.patternsLabel->clear();
    widget.patternsGroupBox->setEnabled(false);

    widget.appIcon->hide();
    widget.applicationLabel->clear();
    widget.applicationsGroupBox->setEnabled(false);

    QTreeWidgetItem *sel = widget.mimetypeTreeWidget->currentItem();

    if (!sel || sel->type() == GroupType) {
        return;
    }

    MimeTypeData mimeData = sel->data(0, Qt::UserRole).value<MimeTypeData>();

    QMimeDatabase db;
    XdgMimeType mt = db.mimeTypeForName(mimeData.name());
    if (mt.name().isEmpty())
        return;

    m_CurrentMime = mt;

    widget.descriptionLabel->setText(mimeData.comment());

    QIcon icon = m_CurrentMime.icon();
    if (! icon.isNull())
    {
        widget.iconLabel->setPixmap(icon.pixmap(widget.iconLabel->size()));
        widget.iconLabel->show();
    }

    widget.mimetypeGroupBox->setEnabled(true);
    widget.patternsLabel->setText(mimeData.patterns());
    widget.patternsGroupBox->setEnabled(true);

    XdgDesktopFile* defaultApp = XdgDesktopFileCache::getDefaultApp(m_CurrentMime.name());
    if (defaultApp && defaultApp->isValid())
    {
        QString nonLocalizedName = defaultApp->value("Name").toString();
        QString localizedName = defaultApp->localizedValue("Name", nonLocalizedName).toString();
        QIcon appIcon = defaultApp->icon();
        widget.appIcon->setPixmap(appIcon.pixmap(widget.iconLabel->size()));
        widget.appIcon->show();
        widget.applicationLabel->setText(localizedName);
        widget.chooseApplicationsButton->setText(tr("&Change..."));
    }
    else
    {
        widget.applicationLabel->setText(tr("None"));
        widget.chooseApplicationsButton->setText(tr("&Choose..."));
    }

    widget.applicationsGroupBox->setEnabled(true);

}
开发者ID:lxde,项目名称:lxqt-config,代码行数:61,代码来源:mimetypeviewer.cpp


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