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


C++ QUrl::fileName方法代码示例

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


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

示例1: cmpUrlByName

bool SimpleViewer::cmpUrlByName(const QUrl& url1, const QUrl& url2)
{
    QString name1 = url1.fileName();
    QString name2 = url2.fileName();

    return (name1 < name2);
}
开发者ID:Vogtinator,项目名称:kipi-plugins,代码行数:7,代码来源:simpleviewer.cpp

示例2: loginUrlChanged

void VKApi::loginUrlChanged(const QUrl& url) {
    qDebug() << "login url filename: \n" << url.fileName() << "\n";
    if (url.fileName() == "blank.html") {
        QUrlQuery q(url.fragment());
        accessToken = q.queryItemValue("access_token");
        qDebug() << "got access token: " << accessToken << "\n";

        QMap<QString, QString> params;
        method("users.get", params, [this]( const QJsonDocument* json, QNetworkReply::NetworkError) {
            loginView->close();
            loginView = 0;

            if (json) {
                auto obj = json->object();
                qDebug() << obj.keys().join(",");
                user->_name = obj["first_name"].toString() + " " + obj["last_name"].toString();
                user->_uid = QString::number( obj["uid"].toInt() );
            } else {
                this->logout();
                this->login();
            }

            emit loginStatusChanged();
        });

        loginView->setVisible(false);
    }
}
开发者ID:JohnPoison,项目名称:QVKApi,代码行数:28,代码来源:VKApi.cpp

示例3: data

QVariant MusicModel::data(const QModelIndex &index, int role) const
{
    if(Qt::DisplayRole == role)
    {
        if(index.column() == TITLE)
        {
            QUrl url = m_data.at(index.row())->canonicalUrl();
            if(url.isLocalFile())
            {
                return url.fileName();
            }
            else if(url.host().contains("tabletopaudio.com"))
            {
                QString str = url.toString();
                str = str.right(str.size() - (str.lastIndexOf("=")+1));
                return  str.replace(".mp3","").replace("_"," ");
            }
            else
            {
                return url.fileName();
            }
        }
    }
    else if((index == m_currentSong)&&(Qt::FontRole == role))
    {
        QFont font;
        font.setBold(true);
        return font;
    }

    return QVariant();
}
开发者ID:pit-le-rouge,项目名称:rolisteam,代码行数:32,代码来源:musicmodel.cpp

示例4: QDialog

BackupWidget::BackupWidget(const QUrl &projectUrl, const QUrl &projectFolder, const QString &projectId, QWidget * parent) :
        QDialog(parent)
{
    setupUi(this);
    setWindowTitle(i18n("Restore Backup File"));

    if (!projectUrl.isValid()) {
        // No url, means we opened the backup dialog from an empty project
        info_label->setText(i18n("Showing all backup files in folder"));
        m_projectWildcard = '*';
    } else {
        info_label->setText(i18n("Showing backup files for %1", projectUrl.fileName()));
        m_projectWildcard = projectUrl.fileName().section('.', 0, -2);
        if (!projectId.isEmpty()) m_projectWildcard.append('-' + projectId);
        else {
            // No project id, it was lost, add wildcard
            m_projectWildcard.append('*');
        }
    }
    project_url->setUrl(projectFolder);
    m_projectWildcard.append("-??");
    m_projectWildcard.append("??");
    m_projectWildcard.append("-??");
    m_projectWildcard.append("-??");
    m_projectWildcard.append("-??");
    m_projectWildcard.append("-??.kdenlive");

    slotParseBackupFiles();
    connect(backup_list, SIGNAL(currentRowChanged(int)), this, SLOT(slotDisplayBackupPreview()));
    connect(project_url, SIGNAL(textChanged(QString)), this, SLOT(slotParseBackupFiles()));
    backup_list->setCurrentRow(0);
    backup_list->setMinimumHeight(QFontMetrics(font()).lineSpacing() * 12);
}
开发者ID:dreamsxin,项目名称:kdenlive,代码行数:33,代码来源:backupwidget.cpp

