예제 #1
0
WiredPage::WiredPage(const QModelIndex &technology, ConnMan *manager, QWidget *parent):
    QWidget(parent),
    m_technology(technology),
    m_manager(manager),
    m_service(NULL)
{
    ui.setupUi(this);

    m_wiredTechnology = static_cast<ManagerNode*>(technology.internalPointer())->object<Technology *>();

    ui.icon->setPixmap(QIcon::fromTheme("network-wired").pixmap(QSize(48, 48)));
    ui.enabled->setChecked(m_wiredTechnology->isPowered());

    connect(manager, SIGNAL(servicesChanged()), SLOT(configureService()));
    connect(m_wiredTechnology, SIGNAL(dataChanged()), SLOT(updateUi()));
    connect(m_wiredTechnology, SIGNAL(poweredChanged(bool)), ui.enabled, SLOT(setChecked(bool)));
    connect(ui.enabled, SIGNAL(toggled(bool)), SLOT(toggleTechnology(bool)));

    ui.ipv4Widget->hide();

    configureService();
    updateUi();
}
PreviewsSettingsPage::PreviewsSettingsPage(QWidget* parent) :
    SettingsPageBase(parent),
    m_initialized(false),
    m_listView(0),
    m_enabledPreviewPlugins(),
    m_remoteFileSizeBox(0)
{
    QVBoxLayout* topLayout = new QVBoxLayout(this);

    QLabel* showPreviewsLabel = new QLabel(i18nc("@title:group", "Show previews for:"), this);

    m_listView = new QListView(this);

    ServiceItemDelegate* delegate = new ServiceItemDelegate(m_listView, m_listView);
    connect(delegate, SIGNAL(requestServiceConfiguration(QModelIndex)),
            this, SLOT(configureService(QModelIndex)));

    ServiceModel* serviceModel = new ServiceModel(this);
    QSortFilterProxyModel* proxyModel = new QSortFilterProxyModel(this);
    proxyModel->setSourceModel(serviceModel);
    proxyModel->setSortRole(Qt::DisplayRole);

    m_listView->setModel(proxyModel);
    m_listView->setItemDelegate(delegate);
    m_listView->setVerticalScrollMode(QListView::ScrollPerPixel);

    QLabel* remoteFileSizeLabel = new QLabel(i18nc("@label", "Skip previews for remote files above:"), this);

    m_remoteFileSizeBox = new KIntSpinBox(this);
    m_remoteFileSizeBox->setSingleStep(1);
    m_remoteFileSizeBox->setSuffix(QLatin1String(" MB"));
    m_remoteFileSizeBox->setRange(0, 9999999); /* MB */

    QHBoxLayout* fileSizeBoxLayout = new QHBoxLayout(this);
    fileSizeBoxLayout->addWidget(remoteFileSizeLabel, 0, Qt::AlignRight);
    fileSizeBoxLayout->addWidget(m_remoteFileSizeBox);

    topLayout->addSpacing(KDialog::spacingHint());
    topLayout->addWidget(showPreviewsLabel);
    topLayout->addWidget(m_listView);
    topLayout->addLayout(fileSizeBoxLayout);

    loadSettings();

    connect(m_listView, SIGNAL(clicked(QModelIndex)), this, SIGNAL(changed()));
    connect(m_remoteFileSizeBox, SIGNAL(valueChanged(int)), this, SIGNAL(changed()));
}
예제 #3
0
OnlineServicesPage::OnlineServicesPage(QWidget *p)
    : QWidget(p)
    , onlineSearchRequest(false)
    , searchable(true)
    , expanded(false)
{
    setupUi(this);
    addToPlayQueue->setDefaultAction(StdActions::self()->addToPlayQueueAction);
    replacePlayQueue->setDefaultAction(StdActions::self()->replacePlayQueueAction);
    view->addAction(StdActions::self()->addToPlayQueueAction);
    view->addAction(StdActions::self()->replacePlayQueueAction);
    view->addAction(StdActions::self()->addWithPriorityAction);
    view->addAction(StdActions::self()->addToStoredPlaylistAction);
    downloadAction = new Action(Icon("go-down"), i18n("Download To Library"), this);
    downloadPodcastAction = new Action(Icon("go-down"), i18n("Download Episodes"), this);
    deleteDownloadedPodcastAction = new Action(Icon("edit-delete"), i18n("Delete Downloaded Episodes"), this);
    cancelPodcastDownloadAction = new Action(Icons::self()->cancelIcon, i18n("Cancel Podcast Download"), this);
    markPodcastAsNewAction = new Action(Icon("document-new"), i18n("Mark Episodes As New"), this);
    markPodcastAsListenedAction = new Action(i18n("Mark Episodes As Listened"), this);

    connect(this, SIGNAL(add(const QStringList &, bool, quint8)), MPDConnection::self(), SLOT(add(const QStringList &, bool, quint8)));
    connect(this, SIGNAL(addSongsToPlaylist(const QString &, const QStringList &)), MPDConnection::self(), SLOT(addToPlaylist(const QString &, const QStringList &)));
    connect(genreCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(searchItems()));
    connect(OnlineServicesModel::self(), SIGNAL(updateGenres(const QSet<QString> &)), genreCombo, SLOT(update(const QSet<QString> &)));
    connect(OnlineServicesModel::self(), SIGNAL(updated(QModelIndex)), this, SLOT(updated(QModelIndex)));
//    connect(OnlineServicesModel::self(), SIGNAL(needToSort()), this, SLOT(sortList()));
    connect(OnlineServicesModel::self(), SIGNAL(busy(bool)), view, SLOT(showSpinner(bool)));
    connect(OnlineServicesModel::self(), SIGNAL(providersChanged()), this, SLOT(providersChanged()));
    connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(itemDoubleClicked(const QModelIndex &)));
    connect(view, SIGNAL(searchItems()), this, SLOT(searchItems()));
    connect(view, SIGNAL(searchIsActive(bool)), this, SLOT(controlSearch(bool)));
    connect(view, SIGNAL(itemsSelected(bool)), SLOT(controlActions()));
    connect(view, SIGNAL(rootIndexSet(QModelIndex)), this, SLOT(updateGenres(QModelIndex)));
    connect(view, SIGNAL(rootIndexSet(QModelIndex)), this, SLOT(setSearchable(QModelIndex)));
    connect(OnlineServicesModel::self()->configureAct(), SIGNAL(triggered()), this, SLOT(configureService()));
    connect(OnlineServicesModel::self()->refreshAct(), SIGNAL(triggered()), this, SLOT(refreshService()));
    connect(OnlineServicesModel::self()->subscribeAct(), SIGNAL(triggered()), this, SLOT(subscribe()));
    connect(OnlineServicesModel::self()->unSubscribeAct(), SIGNAL(triggered()), this, SLOT(unSubscribe()));
    connect(OnlineServicesModel::self()->refreshSubscriptionAct(), SIGNAL(triggered()), this, SLOT(refreshSubscription()));
    connect(downloadAction, SIGNAL(triggered()), this, SLOT(download()));
    connect(downloadPodcastAction, SIGNAL(triggered()), this, SLOT(downloadPodcast()));
    connect(deleteDownloadedPodcastAction, SIGNAL(triggered()), this, SLOT(deleteDownloadedPodcast()));
    connect(cancelPodcastDownloadAction, SIGNAL(triggered()), this, SLOT(cancelPodcastDownload()));
    connect(markPodcastAsNewAction, SIGNAL(triggered()), this, SLOT(markPodcastAsNew()));
    connect(markPodcastAsListenedAction, SIGNAL(triggered()), this, SLOT(markPodcastAsListened()));

    QMenu *menu=new QMenu(this);
    menu->addAction(OnlineServicesModel::self()->configureAct());
    menu->addAction(OnlineServicesModel::self()->refreshAct());
    menu->addSeparator();
    menu->addAction(OnlineServicesModel::self()->subscribeAct());
    menu->addAction(OnlineServicesModel::self()->unSubscribeAct());
    menu->addAction(OnlineServicesModel::self()->refreshSubscriptionAct());
    menu->addAction(downloadPodcastAction);
    menu->addAction(cancelPodcastDownloadAction);
    menu->addAction(deleteDownloadedPodcastAction);
    menu->addSeparator();
    menu->addAction(markPodcastAsNewAction);
    menu->addAction(markPodcastAsListenedAction);
    menu->addSeparator();
    QAction *configAction=new QAction(Icons::self()->configureIcon, i18n("Configure..."), this);
    menu->addAction(configAction);
    connect(configAction, SIGNAL(triggered()), this, SLOT(showPreferencesPage()));

    view->addAction(downloadAction);
    view->addSeparator();
    view->addAction(OnlineServicesModel::self()->subscribeAct());
    view->addAction(OnlineServicesModel::self()->unSubscribeAct());
    view->addAction(OnlineServicesModel::self()->refreshSubscriptionAct());
    view->addAction(downloadPodcastAction);
    view->addAction(deleteDownloadedPodcastAction);
    view->addAction(cancelPodcastDownloadAction);
    view->addAction(deleteDownloadedPodcastAction);
    view->addSeparator();
    view->addAction(markPodcastAsNewAction);
    view->addAction(markPodcastAsListenedAction);
    menuButton->setMenu(menu);
    proxy.setSourceModel(OnlineServicesModel::self());
//    proxy.setDynamicSortFilter(false);
    view->setModel(&proxy);
    view->setRootIsDecorated(true);
    view->setSearchResetLevel(1);
}