Пример #1
0
void MainWindow::search() {
    SearchDialog dialog(this);
    
    if (dialog.exec() == QDialog::Accepted) {
        if (dialog.service() == Resources::SOUNDCLOUD) {
            SoundCloudTracksPage *page = new SoundCloudTracksPage(m_tabWidget);
            m_tabWidget->addTab(page, tr("Search '%1'").arg(dialog.query()));
            m_tabWidget->setCurrentWidget(page);
            connect(page, SIGNAL(statusChanged(Page::Status)), this, SLOT(onTabStatusChanged()));
            connect(page, SIGNAL(statusTextChanged(QString)), statusBar(), SLOT(showMessage(QString)));
            connect(page, SIGNAL(windowTitleChanged(QString)), this, SLOT(updateTabText(QString)));
            
            QVariantMap filters;
            filters["q"] = dialog.query();
            filters["limit"] = MAX_RESULTS;
            page->get("/tracks", filters);
        }
        else {
            PluginTracksPage *page = new PluginTracksPage(dialog.service(), m_tabWidget);
            m_tabWidget->addTab(page, tr("Search '%1'").arg(dialog.query()));
            m_tabWidget->setCurrentWidget(page);
            connect(page, SIGNAL(statusChanged(Page::Status)), this, SLOT(onTabStatusChanged()));
            connect(page, SIGNAL(statusTextChanged(QString)), statusBar(), SLOT(showMessage(QString)));
            connect(page, SIGNAL(windowTitleChanged(QString)), this, SLOT(updateTabText(QString)));
            page->search(dialog.query(), dialog.order());
        }
        
        m_reloadAction->setEnabled(true);
        m_closeAction->setEnabled(true);
    }
}
Пример #2
0
void MainWindow::showTransfers() {
    for (int i = 0; i < m_tabWidget->count(); i++) {
        if (qobject_cast<TransfersPage*>(m_tabWidget->widget(i))) {
            m_tabWidget->setCurrentIndex(i);
            m_reloadAction->setEnabled(true);
            m_closeAction->setEnabled(true);
            return;
        }
    }
    
    TransfersPage *page = new TransfersPage(m_tabWidget);
    m_tabWidget->addTab(page, page->windowTitle());
    m_tabWidget->setCurrentIndex(m_tabWidget->count() - 1);
    connect(page, SIGNAL(statusChanged(Page::Status)), this, SLOT(onTabStatusChanged()));
    connect(page, SIGNAL(statusTextChanged(QString)), statusBar(), SLOT(showMessage(QString)));
    connect(page, SIGNAL(windowTitleChanged(QString)), this, SLOT(updateTabText(QString)));
    m_reloadAction->setEnabled(true);
    m_closeAction->setEnabled(true);
}
Пример #3
0
void MyMdiArea::onWindowModified()
{
	updateTabText(static_cast<MyMdiSubWindow*>(sender()));
}