示例5: run

    void run()
    {
        MetaEngine meta;

        if (!meta.load(url.toLocalFile()))
        {
            qDebug() << url.fileName() << " : cannot load metadata!";
        }
        else
        {
            if (direction == QLatin1String("READ"))
            {
                 qDebug() << url.fileName() << " :: Dim: " << meta.getImageDimensions() 
                                            << " :: Dat: " << meta.getImageDateTime()
                                            << " :: Com: " << meta.getCommentsDecoded()
                                            << " :: Ori: " << meta.getImageOrientation()
                                            << " :: Col: " << meta.getImageColorWorkSpace();
            }
            else
            {
                 qDebug() << "Patch file: " << url.fileName();
                 meta.setImageProgramId(QLatin1String("digiKam"), QLatin1String("Exiv2"));
                 meta.applyChanges();
            } 
        }

        emit signalDone();
    }
开发者ID:KDE,项目名称:digikam,代码行数:28,代码来源:metareaderthread.cpp

示例6: values

QVariantHash ChooseSamba::values() const
{
    QVariantHash ret = m_args;

    QString address = ui->addressLE->text().trimmed();
    QUrl url;
    if (address.startsWith(QLatin1String("//"))) {
        url = QUrl(QLatin1String("smb:") % address);
    } else if (address.startsWith(QLatin1String("/"))) {
        url = QUrl(QLatin1String("smb:/") % address);
    } else if (address.startsWith(QLatin1String("://"))) {
        url = QUrl(QLatin1String("smb") % address);
    } else if (address.startsWith(QLatin1String("smb://"))) {
        url = QUrl(address);
    } else if (!QUrl::fromUserInput(address).scheme().isEmpty() &&
               QUrl::fromUserInput(address).scheme() != QStringLiteral("smb")) {
        url = QUrl::fromUserInput(address);
        url.setScheme(QStringLiteral("smb"));
    } else {
        url = QUrl(QStringLiteral("smb://") % address);
    }

    qDebug() << 1 << url;
    if (!ui->usernameLE->text().isEmpty()) {
        url.setUserName(ui->usernameLE->text());
    }

    if (!ui->passwordLE->text().isEmpty()) {
        url.setPassword(ui->passwordLE->text());
    }

    qDebug() << 2 << url;
    qDebug() << 3 << url.url() << url.path().section(QLatin1Char('/'), -1, -1);// same as url.fileName()
    qDebug() << 4 << url.fileName();
    qDebug() << 5 << url.host() << url.url().section(QLatin1Char('/'), 3, 3).toLower();

    ret[KCUPS_DEVICE_URI] = url.url();
    ret[KCUPS_DEVICE_INFO] = url.fileName();

    // if there is 4 '/' means the url is like
    // smb://group/host/printer, so the location is at a different place
    if (url.url().count(QLatin1Char('/') == 4)) {
        ret[KCUPS_DEVICE_LOCATION] = url.url().section(QLatin1Char('/'), 3, 3).toLower();
    } else {
        ret[KCUPS_DEVICE_LOCATION] = url.host();
    }

    return ret;
}
开发者ID:KDE,项目名称:print-manager,代码行数:49,代码来源:ChooseSamba.cpp

示例7: fromDashFeed

DocsetMetadata DocsetMetadata::fromDashFeed(const QUrl &feedUrl, const QByteArray &data)
{
    DocsetMetadata metadata;

    metadata.m_name = feedUrl.fileName();
    metadata.m_name.chop(4); // Strip ".xml" extension

    metadata.m_title = metadata.m_name;
    metadata.m_title.replace(QLatin1Char('_'), QLatin1Char(' '));

    metadata.m_feedUrl = feedUrl;

    QXmlStreamReader xml(data);

    while (!xml.atEnd()) {
        const QXmlStreamReader::TokenType token = xml.readNext();
        if (token == QXmlStreamReader::StartDocument || token != QXmlStreamReader::StartElement)
            continue;

        // Try to pull out the relevant data
        if (xml.name() == QLatin1String("version")) {
            if (xml.readNext() != QXmlStreamReader::Characters)
                continue;
            metadata.m_versions << xml.text().toString();
        } else if (xml.name() == QLatin1String("url")) {
            if (xml.readNext() != QXmlStreamReader::Characters)
                continue;
            metadata.m_urls.append(QUrl(xml.text().toString()));
        }
    }

    return metadata;
}
开发者ID:sonictk,项目名称:zeal,代码行数:33,代码来源:docsetmetadata.cpp

示例8: QDialog

