QPixmapWheelData WheelBrowserScreen::getData(const QString &name) { if("Main" == name) { return *m_data; } else if(name.startsWith("Folder/")) { QString category = name.mid(7 /* ::strlen("Folder/") */); QContentFilter filters = QContentFilter(QContent::Application) & QContentFilter(QContentFilter::Category, category); QPixmapWheelData data; QContentSet set(filters, QStringList() << QLatin1String("name")); QContentList items = set.items(); for(int ii = 0; ii < items.count(); ++ii) { const QContent & app = items.at(ii); QString file = app.fileName(); QString name = app.name(); QPixmap pix = app.icon().pixmap(QSize(48, 48)); if(file.isEmpty()) file = app.type(); if(!file.isEmpty() && !name.isEmpty() && !pix.isNull()) { data.appendItem(file, pix, name); } } return data; } return QPixmapWheelData(); }
void TextViewer::openDocument() { // request that the matching documents be sorted in reverse alphanumeric order QContentFilter docFilter = QContentFilter(QContentFilter::MimeType, "text/*"); docSelector->setFilter(docFilter); docSelector->showMaximized(); }
/*! Constructs an unfiltered QContentSet with the specified \a parent and update \a mode. The QContentSet can be populated with content from the backing store by specifying a filtering criteria with setCriteria() or addCriteria(). \sa setCriteria(), addCriteria(), setSortCriteria() */ QContentSet::QContentSet( UpdateMode mode, QObject *parent ) : QObject( parent ) { d = QContentStore::instance()->contentSet( QContentFilter(), QContentSortCriteria(QContentSortCriteria::Name, Qt::AscendingOrder), mode ); init(); }
/*! Constructs a new QContentSet with the specified \a parent containing all content from the backing store which matches the \a tag filtering criteria \a filter. \sa addCriteria(), setSortCriteria() */ QContentSet::QContentSet( QContentFilter::FilterType tag, const QString& filter, QObject *parent ) : QObject( parent ) { d = QContentStore::instance()->contentSet( QContentFilter( tag, filter ), QContentSortCriteria(QContentSortCriteria::Name, Qt::AscendingOrder), Synchronous ); init(); }
/*! Constructs a new QContentSet with the specified \a parent containing all content from the backing store which matches the \a tag filtering criteria \a filter and is sorted by \a sortOrder. \bold Example: Construct a QContentSet containing wave files sorted by most recently modified. \code QContentSet contentSet( QContentFilter::MimeType, "audio/wav", "time desc" ); \endcode \bold {Note:} The use of a QStringList to specify the sort order is deprecated, use a QContentSortCriteria instead. \deprecated \sa addCriteria(), setSortOrder() */ QContentSet::QContentSet( QContentFilter::FilterType tag, const QString& filter, const QStringList &sortOrder, QObject *parent ) : QObject( parent ) { d = QContentStore::instance()->contentSet( QContentFilter( tag, filter ), QContentSetEngine::convertSortOrder( sortOrder ), Synchronous ); init(); }
/*! Constructs a new unfiltered QContentSet with the specified \a parent. The QContentSet can be populated with content from the backing store by specifying a filtering criteria with setCriteria() or addCriteria(). \sa setCriteria(), addCriteria(), setSortCriteria() */ QContentSet::QContentSet( QObject *parent ) : QObject( parent ) { d = QContentStore::instance()->contentSet( QContentFilter(), QContentSortCriteria(QContentSortCriteria::Name, Qt::AscendingOrder), Synchronous ); init(); }
// Loads all mime types as properties into the model. void MimeTypeFilterModel::reload() { mList.append(ContentFilterProperty(tr( "All" ), QContentFilter(), QIcon(":icon/stop"))); addProperty(tr( "Text" ),QMimeType("text/*"), QIcon(":icon/txt")); addProperty(tr( "Audio" ),QMimeType("audio/*"), QIcon(":icon/sound")); addProperty(tr( "Image" ),QMimeType("image/*"), QIcon(":icon/camera")); addProperty(tr( "Video" ),QMimeType("video/*"), QIcon(":icon/multimedia")); }
ApplicationLauncherView::ApplicationLauncherView(const QString &category, QWidget *parent) : LauncherView(parent), rightMenu(0) { QMenu * softMenu = QSoftMenuBar::menuFor(this); rightMenu = new QMenu(this); QAction *a_speed = new QAction(QIcon(":icon/phone/speeddial"), tr("Add to Speed Dial..."), this ); connect( a_speed, SIGNAL(triggered()), this, SLOT(addSpeedDial())); softMenu->addAction(a_speed); rightMenu->addAction(a_speed); QObject::connect(this, SIGNAL(rightPressed(QContent)), this, SLOT(launcherRightPressed(QContent))); QContentFilter filters = (QContentFilter( QContent::Application ) | QContentFilter( QContent::Folder )) & QContentFilter( QContentFilter::Category, category ); contentSet->setCriteria( filters ); }
void CategoryFilterListModel::reload() { mList.clear(); // Add "All" and "Unfiled" categories first mList.append(ContentFilterProperty(tr("All"), QContentFilter(), QIcon())); mList.append(ContentFilterProperty(tr("Unfiled"), QContentFilter( QContentFilter::Category, QLatin1String("Unfiled")), categoryManager->icon(QLatin1String("unfiled")))); QList<QString> categoryIds = categoryManager->categoryIds(); QList<QString> categoryLabels = categoryManager->labels(categoryIds); // Add all categories that are document related for (int i=0;i<categoryIds.count();++i) { mList.append(ContentFilterProperty(categoryLabels[i], QContentFilter( QContentFilter::Category, categoryIds[i]), categoryManager->icon(categoryIds[i]))); } }
MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags): QMainWindow(parent, flags), d(new MainWindowPrivate) { d->selector = new QDocumentSelector(this); d->selector->setFilter(QContentFilter(QContent::Document) & (QContentFilter::mimeType("video/*") | QContentFilter::mimeType("audio/*"))); connect(d->selector, SIGNAL(documentSelected(QContent)), SLOT(documentSelected(QContent))); setCentralWidget(d->selector); d->audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); d->videoWidget = new Phonon::VideoWidget(this); d->mediaObject = new Phonon::MediaObject(this); // metaInformationResolver = new Phonon::MediaObject(this); d->mediaObject->setTickInterval(1000); // MediaObject connect(d->mediaObject, SIGNAL(currentSourceChanged(const Phonon::MediaSource &)), SLOT(currentSourceChanged(const Phonon::MediaSource &))); connect(d->mediaObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), SLOT(stateChanged(Phonon::State, Phonon::State))); connect(d->mediaObject, SIGNAL(tick(qint64)), SLOT(tick(qint64))); /* connect(d->mediaObject, SIGNAL(metaDataChanged(QMultiMap<QString,QString>)), SLOT(metaDataChanged(QMultiMap<QString,QString>))); */ connect(d->mediaObject, SIGNAL(seekableChanged(bool)), SLOT(seekableChanged(bool))); connect(d->mediaObject, SIGNAL(hasVideoChanged(bool)), SLOT(hasVideoChanged(bool))); connect(d->mediaObject, SIGNAL(finished()), SLOT(finished())); connect(d->mediaObject, SIGNAL(prefinishMarkReached(qint32)), SLOT(prefinishMarkReached(qint32))); connect(d->mediaObject, SIGNAL(aboutToFinish()), SLOT(aboutToFinish())); connect(d->mediaObject, SIGNAL(totalTimeChanged(qint64)), SLOT(totalTimeChanged(qint64))); connect(d->mediaObject, SIGNAL(bufferStatus(int)), SLOT(bufferStatus(int))); // Meta info /* connect(metaInformationResolver, SIGNAL(stateChanged(Phonon::State,Phonon::State)), SLOT(metaStateChanged(Phonon::State, Phonon::State))); */ Phonon::createPath(d->mediaObject, d->audioOutput); Phonon::createPath(d->mediaObject, d->videoWidget); }
/* * Call the appSelector widget to allow the user to choose an application * to display information about */ void AppViewer::openApplicationInfo() { QContentFilter appFilter = QContentFilter( QContent::Application ); appSelector->setFilter( appFilter ); appSelector->showMaximized(); }
CameraMainWindow::CameraMainWindow(QWidget *parent, Qt::WFlags f): QMainWindow(parent, f), settings( NULL ), settingsDialog( NULL ), psize( -1 ), vsize( -1 ), snapRequest( 0 ), videoOnSecondary(false), m_photoContentSet( QContentSet::Asynchronous ), m_photoModel( 0 ), m_contextMenuActive(false) { setWindowTitle(tr("Camera")); QtopiaApplication::setPowerConstraint(QtopiaApplication::DisableLightOff); picfile = Qtopia::tempDir() + "image.jpg"; QWidget *cameraWidget = new QWidget(this); camera = new Ui::CameraBase(); camera->setupUi(cameraWidget); setCentralWidget(cameraWidget); camcat = QLatin1String("Camera"); // Ensure the Camera system categoy exists QCategoryManager catman("Documents"); // For new code a more unique id should be used instead of using the untranslated text // eg. ensureSystemCategory("com.mycompany.myapp.mycategory", "My Category"); catman.ensureSystemCategory(camcat, camcat); new CameraService(this); camera->photo->setFocus(); connect(camera->photo, SIGNAL(clicked()), this, SLOT(takePhoto())); connect(camera->video, SIGNAL(clicked()), this, SLOT(toggleVideo())); refocusTimer = new QTimer(this); refocusTimer->setSingleShot(true); connect(refocusTimer, SIGNAL(timeout()), this, SLOT(takePhotoNow())); thumb[0] = camera->thumb1; thumb[1] = camera->thumb2; thumb[2] = camera->thumb3; thumb[3] = camera->thumb4; thumb[4] = camera->thumb5; cur_thumb = -1; // Load the allowable sizes from the camera hardware. photo_size = camera->videocaptureview->photoSizes(); video_size = camera->videocaptureview->videoSizes(); namehint=0; recording = false; if ( !video_supported ) { // Room for longer text camera->photo->setText(tr("Take Photo")); camera->video->setEnabled(false); camera->video->hide(); } if (QApplication::desktop()->numScreens() > 1) { // We have a secondary display - watch for the clamshell open/close clamshellVsi = new QValueSpaceItem("/Hardware/Devices/ClamshellOpen", this); connect(clamshellVsi, SIGNAL(contentsChanged()), this, SLOT(clamshellChanged())); if (!clamshellVsi->value().toBool()) { videoToScreen(1); } } m_photoContentSet.setCriteria( QContentFilter( QContent::Document ) & QContentFilter::category( QLatin1String( "Camera" ) ) & QContentFilter::mimeType( QLatin1String( "image/jpeg" ) ) ); m_photoContentSet.setSortCriteria( QContentSortCriteria( QContentSortCriteria::LastUpdated, Qt::DescendingOrder ) ); m_photoModel = new QContentSetModel( &m_photoContentSet, this ); connect( m_photoModel, SIGNAL(updateFinished()), this, SLOT(loadThumbs()) ); m_wait = new QWaitWidget(camera->videocaptureview); m_iswaiting = false; QTimer::singleShot(1, this, SLOT(delayedInit())); m_currzoom = 0; zoomActive = false; zoomTimer.setSingleShot(true); zoomTimer.setInterval(5000); connect(&zoomTimer, SIGNAL(timeout()), this, SLOT(hideZoom())); }
NullQContentSetEngine() : QContentSetEngine( QContentFilter(), QContentSortCriteria(), QContentSet::Synchronous ) { }
// Creates and appends a new property from the parameters. void MimeTypeFilterModel::addProperty(const QString &label, const QMimeType &mimeType,const QIcon &icon) { mList.append(ContentFilterProperty(label, QContentFilter(mimeType), icon)); }