bool FolderNavigationWidget::setCurrentDirectory(const QString &directory)
{
    const QString newDirectory = directory.isEmpty() ? QDir::rootPath() : directory;
    if (debug)
        qDebug() << "setcurdir" << directory << newDirectory;
    // Set the root path on the model instead of changing the top index
    // of the view to cause the model to clean out its file watchers.
    const QModelIndex index = m_fileSystemModel->setRootPath(newDirectory);
    if (!index.isValid()) {
        setCurrentTitle(QString(), QString());
        return false;
    }
    QModelIndex oldRootIndex = m_listView->rootIndex();
    QModelIndex newRootIndex = m_filterModel->mapFromSource(index);
    m_listView->setRootIndex(newRootIndex);
    const QDir current(QDir::cleanPath(newDirectory));
    setCurrentTitle(current.dirName(),
                    QDir::toNativeSeparators(current.absolutePath()));
    if (oldRootIndex.parent() == newRootIndex) { // cdUp, so select the old directory
        m_listView->setCurrentIndex(oldRootIndex);
        m_listView->scrollTo(oldRootIndex, QAbstractItemView::EnsureVisible);
    }

    return !directory.isEmpty();
}
bool FolderNavigationWidget::setCurrentDirectory(const QString &directory)
{
    const QString newDirectory = directory.isEmpty() ? QDir::rootPath() : directory;
    if (debug)
        qDebug() << "setcurdir" << directory << newDirectory;
    // Set the root path on the model instead of changing the top index
    // of the view to cause the model to clean out its file watchers.
    const QModelIndex index = m_fileSystemModel->setRootPath(newDirectory);
    if (!index.isValid()) {
        setCurrentTitle(QString(), QString());
        return false;
    }
    m_listView->setRootIndex(m_filterModel->mapFromSource(index));
    const QDir current(QDir::cleanPath(newDirectory));
    setCurrentTitle(current.dirName(), current.absolutePath());
    return !directory.isEmpty();
}
Ejemplo n.º 3
0
bool MPlayerMediaWidget::jumpToNextChapter()
{
	if ((getCurrentChapter() + 1) < getChapterCount()) {
		setCurrentChapter(getCurrentChapter() + 1);
		return true;
	}

	if ((getCurrentTitle() + 1) < getTitleCount()) {
		setCurrentTitle(getCurrentTitle() + 1);
		return true;
	}

	return false;
}
Ejemplo n.º 4
0
bool MPlayerMediaWidget::jumpToPreviousChapter()
{
	if ((getCurrentChapter() - 1) >= 0) {
		setCurrentChapter(getCurrentChapter() - 1);
		return true;
	}

	if ((getCurrentTitle() - 1) >= 0) {
		setCurrentTitle(getCurrentTitle() - 1);
		return true;
	}

	return false;
}
Ejemplo n.º 5
0
void WBTabWidget::currentChanged(int index)
{
    WBWebView *webView = this->webView(index);
    if (!webView)
        return;

    Q_ASSERT(mLineEdits->count() == count());

    WBWebView *oldWebView = this->webView(mLineEdits->currentIndex());
    if (oldWebView) {
        disconnect(oldWebView, SIGNAL(statusBarMessage(const QString&)),
                this, SIGNAL(showStatusBarMessage(const QString&)));
        disconnect(oldWebView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
                this, SIGNAL(linkHovered(const QString&)));
        disconnect(oldWebView, SIGNAL(loadProgress(int)),
                this, SIGNAL(loadProgress(int)));
        disconnect(oldWebView, SIGNAL(loadFinished(bool)),
                this, SIGNAL(loadFinished(bool)));
    }

    connect(webView, SIGNAL(statusBarMessage(const QString&)),
            this, SIGNAL(showStatusBarMessage(const QString&)));
    connect(webView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
            this, SIGNAL(linkHovered(const QString&)));
    connect(webView, SIGNAL(loadProgress(int)),
            this, SIGNAL(loadProgress(int)));
    connect(webView, SIGNAL(loadFinished (bool)),
            this, SIGNAL(loadFinished(bool)));

    for (int i = 0; i < mWebActions.count(); ++i) {
        WBWebActionMapper *mapper = mWebActions[i];
        mapper->updateCurrent(webView->page());
    }
    emit setCurrentTitle(webView->title());
    mLineEdits->setCurrentIndex(index);
    emit loadProgress(webView->progress());
    emit showStatusBarMessage(webView->lastStatusBarText());
    if (webView->url().isEmpty())
        mLineEdits->currentWidget()->setFocus();
    else
        webView->setFocus();
}
Ejemplo n.º 6
0
void MediaController::previousTitle()
{
    setCurrentTitle(currentTitle() - 1);
}
Ejemplo n.º 7
0
void MediaController::nextTitle()
{
    setCurrentTitle(currentTitle() + 1);
}