ImageViewer::ImageViewer (const QUrl &url, const QString &capText, QWidget *parent) :
    QDialog( parent ),
    m_ImageUrl(url),
    fileIsImage(false)
{
    init(url.fileName(), capText);        

    // check URL
    if (!m_ImageUrl.isValid())
        qDebug() << "URL is malformed: " << m_ImageUrl;

    if (m_ImageUrl.isLocalFile())
    {
        loadImage(m_ImageUrl.path());
        return;
    }
    
    {
        QTemporaryFile tempfile;
        tempfile.open();
        file.setFileName( tempfile.fileName() );
    }// we just need the name and delete the tempfile from disc; if we don't do it, a dialog will be show

    loadImageFromURL();
}
开发者ID:Bugsbane,项目名称:kstars,代码行数:25,代码来源:imageviewer.cpp

示例9: onAddButton

void MainWindow::onAddButton()
{
	QUrl res = QFileDialog::getExistingDirectoryUrl(this, "Select output directory");

	if(res.isEmpty())
		return;

	int rows = gridLayout->rowCount();

	QPushButton *copyButton = new QPushButton(res.fileName() + QString(" (%1)").arg(curIndex), this);
	QLabel *destLabel = new QLabel(res.toLocalFile(), this);

	gridLayout->addWidget(copyButton, rows, 0);
	gridLayout->addWidget(destLabel, rows, 1);

	QShortcut *thisCut = new QShortcut(QKeySequence(QString("%1").arg(curIndex)), this);
	curIndex += 1;

	auto act = [this, res]()
	{
		doCopyCurrentImage(res);
	};

	connect(copyButton, &QPushButton::pressed, this, act);
	connect(thisCut, &QShortcut::activated, this, act);
}
开发者ID:BtbN,项目名称:ImageCopyHelper,代码行数:26,代码来源:mainwindow.cpp

示例10: KFileItemPrivate

 KFileItemPrivate(const KIO::UDSEntry &entry,
                  mode_t mode, mode_t permissions,
                  const QUrl &itemOrDirUrl,
                  bool urlIsDirectory,
                  bool delayedMimeTypes)
     : m_entry(entry),
       m_url(itemOrDirUrl),
       m_strName(),
       m_strText(),
       m_iconName(),
       m_strLowerCaseName(),
       m_mimeType(),
       m_fileMode(mode),
       m_permissions(permissions),
       m_bLink(false),
       m_bIsLocalUrl(itemOrDirUrl.isLocalFile()),
       m_bMimeTypeKnown(false),
       m_delayedMimeTypes(delayedMimeTypes),
       m_useIconNameCache(false),
       m_hidden(Auto),
       m_slow(SlowUnknown)
 {
     if (entry.count() != 0) {
         readUDSEntry(urlIsDirectory);
     } else {
         Q_ASSERT(!urlIsDirectory);
         m_strName = itemOrDirUrl.fileName();
         m_strText = KIO::decodeFileName(m_strName);
     }
     init();
 }
开发者ID:KDE,项目名称:kio,代码行数:31,代码来源:kfileitem.cpp

示例11: activate

/* ---------------------------------------------------------------------------------- */
bool kio_sieveProtocol::activate(const QUrl &url)
{
    changeCheck(url);
    if (!connect()) {
        return false;
    }

    infoMessage(i18n("Activating script..."));

    QString filename = url.fileName();

    if (filename.isEmpty()) {
        error(ERR_DOES_NOT_EXIST, url.toDisplayString());
        return false;
    }

    if (!sendData("SETACTIVE \"" + filename.toUtf8() + "\"")) {
        return false;
    }

    if (operationSuccessful()) {
        ksDebug << "Script activation complete." << endl;
        return true;
    } else {
        error(ERR_INTERNAL_SERVER, i18n("There was an error activating the script."));
        return false;
    }
}
开发者ID:quazgar,项目名称:kdepimlibs,代码行数:29,代码来源:sieve.cpp

示例12: appendUrls

void PlayListModel::appendUrls(QList<QUrl> urls)
{
    QProgressDialog progress("Adding files to playlist...", "Cancel", 0, urls.count());
    progress.setWindowModality(Qt::ApplicationModal);
    progress.show();

    QList<PlayListItem *> new_items;
    QListIterator<QUrl> urls_iterator(urls);
    while (urls_iterator.hasNext()) {
        QUrl url = urls_iterator.next();
        if (url.isLocalFile()) {
            QString extension = url.fileName().split(".").last().toLower();
            if (extension == "m3u") {
                new_items += urlsToItems(m3uToUrls(url));
            } else {
                new_items += urlToItems(url);
            }
        }

        progress.setValue(progress.value() + 1);
        if (progress.wasCanceled())
            break;
    }

    progress.setValue(urls.count());
    appendItems(new_items);
}
开发者ID:skotopes,项目名称:arfarius,代码行数:27,代码来源:playlistmodel.cpp

