/* * Constructs a TextViewer which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ TextViewer::TextViewer( QWidget *parent, Qt::WFlags f ) : QMainWindow( parent, f ) { textArea = new QTextEdit(this); textArea->setReadOnly(true); setCentralWidget(textArea); docSelector = new QDocumentSelector(); QAction *actionOpen = new QAction(tr("Open Document"), this ); connect(actionOpen, SIGNAL(triggered()), this, SLOT(openDocument())); QMenu* menu = QSoftMenuBar::menuFor(textArea); menu->addAction(actionOpen); connect(docSelector, SIGNAL(documentSelected(QContent)), this, SLOT(documentSelected(QContent))); }
/*! Constructs a NotesDemo dialog which is a child of \a parent and has the given window \a flags. */ NotesDemo::NotesDemo( QWidget *parent, Qt::WindowFlags flags ) : QDialog( parent, flags ) { // Create a new document selector which lists documents with the MIME type text/plain // sorted so the most recently edited documents appear first. documentSelector = new QDocumentSelector; documentSelector->setFilter( QContentFilter::mimeType( "text/plain" ) ); documentSelector->setSortMode( QDocumentSelector::ReverseChronological ); // Enable the new document option so a 'New' document selection appears at the start of the // documents list and in the context menu. documentSelector->enableOptions( QDocumentSelector::NewDocument ); // Connect to the newSelected() and documentSelected() signal so we're notified when the user // selects a document. connect( documentSelector, SIGNAL(newSelected()), this, SLOT(newDocument()) ); connect( documentSelector, SIGNAL(documentSelected(QContent)), this, SLOT(openDocument(QContent)) ); // Construct the text editor widget. editor = new QTextEdit; // Create a new stacked layout and add the document selector and text editor widgets to it. // As the layout is given the dialog as a parent it is automatically set as the layout for // the dialog, and the widgets added to it are re-parented to the dialog. The document // will be the initial widget shown as it was added to the layout first. layout = new QStackedLayout( this ); layout->addWidget( documentSelector ); layout->addWidget( editor ); }
void QImageDocumentSelectorDialog::init() { setWindowTitle( tr( "Select Image" ) ); QVBoxLayout *vb = new QVBoxLayout( this ); vb->setContentsMargins(0, 0, 0, 0); connect( selector, SIGNAL(documentSelected(QContent)), this, SLOT(accept()) ); connect( selector, SIGNAL(documentsChanged()), this, SLOT(setContextBar()) ); vb->addWidget( selector ); // Set thumbnail view selector->setViewMode( QImageDocumentSelector::Thumbnail ); QAction *viewAction = new QAction( QIcon( ":icon/view" ), tr( "View" ), this ); connect( viewAction, SIGNAL(triggered()), this, SLOT(viewImage()) ); QMenu *menu = QSoftMenuBar::menuFor( selector ); menu->actions().count() ? menu->insertAction(menu->actions().at(0), viewAction) : menu->addAction(viewAction); QSoftMenuBar::addMenuTo( this, menu ); setContextBar(); setModal( true ); QtopiaApplication::setMenuLike( this, true ); }
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); }
/* * Constructs a AppViewer which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ AppViewer::AppViewer( QWidget *parent, Qt::WFlags f ) : QDialog( parent, f ) { setWindowTitle( tr( "App Viewer" )); textArea = new QTextEdit(this); textArea->setReadOnly(true); appSelector = new QDocumentSelector(); QAction *actionOpen = new QAction(tr("Open Document"), this ); connect(actionOpen, SIGNAL(triggered()), this, SLOT(openDocument())); QMenu* menu = QSoftMenuBar::menuFor(textArea); menu->addAction(actionOpen); connect( appSelector, SIGNAL(documentSelected(QContent)), this, SLOT(documentSelected(QContent)) ); }
/* * Constructs a TextViewer which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ TextViewer::TextViewer( QWidget *parent, Qt::WFlags f ) : QMainWindow( parent, f ) { textArea = new QTextEdit(this); textArea->setReadOnly(true); setCentralWidget(textArea); docSelector = new QDocumentSelector(); QAction *actionOpen = new QAction(tr("Open Document"), this ); connect(actionOpen, SIGNAL(triggered()), this, SLOT(openDocument())); #ifdef QTOPIA_PHONE QMenu* menu = QSoftMenuBar::menuFor(textArea); menu->addAction(actionOpen); #else ToolBar *toolbar = new QToolBar(this); toolbar->setMovable(false); addToolBar(toolbar); toolbar->addAction(actionOpen); #endif connect(docSelector, SIGNAL(documentSelected(QContent)), this, SLOT(documentSelected(QContent))); }
/*! Construct an image document selector widget with the given \a parent. */ QImageDocumentSelector::QImageDocumentSelector( QWidget* parent ) : QWidget( parent ) { QVBoxLayout *layout = new QVBoxLayout( this ); layout->setMargin( 0 ); layout->setSpacing( 0 ); d = new QImageDocumentSelectorPrivate( this ); layout->addWidget( d ); connect( d, SIGNAL(documentSelected(QContent)), this, SIGNAL(documentSelected(QContent)) ); connect( d, SIGNAL(documentHeld(QContent,QPoint)), this, SIGNAL(documentHeld(QContent,QPoint)) ); connect( d, SIGNAL(documentsChanged()), this, SIGNAL(documentsChanged()) ); setFocusProxy( d ); QSoftMenuBar::addMenuTo( this, QSoftMenuBar::menuFor( d ) ); }
void KWStartupWidget::buttonClicked() { m_doc->initEmpty(); KWPageStyle style = m_doc->pageManager()->defaultPageStyle(); Q_ASSERT(style.isValid()); style.setColumns(m_columns); style.setPageLayout(m_layout); m_doc->setUnit(m_unit); m_doc->relayout(); emit documentSelected(); }
void Stack::actionTriggered(QAction* action) { emit documentSelected(action->data().toInt()); }