示例13: addItems

void PresentationAudioPage::addItems(const QList<QUrl>& fileList)
{
    if (fileList.isEmpty())
        return;

    QList<QUrl> Files = fileList;

    for (QList<QUrl>::ConstIterator it = Files.constBegin(); it != Files.constEnd(); ++it)
    {
        QUrl currentFile              = *it;
        d->sharedData->soundtrackPath = currentFile;
        PresentationAudioListItem* const item         = new PresentationAudioListItem(m_SoundFilesListBox, currentFile);
        item->setName(currentFile.fileName());
        m_SoundFilesListBox->insertItem(m_SoundFilesListBox->count() - 1, item);

        d->soundItems->insert(currentFile, item);

        connect(d->soundItems->value(currentFile), SIGNAL(signalTotalTimeReady(QUrl,QTime)),
                this, SLOT(slotAddNewTime(QUrl,QTime)));

        d->urlList.append(currentFile);
    }

    m_SoundFilesListBox->setCurrentItem(m_SoundFilesListBox->item(m_SoundFilesListBox->count() - 1)) ;

    slotSoundFilesSelected(m_SoundFilesListBox->currentRow());
    m_SoundFilesListBox->scrollToItem(m_SoundFilesListBox->currentItem());
    m_previewButton->setEnabled(true);
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例14: fi

void OpenUrl::
        onOpenUrl(QUrl url)
{
#ifdef Q_OS_IOS
    // cleanup old files
    QFileInfo fi(url.toLocalFile ());
    for (auto info : fi.dir ().entryInfoList())
    {
        if (info == fi || !info.isFile ())
            continue;

        Log("openurl: removing old file %s") % info.fileName ().toStdString ();
        fi.dir ().remove (info.fileName ());
    }
#endif

    LOG_CALLS Log("OpenUrl::onOpenUrl %s") % url.toString ().toStdString ();

    // first see if this was a valid file
    Signal::OperationDesc::ptr desc = parseFile(url);
    if (!desc)
    {
        emit openFileInfo(QString("Failed to open %1").arg (url.toString ()));
        return;
    }

    // purge target
    chain_->chain ()->removeOperationsAt(chain_->target_marker ());

    chain_->chain ()->addOperationAt(desc, chain_->target_marker ());
    chain_->setTitle (url.fileName ());
    chain_->chain ()->workers()->addComputingEngine(Signal::ComputingEngine::ptr(new Signal::DiscAccessThread));

    emit openFileInfo(url.toString ());
}
开发者ID:aveminus,项目名称:freq,代码行数:35,代码来源:openurl.cpp

示例15: urlStat

void kio_sieveProtocol::urlStat(const QUrl &url)
{
    changeCheck(url);
    if (!connect()) {
        return;
    }

    UDSEntry entry;

    QString filename = url.fileName();

    if (filename.isEmpty()) {
        entry.insert(KIO::UDSEntry::UDS_NAME, QStringLiteral("/"));

        entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);

        entry.insert(KIO::UDSEntry::UDS_ACCESS, 0700);

        statEntry(entry);

    } else {
        if (!sendData("LISTSCRIPTS")) {
            return;
        }

        while (receiveData()) {
            if (r.getType() == kio_sieveResponse::ACTION) {
                if (r.getAction().toLower().count("ok") == 1) {
                    // Script list completed
                    break;
                }

            } else {
                if (filename == QString::fromUtf8(r.getKey())) {
                    entry.clear();

                    entry.insert(KIO::UDSEntry::UDS_NAME, QString::fromUtf8(r.getKey()));

                    entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG);

                    if (r.getExtra() == "ACTIVE") {
                        entry.insert(KIO::UDSEntry::UDS_ACCESS, 0700);
                    } else {
                        entry.insert(KIO::UDSEntry::UDS_ACCESS, 0600);
                    }

                    entry.insert(KIO::UDSEntry::UDS_MIME_TYPE, QStringLiteral("application/sieve"));

                    //setMetaData("active", (r.getExtra() == "ACTIVE") ? "yes" : "no");

                    statEntry(entry);
                    // cannot break here because we need to clear
                    // the rest of the incoming data.
                }
            }
        }
    }

    finished();
}
开发者ID:quazgar,项目名称:kdepimlibs,代码行数:60,代码来源:sieve.cpp


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