/** * Constructor. */ QG_BlockWidget::QG_BlockWidget(QG_ActionHandler* ah, QWidget* parent, const char* name, Qt::WFlags f) : QWidget(parent, f) { setObjectName(name); actionHandler = ah; blockList = NULL; lastBlock = NULL; blockModel = new QG_BlockModel; blockView = new QTableView(this); blockView->setModel (blockModel); blockView->setShowGrid (false); blockView->setSelectionMode(QAbstractItemView::SingleSelection); blockView->setEditTriggers(QAbstractItemView::NoEditTriggers); blockView->setFocusPolicy(Qt::NoFocus); blockView->setColumnWidth(QG_BlockModel::VISIBLE, 20); blockView->verticalHeader()->hide(); blockView->horizontalHeader()->setStretchLastSection(true); blockView->horizontalHeader()->hide(); QVBoxLayout* lay = new QVBoxLayout(this); lay->setSpacing ( 0 ); lay->setContentsMargins(2, 2, 2, 2); QHBoxLayout* layButtons = new QHBoxLayout(); QHBoxLayout* layButtons2 = new QHBoxLayout(); QToolButton* but; // show all blocks: but = new QToolButton(this); but->setIcon(QIcon(":/ui/visibleblock.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Show all blocks")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotBlocksDefreezeAll())); layButtons->addWidget(but); // hide all blocks: but = new QToolButton(this); but->setIcon( QIcon(":/ui/hiddenblock.png") ); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Hide all blocks")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotBlocksFreezeAll())); layButtons->addWidget(but); // add block: but = new QToolButton(this); but->setIcon(QIcon(":/ui/blockadd.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Add a block")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotBlocksAdd())); layButtons->addWidget(but); // remove block: but = new QToolButton(this); but->setIcon(QIcon(":/ui/blockremove.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Remove the active block")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotBlocksRemove())); layButtons->addWidget(but); // edit attributes: but = new QToolButton(this); but->setIcon(QIcon(":/ui/blockattributes.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Rename the active block")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotBlocksAttributes())); layButtons->addWidget(but); // edit block: but = new QToolButton(this); but->setIcon(QIcon(":/ui/blockedit.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Edit the active block\n" "in a separate window")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotBlocksEdit())); layButtons2->addWidget(but); // save block: but = new QToolButton(this); but->setIcon(QIcon(":/main/filesave.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("save the active block to a file")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotBlocksSave())); layButtons2->addWidget(but); // insert block: but = new QToolButton(this); but->setIcon(QIcon(":/ui/blockinsert.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Insert the active block")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotBlocksInsert())); layButtons2->addWidget(but); lay->addLayout(layButtons); lay->addLayout(layButtons2); lay->addWidget(blockView); connect(blockView, SIGNAL(clicked(QModelIndex)), this, SLOT(slotActivated(QModelIndex))); }
MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) , mUi(new Ui::MainWindow) , mMapDocument(0) , mActionHandler(new MapDocumentActionHandler(this)) , mLayerDock(new LayerDock(this)) , mTilesetDock(new TilesetDock(this)) , mZoomLabel(new QLabel) , mStatusInfoLabel(new QLabel) , mClipboardManager(new ClipboardManager(this)) , mDocumentManager(DocumentManager::instance()) { mUi->setupUi(this); setCentralWidget(mDocumentManager->widget()); PluginManager::instance()->loadPlugins(); Preferences *preferences = Preferences::instance(); QIcon redoIcon(QLatin1String(":images/16x16/edit-redo.png")); QIcon undoIcon(QLatin1String(":images/16x16/edit-undo.png")); QIcon tiledIcon(QLatin1String(":images/tiled-icon-16.png")); tiledIcon.addFile(QLatin1String(":images/tiled-icon-32.png")); setWindowIcon(tiledIcon); // Add larger icon versions for actions used in the tool bar QIcon newIcon = mUi->actionNew->icon(); QIcon openIcon = mUi->actionOpen->icon(); QIcon saveIcon = mUi->actionSave->icon(); newIcon.addFile(QLatin1String(":images/24x24/document-new.png")); openIcon.addFile(QLatin1String(":images/24x24/document-open.png")); saveIcon.addFile(QLatin1String(":images/24x24/document-save.png")); redoIcon.addFile(QLatin1String(":images/24x24/edit-redo.png")); undoIcon.addFile(QLatin1String(":images/24x24/edit-undo.png")); mUi->actionNew->setIcon(newIcon); mUi->actionOpen->setIcon(openIcon); mUi->actionSave->setIcon(saveIcon); QUndoGroup *undoGroup = mDocumentManager->undoGroup(); QAction *undoAction = undoGroup->createUndoAction(this, tr("Undo")); QAction *redoAction = undoGroup->createRedoAction(this, tr("Redo")); mUi->mainToolBar->setToolButtonStyle(Qt::ToolButtonFollowStyle); mUi->actionNew->setPriority(QAction::LowPriority); redoAction->setPriority(QAction::LowPriority); redoAction->setIcon(redoIcon); undoAction->setIcon(undoIcon); redoAction->setIconText(tr("Redo")); undoAction->setIconText(tr("Undo")); connect(undoGroup, SIGNAL(cleanChanged(bool)), SLOT(updateWindowTitle())); UndoDock *undoDock = new UndoDock(undoGroup, this); addDockWidget(Qt::RightDockWidgetArea, mLayerDock); addDockWidget(Qt::RightDockWidgetArea, undoDock); tabifyDockWidget(undoDock, mLayerDock); addDockWidget(Qt::RightDockWidgetArea, mTilesetDock); statusBar()->addPermanentWidget(mZoomLabel); mUi->actionNew->setShortcuts(QKeySequence::New); mUi->actionOpen->setShortcuts(QKeySequence::Open); mUi->actionSave->setShortcuts(QKeySequence::Save); mUi->actionSaveAs->setShortcuts(QKeySequence::SaveAs); mUi->actionClose->setShortcuts(QKeySequence::Close); mUi->actionQuit->setShortcuts(QKeySequence::Quit); mUi->actionCut->setShortcuts(QKeySequence::Cut); mUi->actionCopy->setShortcuts(QKeySequence::Copy); mUi->actionPaste->setShortcuts(QKeySequence::Paste); mUi->actionDelete->setShortcuts(QKeySequence::Delete); undoAction->setShortcuts(QKeySequence::Undo); redoAction->setShortcuts(QKeySequence::Redo); mUi->actionShowGrid->setChecked(preferences->showGrid()); mUi->actionSnapToGrid->setChecked(preferences->snapToGrid()); // Make sure Ctrl+= also works for zooming in QList<QKeySequence> keys = QKeySequence::keyBindings(QKeySequence::ZoomIn); keys += QKeySequence(tr("Ctrl+=")); keys += QKeySequence(tr("+")); mUi->actionZoomIn->setShortcuts(keys); keys = QKeySequence::keyBindings(QKeySequence::ZoomOut); keys += QKeySequence(tr("-")); mUi->actionZoomOut->setShortcuts(keys); mUi->menuEdit->insertAction(mUi->actionCut, undoAction); mUi->menuEdit->insertAction(mUi->actionCut, redoAction); mUi->menuEdit->insertSeparator(mUi->actionCut); mUi->menuEdit->insertAction(mUi->actionPreferences, mActionHandler->actionSelectAll()); mUi->menuEdit->insertAction(mUi->actionPreferences, mActionHandler->actionSelectNone()); mUi->menuEdit->insertSeparator(mUi->actionPreferences); mUi->mainToolBar->addAction(undoAction); mUi->mainToolBar->addAction(redoAction); mUi->mainToolBar->addSeparator(); mCommandButton = new CommandButton(this); mUi->mainToolBar->addWidget(mCommandButton); mUi->menuMap->insertAction(mUi->actionOffsetMap, mActionHandler->actionCropToSelection()); QToolButton *randomButton = new QToolButton(this); randomButton->setToolTip(tr("Random Mode")); randomButton->setIcon(QIcon(QLatin1String(":images/22x22/stock-tool-random-clone.png"))); randomButton->setCheckable(true); mUi->mainToolBar->addWidget(randomButton); mLayerMenu = new QMenu(tr("&Layer"), this); mLayerMenu->addAction(mActionHandler->actionAddTileLayer()); mLayerMenu->addAction(mActionHandler->actionAddObjectGroup()); mLayerMenu->addAction(mActionHandler->actionDuplicateLayer()); mLayerMenu->addAction(mActionHandler->actionMergeLayerDown()); mLayerMenu->addAction(mActionHandler->actionRemoveLayer()); mLayerMenu->addSeparator(); mLayerMenu->addAction(mActionHandler->actionSelectPreviousLayer()); mLayerMenu->addAction(mActionHandler->actionSelectNextLayer()); mLayerMenu->addAction(mActionHandler->actionMoveLayerUp()); mLayerMenu->addAction(mActionHandler->actionMoveLayerDown()); mLayerMenu->addSeparator(); mLayerMenu->addAction(mActionHandler->actionToggleOtherLayers()); mLayerMenu->addSeparator(); mLayerMenu->addAction(mActionHandler->actionLayerProperties()); menuBar()->insertMenu(mUi->menuHelp->menuAction(), mLayerMenu); connect(mUi->actionNew, SIGNAL(triggered()), SLOT(newMap())); connect(mUi->actionOpen, SIGNAL(triggered()), SLOT(openFile())); connect(mUi->actionClearRecentFiles, SIGNAL(triggered()), SLOT(clearRecentFiles())); connect(mUi->actionSave, SIGNAL(triggered()), SLOT(saveFile())); connect(mUi->actionSaveAs, SIGNAL(triggered()), SLOT(saveFileAs())); connect(mUi->actionSaveAsImage, SIGNAL(triggered()), SLOT(saveAsImage())); connect(mUi->actionExport, SIGNAL(triggered()), SLOT(exportAs())); connect(mUi->actionClose, SIGNAL(triggered()), SLOT(closeFile())); connect(mUi->actionCloseAll, SIGNAL(triggered()), SLOT(closeAllFiles())); connect(mUi->actionQuit, SIGNAL(triggered()), SLOT(close())); connect(mUi->actionCut, SIGNAL(triggered()), SLOT(cut())); connect(mUi->actionCopy, SIGNAL(triggered()), SLOT(copy())); connect(mUi->actionPaste, SIGNAL(triggered()), SLOT(paste())); connect(mUi->actionDelete, SIGNAL(triggered()), SLOT(delete_())); connect(mUi->actionPreferences, SIGNAL(triggered()), SLOT(openPreferences())); connect(mUi->actionShowGrid, SIGNAL(toggled(bool)), preferences, SLOT(setShowGrid(bool))); connect(mUi->actionSnapToGrid, SIGNAL(toggled(bool)), preferences, SLOT(setSnapToGrid(bool))); connect(mUi->actionZoomIn, SIGNAL(triggered()), SLOT(zoomIn())); connect(mUi->actionZoomOut, SIGNAL(triggered()), SLOT(zoomOut())); connect(mUi->actionZoomNormal, SIGNAL(triggered()), SLOT(zoomNormal())); connect(mUi->actionNewTileset, SIGNAL(triggered()), SLOT(newTileset())); connect(mUi->actionAddExternalTileset, SIGNAL(triggered()), SLOT(addExternalTileset())); connect(mUi->actionResizeMap, SIGNAL(triggered()), SLOT(resizeMap())); connect(mUi->actionOffsetMap, SIGNAL(triggered()), SLOT(offsetMap())); connect(mUi->actionMapProperties, SIGNAL(triggered()), SLOT(editMapProperties())); connect(mUi->actionAutoMap, SIGNAL(triggered()), SLOT(autoMap())); connect(mActionHandler->actionLayerProperties(), SIGNAL(triggered()), SLOT(editLayerProperties())); connect(mUi->actionAbout, SIGNAL(triggered()), SLOT(aboutTiled())); connect(mUi->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(mTilesetDock, SIGNAL(tilesetsDropped(QStringList)), SLOT(newTilesets(QStringList))); // Add recent file actions to the recent files menu for (int i = 0; i < MaxRecentFiles; ++i) { mRecentFiles[i] = new QAction(this); mUi->menuRecentFiles->insertAction(mUi->actionClearRecentFiles, mRecentFiles[i]); mRecentFiles[i]->setVisible(false); connect(mRecentFiles[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); } mUi->menuRecentFiles->insertSeparator(mUi->actionClearRecentFiles); setThemeIcon(mUi->actionNew, "document-new"); setThemeIcon(mUi->actionOpen, "document-open"); setThemeIcon(mUi->menuRecentFiles, "document-open-recent"); setThemeIcon(mUi->actionClearRecentFiles, "edit-clear"); setThemeIcon(mUi->actionSave, "document-save"); setThemeIcon(mUi->actionSaveAs, "document-save-as"); setThemeIcon(mUi->actionClose, "window-close"); setThemeIcon(mUi->actionQuit, "application-exit"); setThemeIcon(mUi->actionCut, "edit-cut"); setThemeIcon(mUi->actionCopy, "edit-copy"); setThemeIcon(mUi->actionPaste, "edit-paste"); setThemeIcon(mUi->actionDelete, "edit-delete"); setThemeIcon(redoAction, "edit-redo"); setThemeIcon(undoAction, "edit-undo"); setThemeIcon(mUi->actionZoomIn, "zoom-in"); setThemeIcon(mUi->actionZoomOut, "zoom-out"); setThemeIcon(mUi->actionZoomNormal, "zoom-original"); setThemeIcon(mUi->actionNewTileset, "document-new"); setThemeIcon(mUi->actionResizeMap, "document-page-setup"); setThemeIcon(mUi->actionMapProperties, "document-properties"); setThemeIcon(mUi->actionAbout, "help-about"); mStampBrush = new StampBrush(this); mBucketFillTool = new BucketFillTool(this); CreateObjectTool *tileObjectsTool = new CreateObjectTool( CreateObjectTool::CreateTile, this); CreateObjectTool *areaObjectsTool = new CreateObjectTool( CreateObjectTool::CreateArea, this); CreateObjectTool *polygonObjectsTool = new CreateObjectTool( CreateObjectTool::CreatePolygon, this); CreateObjectTool *polylineObjectsTool = new CreateObjectTool( CreateObjectTool::CreatePolyline, this); connect(mTilesetDock, SIGNAL(currentTilesChanged(const TileLayer*)), this, SLOT(setStampBrush(const TileLayer*))); connect(mStampBrush, SIGNAL(currentTilesChanged(const TileLayer*)), this, SLOT(setStampBrush(const TileLayer*))); connect(mTilesetDock, SIGNAL(currentTileChanged(Tile*)), tileObjectsTool, SLOT(setTile(Tile*))); connect(randomButton, SIGNAL(toggled(bool)), mStampBrush, SLOT(setRandom(bool))); ToolManager *toolManager = ToolManager::instance(); toolManager->registerTool(mStampBrush); toolManager->registerTool(mBucketFillTool); toolManager->registerTool(new Eraser(this)); toolManager->registerTool(new TileSelectionTool(this)); toolManager->addSeparator(); toolManager->registerTool(new ObjectSelectionTool(this)); toolManager->registerTool(new EditPolygonTool(this)); toolManager->registerTool(areaObjectsTool); toolManager->registerTool(tileObjectsTool); toolManager->registerTool(polygonObjectsTool); toolManager->registerTool(polylineObjectsTool); addToolBar(toolManager->toolBar()); statusBar()->addWidget(mStatusInfoLabel); connect(toolManager, SIGNAL(statusInfoChanged(QString)), this, SLOT(updateStatusInfoLabel(QString))); mUi->menuView->addSeparator(); mUi->menuView->addAction(mTilesetDock->toggleViewAction()); mUi->menuView->addAction(mLayerDock->toggleViewAction()); mUi->menuView->addAction(undoDock->toggleViewAction()); connect(mClipboardManager, SIGNAL(hasMapChanged()), SLOT(updateActions())); connect(mDocumentManager, SIGNAL(currentDocumentChanged(MapDocument*)), SLOT(mapDocumentChanged(MapDocument*))); connect(mDocumentManager, SIGNAL(documentCloseRequested(int)), this, SLOT(closeMapDocument(int))); QShortcut *switchToLeftDocument = new QShortcut(tr("Ctrl+PgUp"), this); connect(switchToLeftDocument, SIGNAL(activated()), mDocumentManager, SLOT(switchToLeftDocument())); QShortcut *switchToRightDocument = new QShortcut(tr("Ctrl+PgDown"), this); connect(switchToRightDocument, SIGNAL(activated()), mDocumentManager, SLOT(switchToRightDocument())); new QShortcut(tr("X"), this, SLOT(flipStampHorizontally())); new QShortcut(tr("Y"), this, SLOT(flipStampVertically())); updateActions(); readSettings(); setupQuickStamps(); }
QBoxLayout * View::exposurePanelLayout() { QLabel *ssLabel = new QLabel( tr("Shutter speed:") ); shutterSpeed = new ShutterSpeed(); QObject::connect( shutterSpeed, SIGNAL(propertyChanged(int,int)), this, SIGNAL(propertyChanged(int,int)) ); QLabel *apertureLabel = new QLabel( tr("Aperture:") ); aperture = new Aperture(); QObject::connect( aperture, SIGNAL(propertyChanged(int,int)), this, SIGNAL(propertyChanged(int,int)) ); QLabel *isoLabel = new QLabel( tr("ISO speed:") ); isoSpeed = new ISOSpeed(); QObject::connect( isoSpeed, SIGNAL(propertyChanged(int,int)), this, SIGNAL(propertyChanged(int,int)) ); shootingMode = new ShootingMode(); QLabel *ecLabel = new QLabel( tr("Exposure compensation:") ); exposureComp = new ExposureComp( camera, 3, this ); QObject::connect( exposureComp, SIGNAL(propertyChanged(int,int)), this, SIGNAL(propertyChanged(int,int))); QLabel *expLabel = new QLabel( tr("Exposure:") ); QToolButton *expButton = new QToolButton(); expButton->setAutoRaise( true ); expButton->setStatusTip( tr("Auto exposure button") ); expButton->setIcon( QIcon(":/Resources/Misc/button.png") ); expButton->setIconSize( QSize(22, 22) ); QObject::connect( expButton, SIGNAL(pressed()), this, SLOT(autoMeteringInitiated()) ); QObject::connect( expButton, SIGNAL(released()), this, SLOT(autoMeteringDiscontinued()) ); QLabel *driveLabel = new QLabel( tr("Drive:") ); driveMode = new DriveMode(); QObject::connect( driveMode, SIGNAL(propertyChanged(int,int)), this, SIGNAL(propertyChanged(int,int)) ); QLabel *meteringLabel = new QLabel( tr("Metering:") ); meteringMode = new MeteringMode(); QObject::connect( meteringMode, SIGNAL(propertyChanged(int,int)), this, SIGNAL(propertyChanged(int,int))); QLabel *whiteLabel = new QLabel( tr("White balance:") ); whiteBalance = new WhiteBalance(); QObject::connect( whiteBalance, SIGNAL(propertyChanged(int,int)), this, SIGNAL(propertyChanged(int,int)) ); QGridLayout *layer1Layout = new QGridLayout(); layer1Layout->addWidget( ssLabel, 0, 0 ); layer1Layout->addWidget( shutterSpeed, 1, 0 ); layer1Layout->addWidget( apertureLabel, 0, 1 ); layer1Layout->addWidget( aperture, 1, 1 ); layer1Layout->addWidget( isoLabel, 0, 2 ); layer1Layout->addWidget( isoSpeed, 1, 2 ); layer1Layout->setColumnStretch( 0, 1 ); layer1Layout->setColumnStretch( 1, 1 ); layer1Layout->setColumnStretch( 2, 1 ); QGridLayout *layer2Layout = new QGridLayout(); layer2Layout->addWidget( shootingMode, 0, 0, 2, 1 ); layer2Layout->addWidget( ecLabel, 0, 2 ); layer2Layout->addWidget( exposureComp, 1, 2 ); layer2Layout->addWidget( expLabel, 0, 4, Qt::AlignHCenter ); layer2Layout->addWidget( expButton, 1, 4, Qt::AlignHCenter | Qt::AlignVCenter ); layer2Layout->setColumnStretch( 1, 1 ); layer2Layout->setColumnStretch( 3, 1 ); QGridLayout *layer3Layout = new QGridLayout(); layer3Layout->addWidget( driveLabel, 0, 0 ); layer3Layout->addWidget( driveMode, 1, 0 ); layer3Layout->addWidget( meteringLabel, 0, 1 ); layer3Layout->addWidget( meteringMode, 1, 1 ); layer3Layout->addWidget( whiteLabel, 0, 2 ); layer3Layout->addWidget( whiteBalance, 1, 2 ); QVBoxLayout *layout = new QVBoxLayout(); layout->addLayout( layer1Layout ); layout->addLayout( layer2Layout ); layout->addLayout( layer3Layout ); layout->setContentsMargins( 0, 5, 0, 5 ); return( layout ); }
/** * Constructor. */ QG_LayerWidget::QG_LayerWidget(QG_ActionHandler* ah, QWidget* parent, const char* name, Qt::WFlags f) : QWidget(parent, f) { setObjectName(name); actionHandler = ah; layerList = NULL; showByBlock = false; lastLayer = NULL; layerModel = new QG_LayerModel; layerView = new QTableView(this); layerView->setModel (layerModel); layerView->setShowGrid (false); layerView->setSelectionMode(QAbstractItemView::SingleSelection); layerView->setEditTriggers(QAbstractItemView::NoEditTriggers); layerView->setFocusPolicy(Qt::NoFocus); layerView->setMinimumHeight(140); layerView->setColumnWidth(QG_LayerModel::VISIBLE, 20); layerView->setColumnWidth(QG_LayerModel::LOCKED, 20); layerView->verticalHeader()->hide(); layerView->horizontalHeader()->setStretchLastSection(true); layerView->horizontalHeader()->hide(); QVBoxLayout* lay = new QVBoxLayout(this); lay->setSpacing ( 0 ); lay->setContentsMargins(2, 2, 2, 2); QHBoxLayout* layButtons = new QHBoxLayout(); QToolButton* but; // show all layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/visiblelayer.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Show all layers")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersDefreezeAll())); layButtons->addWidget(but); // hide all layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/hiddenlayer.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Hide all layers")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersFreezeAll())); layButtons->addWidget(but); // add layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/layeradd.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Add a layer")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersAdd())); layButtons->addWidget(but); // remove layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/layerremove.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Remove the current layer")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersRemove())); layButtons->addWidget(but); // rename layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/layeredit.png")); but->setMinimumSize(QSize(22,22)); but->setToolTip(tr("Modify layer attributes / rename")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersEdit())); layButtons->addWidget(but); //lay->addWidget(caption); lay->addLayout(layButtons); lay->addWidget(layerView); connect(layerView, SIGNAL(clicked(QModelIndex)), this, SLOT(slotActivated(QModelIndex))); connect(layerView, SIGNAL(clicked(QModelIndex)), this, SLOT(slotActivated(QModelIndex))); }
SlideShow::SlideShow(QWidget *parent) : QWidget(parent) , imageViewer(0) , playlist(0) , statusLabel(0) , countdownLabel(0) , playButton(0) , stopButton(0) , viewerLayout(0) { imageViewer = new QMediaImageViewer(this); connect(imageViewer, SIGNAL(stateChanged(QMediaImageViewer::State)), this, SLOT(stateChanged(QMediaImageViewer::State))); connect(imageViewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)), this, SLOT(statusChanged(QMediaImageViewer::MediaStatus))); connect(imageViewer, SIGNAL(elapsedTimeChanged(int)), this, SLOT(elapsedTimeChanged(int))); playlist = new QMediaPlaylist; imageViewer->bind(playlist); connect(playlist, SIGNAL(loaded()), this, SLOT(playlistLoaded())); connect(playlist, SIGNAL(loadFailed()), this, SLOT(playlistLoadFailed())); connect(playlist, SIGNAL(loaded()), this, SLOT(playlistLoaded())); connect(playlist, SIGNAL(loadFailed()), this, SLOT(playlistLoadFailed())); QVideoWidget *videoWidget = new QVideoWidget; imageViewer->bind(videoWidget); statusLabel = new QLabel(tr("%1 Images").arg(0)); statusLabel->setAlignment(Qt::AlignCenter); viewerLayout = new QStackedLayout; viewerLayout->setStackingMode(QStackedLayout::StackAll); viewerLayout->addWidget(videoWidget); viewerLayout->addWidget(statusLabel); statusLabel = new QLabel(tr("%1 Images").arg(0)); statusLabel->setAlignment(Qt::AlignCenter); viewerLayout = new QStackedLayout; viewerLayout->setStackingMode(QStackedLayout::StackAll); viewerLayout->addWidget(videoWidget); viewerLayout->addWidget(statusLabel); QMenu *openMenu = new QMenu(this); openMenu->addAction(tr("Directory..."), this, SLOT(openDirectory())); openMenu->addAction(tr("Playlist..."), this, SLOT(openPlaylist())); QToolButton *openButton = new QToolButton; openButton->setIcon(style()->standardIcon(QStyle::SP_DialogOpenButton)); openButton->setMenu(openMenu); openButton->setPopupMode(QToolButton::InstantPopup); playButton = new QToolButton; playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); playButton->setEnabled(false); connect(playButton, SIGNAL(clicked()), this, SLOT(play())); connect(this, SIGNAL(enableButtons(bool)), playButton, SLOT(setEnabled(bool))); stopButton = new QToolButton; stopButton->setIcon(style()->standardIcon(QStyle::SP_MediaStop)); stopButton->setEnabled(false); connect(stopButton, SIGNAL(clicked()), imageViewer, SLOT(stop())); QAbstractButton *nextButton = new QToolButton; nextButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipForward)); nextButton->setEnabled(false); connect(nextButton, SIGNAL(clicked()), playlist, SLOT(next())); connect(this, SIGNAL(enableButtons(bool)), nextButton, SLOT(setEnabled(bool))); QAbstractButton *previousButton = new QToolButton; previousButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipBackward)); previousButton->setEnabled(false); connect(previousButton, SIGNAL(clicked()), playlist, SLOT(previous())); connect(this, SIGNAL(enableButtons(bool)), previousButton, SLOT(setEnabled(bool))); countdownLabel = new QLabel; QBoxLayout *controlLayout = new QHBoxLayout; controlLayout->setMargin(0); controlLayout->addWidget(openButton); controlLayout->addStretch(1); controlLayout->addWidget(previousButton); controlLayout->addWidget(stopButton); controlLayout->addWidget(playButton); controlLayout->addWidget(nextButton); controlLayout->addStretch(1); controlLayout->addWidget(countdownLabel); QBoxLayout *layout = new QVBoxLayout; layout->addLayout(viewerLayout); layout->addLayout(controlLayout); setLayout(layout); }
ToolbarEditDialog::ToolbarEditDialog( QWidget *_w, intf_thread_t *_p_intf) : QVLCDialog( _w, _p_intf ) { setWindowTitle( qtr( "Toolbars Editor" ) ); setWindowRole( "vlc-toolbars-editor" ); QGridLayout *mainLayout = new QGridLayout( this ); setMinimumWidth( 600 ); setAttribute( Qt::WA_DeleteOnClose ); /* main GroupBox */ QGroupBox *widgetBox = new QGroupBox( qtr( "Toolbar Elements") , this ); widgetBox->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::MinimumExpanding ); QGridLayout *boxLayout = new QGridLayout( widgetBox ); flatBox = new QCheckBox( qtr( "Flat Button" ) ); flatBox->setToolTip( qtr( "Next widget style" ) ); bigBox = new QCheckBox( qtr( "Big Button" ) ); bigBox->setToolTip( flatBox->toolTip() ); shinyBox = new QCheckBox( qtr( "Native Slider" ) ); shinyBox->setToolTip( flatBox->toolTip() ); boxLayout->addWidget( new WidgetListing( p_intf, this ), 1, 0, 1, -1 ); boxLayout->addWidget( flatBox, 0, 0 ); boxLayout->addWidget( bigBox, 0, 1 ); boxLayout->addWidget( shinyBox, 0, 2 ); mainLayout->addWidget( widgetBox, 5, 0, 3, 6 ); QTabWidget *tabWidget = new QTabWidget(); mainLayout->addWidget( tabWidget, 1, 0, 4, 9 ); /* Main ToolBar */ QWidget *mainToolbarBox = new QWidget(); tabWidget->addTab( mainToolbarBox, qtr( "Main Toolbar" ) ); QFormLayout *mainTboxLayout = new QFormLayout( mainToolbarBox ); positionCheckbox = new QCheckBox( qtr( "Above the Video" ) ); positionCheckbox->setChecked( getSettings()->value( "MainWindow/ToolbarPos", 0 ).toInt() ); mainTboxLayout->addRow( new QLabel( qtr( "Toolbar position:" ) ), positionCheckbox ); QString line1 = getSettings()->value( "MainWindow/MainToolbar1", MAIN_TB1_DEFAULT ).toString(); controller1 = new DroppingController( p_intf, line1, this ); mainTboxLayout->addRow( new QLabel( qtr("Line 1:") ), controller1 ); QString line2 = getSettings()->value( "MainWindow/MainToolbar2", MAIN_TB2_DEFAULT ).toString(); controller2 = new DroppingController( p_intf, line2, this ); mainTboxLayout->addRow( new QLabel( qtr("Line 2:") ), controller2 ); /* TimeToolBar */ QString line = getSettings()->value( "MainWindow/InputToolbar", INPT_TB_DEFAULT ).toString(); controller = new DroppingController( p_intf, line, this ); QWidget *timeToolbarBox = new QWidget(); timeToolbarBox->setLayout( new QVBoxLayout() ); timeToolbarBox->layout()->addWidget( controller ); tabWidget->addTab( timeToolbarBox, qtr( "Time Toolbar" ) ); /* Advanced ToolBar */ QString lineA = getSettings()->value( "MainWindow/AdvToolbar", ADV_TB_DEFAULT ).toString(); controllerA = new DroppingController( p_intf, lineA, this ); QWidget *advToolbarBox = new QWidget(); advToolbarBox->setLayout( new QVBoxLayout() ); advToolbarBox->layout()->addWidget( controllerA ); tabWidget->addTab( advToolbarBox, qtr( "Advanced Widget" ) ); /* FSCToolBar */ QString lineFSC = getSettings()->value( "MainWindow/FSCtoolbar", FSC_TB_DEFAULT ).toString(); controllerFSC = new DroppingController( p_intf, lineFSC, this ); QWidget *FSCToolbarBox = new QWidget(); FSCToolbarBox->setLayout( new QVBoxLayout() ); FSCToolbarBox->layout()->addWidget( controllerFSC ); tabWidget->addTab( FSCToolbarBox, qtr( "Fullscreen Controller" ) ); /* Profile */ QGridLayout *profileBoxLayout = new QGridLayout(); profileCombo = new QComboBox; QToolButton *newButton = new QToolButton; newButton->setIcon( QIcon( ":/new" ) ); newButton->setToolTip( qtr("New profile") ); QToolButton *deleteButton = new QToolButton; deleteButton->setIcon( QIcon( ":/toolbar/clear" ) ); deleteButton->setToolTip( qtr( "Delete the current profile" ) ); profileBoxLayout->addWidget( new QLabel( qtr( "Select profile:" ) ), 0, 0 ); profileBoxLayout->addWidget( profileCombo, 0, 1 ); profileBoxLayout->addWidget( newButton, 0, 2 ); profileBoxLayout->addWidget( deleteButton, 0, 3 ); mainLayout->addLayout( profileBoxLayout, 0, 0, 1, 9 ); /* Fill combos */ int i_size = getSettings()->beginReadArray( "ToolbarProfiles" ); for( int i = 0; i < i_size; i++ ) { getSettings()->setArrayIndex(i); profileCombo->addItem( getSettings()->value( "ProfileName" ).toString(), getSettings()->value( "Value" ).toString() ); } getSettings()->endArray(); /* Load defaults ones if we have no combos */ /* We could decide that we load defaults on first launch of the dialog or when the combo is back to 0. I choose the second solution, because some clueless user might hit on delete a bit too much, but discussion is opened. -- jb */ if( i_size == 0 ) { profileCombo->addItem( PROFILE_NAME_6, QString( VALUE_6 ) ); profileCombo->addItem( PROFILE_NAME_1, QString( VALUE_1 ) ); profileCombo->addItem( PROFILE_NAME_2, QString( VALUE_2 ) ); profileCombo->addItem( PROFILE_NAME_3, QString( VALUE_3 ) ); profileCombo->addItem( PROFILE_NAME_4, QString( VALUE_4 ) ); profileCombo->addItem( PROFILE_NAME_5, QString( VALUE_5 ) ); } profileCombo->setCurrentIndex( -1 ); /* Build and prepare our preview */ PreviewWidget *previewWidget = new PreviewWidget( controller, controller1, controller2 ); QGroupBox *previewBox = new QGroupBox( qtr("Preview"), this ); previewBox->setLayout( new QVBoxLayout() ); previewBox->layout()->addWidget( previewWidget ); mainLayout->addWidget( previewBox, 5, 6, 3, 3 ); CONNECT( positionCheckbox, stateChanged(int), previewWidget, setBarsTopPosition(int) ); /* Buttons */ QDialogButtonBox *okCancel = new QDialogButtonBox; QPushButton *okButton = new QPushButton( qtr( "Cl&ose" ), this ); okButton->setDefault( true ); QPushButton *cancelButton = new QPushButton( qtr( "&Cancel" ), this ); okCancel->addButton( okButton, QDialogButtonBox::AcceptRole ); okCancel->addButton( cancelButton, QDialogButtonBox::RejectRole ); BUTTONACT( deleteButton, deleteProfile() ); BUTTONACT( newButton, newProfile() ); CONNECT( profileCombo, currentIndexChanged( int ), this, changeProfile( int ) ); BUTTONACT( okButton, close() ); BUTTONACT( cancelButton, cancel() ); mainLayout->addWidget( okCancel, 8, 0, 1, 9 ); }
void SCgWindow::createToolBar() { mToolBar = new QToolBar(this); mToolBar->setIconSize(QSize(32, 32)); QActionGroup* group = new QActionGroup(mToolBar); // Select mode QAction *action = new QAction(findIcon("tool-select.png"), tr("Selection mode"), mToolBar); action->setCheckable(true); action->setChecked(true); action->setShortcut(QKeySequence(tr("1", "Selection mode"))); group->addAction(action); mToolBar->addAction(action); mMode2Action[SCgScene::Mode_Select] = action; connect(action, SIGNAL(triggered()), this, SLOT(onSelectMode())); //Pair creation mode action = new QAction(findIcon("tool-pair.png"), tr("Pair creation mode"), mToolBar); action->setCheckable(true); action->setShortcut(QKeySequence(tr("2", "Pair creation mode"))); group->addAction(action); mToolBar->addAction(action); mMode2Action[SCgScene::Mode_Pair] = action; connect(action, SIGNAL(triggered()), this, SLOT(onPairMode())); //Bus creation mode action = new QAction(findIcon("tool-bus.png"), tr("Bus creation mode"), mToolBar); action->setCheckable(true); action->setShortcut(QKeySequence(tr("3", "Bus creation mode"))); group->addAction(action); mToolBar->addAction(action); mMode2Action[SCgScene::Mode_Bus] = action; connect(action, SIGNAL(triggered()), this, SLOT(onBusMode())); //Contour creation mode action = new QAction(findIcon("tool-contour.png"), tr("Contour creation mode"), mToolBar); action->setCheckable(true); action->setShortcut(QKeySequence(tr("4", "Contour creation mode"))); group->addAction(action); mToolBar->addAction(action); mMode2Action[SCgScene::Mode_Contour] = action; connect(action, SIGNAL(triggered()), this, SLOT(onContourMode())); // mToolBar->addSeparator(); // // align group button QToolButton *alignButton = new QToolButton(mToolBar); alignButton->setIcon(findIcon("tool-align.png")); alignButton->setPopupMode(QToolButton::InstantPopup); mToolBar->addWidget(alignButton); //Grid alignment action = new QAction(findIcon("tool-align-grid.png"), tr("Grid alignment"), mToolBar); action->setCheckable(false); action->setShortcut(QKeySequence(tr("5", "Grid alignment"))); alignButton->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onGridAlignment())); // tuple alignment action = new QAction(findIcon("tool-align-tuple.png"), tr("Tuple alignment"), mToolBar); action->setCheckable(false); action->setShortcut(QKeySequence(tr("6", "Tuple alignment"))); alignButton->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onTupleAlignment())); //Vertical alignment action = new QAction(findIcon("tool-align-vert.png"), tr("Vertical alignment"), mToolBar); action->setCheckable(false); action->setShortcut(QKeySequence(tr("7", "Vertical alignment"))); alignButton->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onVerticalAlignment())); //Horizontal alignment action = new QAction(findIcon("tool-align-horz.png"), tr("Horizontal alignment"), mToolBar); action->setCheckable(false); action->setShortcut(QKeySequence(tr("8", "Horizontal alignment"))); alignButton->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onHorizontalAlignment())); // selection gtoup button QToolButton *selectButton = new QToolButton(mToolBar); selectButton->setIcon(findIcon("tool-select-group.png")); selectButton->setPopupMode(QToolButton::InstantPopup); mToolBar->addWidget(selectButton); // input/output selection action = new QAction(findIcon("tool-select-inout.png"), tr("Select input/output"), mToolBar); action->setCheckable(false); selectButton->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onSelectInputOutput())); // sbgraph selection action = new QAction(findIcon("tool-select-subgraph.png"), tr("Select subgraph"), mToolBar); action->setCheckable(false); selectButton->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onSelectSubgraph())); mToolBar->addSeparator(); action = new QAction(findIcon("tool-export-image.png"), tr("Export image"), mToolBar); action->setCheckable(false); action->setShortcut(QKeySequence(tr("0", "Export image"))); mToolBar->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onExportImage())); // mToolBar->addSeparator(); // //Zoom in action = new QAction(findIcon("tool-zoom-in.png"), tr("Zoom in"), mToolBar); action->setCheckable(false); action->setShortcut(QKeySequence(tr("+", "Zoom in"))); mToolBar->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onZoomIn())); //Scale combobox QComboBox* b = new QComboBox(mToolBar); b->setEditable(true); b->setInsertPolicy(QComboBox::NoInsert); b->addItems(SCgWindow::mScales); b->setCurrentIndex(mScales.indexOf("100")); mZoomFactorLine = b->lineEdit(); mZoomFactorLine->setInputMask("D90%"); mToolBar->addWidget(b); connect(mZoomFactorLine, SIGNAL(textChanged(const QString&)), mView, SLOT(setScale(const QString&))); connect(mView, SIGNAL(scaleChanged(qreal)), this, SLOT(onViewScaleChanged(qreal))); //Zoom out action = new QAction(findIcon("tool-zoom-out.png"), tr("Zoom out"), mToolBar); action->setCheckable(false); action->setShortcut(QKeySequence(tr("-", "Zoom out"))); mToolBar->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onZoomOut())); mToolBar->setWindowTitle(tr("SCg Tools")); mToolBar->setObjectName("SCgMainToolBar"); //! @bug toolbar state is not saved mToolBar->setMovable(false); }
FindBar::FindBar(MainWindow *window) : QWidget(window) , m_mainWindow(window) , m_lineEdit(new KLineEdit(this)) , m_hideTimer(new QTimer(this)) , m_matchCase(new QCheckBox(i18n("&Match case"), this)) , m_highlightAll(new QCheckBox(i18n("&Highlight all"), this)) { QHBoxLayout *layout = new QHBoxLayout; // cosmetic layout->setContentsMargins(2, 0, 2, 0); // hide button QToolButton *hideButton = new QToolButton(this); hideButton->setAutoRaise(true); hideButton->setIcon(KIcon("dialog-close")); connect(hideButton, SIGNAL(clicked()), this, SLOT(hide())); layout->addWidget(hideButton); layout->setAlignment(hideButton, Qt::AlignLeft | Qt::AlignTop); // hide timer connect(m_hideTimer, SIGNAL(timeout()), this, SLOT(hide())); m_hideTimer->setSingleShot(true); // label QLabel *label = new QLabel(i18n("Find:")); layout->addWidget(label); // lineEdit, focusProxy setFocusProxy(m_lineEdit); m_lineEdit->setMaximumWidth(250); connect(m_lineEdit, SIGNAL(textChanged(const QString &)), window, SLOT(find(const QString &))); layout->addWidget(m_lineEdit); // buttons KPushButton *findNext = new KPushButton(KIcon("go-down"), i18n("&Next"), this); KPushButton *findPrev = new KPushButton(KIcon("go-up"), i18n("&Previous"), this); connect(findNext, SIGNAL(clicked()), window, SLOT(findNext())); connect(findPrev, SIGNAL(clicked()), window, SLOT(findPrevious())); layout->addWidget(findNext); layout->addWidget(findPrev); // Case sensitivity. Deliberately set so this is off by default. m_matchCase->setCheckState(Qt::Unchecked); m_matchCase->setTristate(false); connect(m_matchCase, SIGNAL(toggled(bool)), window, SLOT(matchCaseUpdate())); layout->addWidget(m_matchCase); // Hightlight All. On by default m_highlightAll->setCheckState(Qt::Checked); m_highlightAll->setTristate(false); connect(m_highlightAll, SIGNAL(toggled(bool)), window, SLOT(updateHighlight())); layout->addWidget(m_highlightAll); // stretching widget on the left layout->addStretch(); setLayout(layout); // we start off hidden hide(); }
MainWindow::MainWindow( QWidget *parent ): QMainWindow( parent ) { QWidget *w = new QWidget( this ); d_plot = new Plot( w ); d_panner = new QwtPolarPanner( d_plot->canvas() ); d_panner->setEnabled( false ); d_zoomer = new QwtPolarMagnifier( d_plot->canvas() ); d_zoomer->setEnabled( false ); d_settingsEditor = new SettingsEditor( w ); d_settingsEditor->showSettings( d_plot->settings() ); connect( d_settingsEditor, SIGNAL( edited( const PlotSettings & ) ), d_plot, SLOT( applySettings( const PlotSettings & ) ) ); QHBoxLayout *layout = new QHBoxLayout( w ); layout->addWidget( d_settingsEditor, 0 ); layout->addWidget( d_plot, 10 ); setCentralWidget( w ); QToolBar *toolBar = new QToolBar( this ); QToolButton *btnZoom = new QToolButton( toolBar ); const QString zoomHelp = "Use the wheel to zoom in/out.\n" "When the plot is zoomed in,\n" "use the left mouse button to move it."; btnZoom->setText( "Zoom" ); btnZoom->setIcon( QPixmap( zoom_xpm ) ); btnZoom->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); btnZoom->setToolTip( zoomHelp ); btnZoom->setCheckable( true ); toolBar->addWidget( btnZoom ); connect( btnZoom, SIGNAL( toggled( bool ) ), SLOT( enableZoomMode( bool ) ) ); QToolButton *btnPrint = new QToolButton( toolBar ); btnPrint->setText( "Print" ); btnPrint->setIcon( QPixmap( print_xpm ) ); btnPrint->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); toolBar->addWidget( btnPrint ); connect( btnPrint, SIGNAL( clicked() ), SLOT( printDocument() ) ); #ifdef QT_SVG_LIB QToolButton *btnExport = new QToolButton( toolBar ); btnExport->setText( "Export" ); btnExport->setIcon( QPixmap( print_xpm ) ); btnExport->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); toolBar->addWidget( btnExport ); connect( btnExport, SIGNAL( clicked() ), SLOT( exportDocument() ) ); #endif addToolBar( toolBar ); }
DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQmakeRunConfiguration *qmakeRunConfiguration, QWidget *parent) : QWidget(parent), m_qmakeRunConfiguration(qmakeRunConfiguration), m_ignoreChange(false), m_usingDyldImageSuffix(0), m_isShown(false) { QVBoxLayout *vboxTopLayout = new QVBoxLayout(this); vboxTopLayout->setMargin(0); QHBoxLayout *hl = new QHBoxLayout(); hl->addStretch(); m_disabledIcon = new QLabel(this); m_disabledIcon->setPixmap(QPixmap(QLatin1String(":/projectexplorer/images/compile_warning.png"))); hl->addWidget(m_disabledIcon); m_disabledReason = new QLabel(this); m_disabledReason->setVisible(false); hl->addWidget(m_disabledReason); hl->addStretch(); vboxTopLayout->addLayout(hl); m_detailsContainer = new DetailsWidget(this); m_detailsContainer->setState(DetailsWidget::NoSummary); vboxTopLayout->addWidget(m_detailsContainer); QWidget *detailsWidget = new QWidget(m_detailsContainer); m_detailsContainer->setWidget(detailsWidget); QFormLayout *toplayout = new QFormLayout(detailsWidget); toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); toplayout->setMargin(0); m_executableLineEdit = new QLineEdit(m_qmakeRunConfiguration->executable(), this); m_executableLineEdit->setEnabled(false); toplayout->addRow(tr("Executable:"), m_executableLineEdit); QLabel *argumentsLabel = new QLabel(tr("Arguments:"), this); m_argumentsLineEdit = new QLineEdit(qmakeRunConfiguration->rawCommandLineArguments(), this); argumentsLabel->setBuddy(m_argumentsLineEdit); toplayout->addRow(argumentsLabel, m_argumentsLineEdit); m_workingDirectoryEdit = new PathChooser(this); m_workingDirectoryEdit->setExpectedKind(PathChooser::Directory); m_workingDirectoryEdit->setHistoryCompleter(QLatin1String("Qmake.WorkingDir.History")); m_workingDirectoryEdit->setPath(m_qmakeRunConfiguration->baseWorkingDirectory()); m_workingDirectoryEdit->setBaseDirectory(m_qmakeRunConfiguration->target()->project()->projectDirectory()); EnvironmentAspect *aspect = qmakeRunConfiguration->extraAspect<EnvironmentAspect>(); if (aspect) { connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged())); environmentWasChanged(); } m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory")); QToolButton *resetButton = new QToolButton(this); resetButton->setToolTip(tr("Reset to default")); resetButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_RESET))); QHBoxLayout *boxlayout = new QHBoxLayout(); boxlayout->setMargin(0); boxlayout->addWidget(m_workingDirectoryEdit); boxlayout->addWidget(resetButton); toplayout->addRow(tr("Working directory:"), boxlayout); QHBoxLayout *innerBox = new QHBoxLayout(); m_useTerminalCheck = new QCheckBox(tr("Run in terminal"), this); m_useTerminalCheck->setChecked(m_qmakeRunConfiguration->runMode() == LocalApplicationRunConfiguration::Console); m_useTerminalCheck->setVisible(!m_qmakeRunConfiguration->forcedGuiMode()); innerBox->addWidget(m_useTerminalCheck); m_useQvfbCheck = new QCheckBox(tr("Run on QVFb"), this); m_useQvfbCheck->setToolTip(tr("Check this option to run the application on a Qt Virtual Framebuffer.")); m_useQvfbCheck->setChecked(m_qmakeRunConfiguration->runMode() == LocalApplicationRunConfiguration::Console); m_useQvfbCheck->setVisible(false); innerBox->addWidget(m_useQvfbCheck); innerBox->addStretch(); toplayout->addRow(QString(), innerBox); if (HostOsInfo::isMacHost()) { m_usingDyldImageSuffix = new QCheckBox(tr("Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)"), this); m_usingDyldImageSuffix->setChecked(m_qmakeRunConfiguration->isUsingDyldImageSuffix()); toplayout->addRow(QString(), m_usingDyldImageSuffix); connect(m_usingDyldImageSuffix, SIGNAL(toggled(bool)), this, SLOT(usingDyldImageSuffixToggled(bool))); } runConfigurationEnabledChange(); connect(m_workingDirectoryEdit, SIGNAL(changed(QString)), this, SLOT(workDirectoryEdited())); connect(resetButton, SIGNAL(clicked()), this, SLOT(workingDirectoryReseted())); connect(m_argumentsLineEdit, SIGNAL(textEdited(QString)), this, SLOT(argumentsEdited(QString))); connect(m_useTerminalCheck, SIGNAL(toggled(bool)), this, SLOT(termToggled(bool))); connect(m_useQvfbCheck, SIGNAL(toggled(bool)), this, SLOT(qvfbToggled(bool))); connect(qmakeRunConfiguration, SIGNAL(baseWorkingDirectoryChanged(QString)), this, SLOT(workingDirectoryChanged(QString))); connect(qmakeRunConfiguration, SIGNAL(commandLineArgumentsChanged(QString)), this, SLOT(commandLineArgumentsChanged(QString))); connect(qmakeRunConfiguration, SIGNAL(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode)), this, SLOT(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode))); connect(qmakeRunConfiguration, SIGNAL(usingDyldImageSuffixChanged(bool)), this, SLOT(usingDyldImageSuffixChanged(bool))); connect(qmakeRunConfiguration, SIGNAL(effectiveTargetInformationChanged()), this, SLOT(effectiveTargetInformationChanged()), Qt::QueuedConnection); connect(qmakeRunConfiguration, SIGNAL(enabledChanged()), this, SLOT(runConfigurationEnabledChange())); }
PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) : QWidget( _par ), p_intf ( _p_i ) { setContentsMargins( 0, 3, 0, 3 ); QGridLayout *layout = new QGridLayout( this ); layout->setMargin( 0 ); layout->setSpacing( 0 ); /******************* * Left * *******************/ /* We use a QSplitter for the left part */ leftSplitter = new QSplitter( Qt::Vertical, this ); /* Source Selector */ selector = new PLSelector( this, p_intf ); leftSplitter->addWidget( selector ); /* Create a Container for the Art Label in order to have a beautiful resizing for the selector above it */ artContainer = new QStackedWidget; artContainer->setMaximumHeight( 256 ); /* Art label */ CoverArtLabel *art = new CoverArtLabel( artContainer, p_intf ); art->setToolTip( qtr( "Double click to get media information" ) ); artContainer->addWidget( art ); CONNECT( THEMIM->getIM(), artChanged( QString ), art, showArtUpdate( const QString& ) ); CONNECT( THEMIM->getIM(), artChanged( input_item_t * ), art, showArtUpdate( input_item_t * ) ); leftSplitter->addWidget( artContainer ); /******************* * Right * *******************/ /* Initialisation of the playlist */ playlist_t * p_playlist = THEPL; PL_LOCK; playlist_item_t *p_root = p_playlist->p_playing; PL_UNLOCK; setMinimumWidth( 400 ); PLModel *model = PLModel::getPLModel( p_intf ); #ifdef MEDIA_LIBRARY MLModel *mlmodel = new MLModel( p_intf, this ); mainView = new StandardPLPanel( this, p_intf, p_root, selector, model, mlmodel ); #else mainView = new StandardPLPanel( this, p_intf, p_root, selector, model, NULL ); #endif /* Location Bar */ locationBar = new LocationBar( model ); locationBar->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred ); layout->addWidget( locationBar, 0, 0, 1, 2 ); layout->setColumnStretch( 0, 5 ); CONNECT( locationBar, invoked( const QModelIndex & ), mainView, browseInto( const QModelIndex & ) ); QHBoxLayout *topbarLayout = new QHBoxLayout(); layout->addLayout( topbarLayout, 0, 1 ); topbarLayout->setSpacing( 10 ); /* Button to switch views */ QToolButton *viewButton = new QToolButton( this ); viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogDetailedView ) ); viewButton->setToolTip( qtr("Change playlistview") ); topbarLayout->addWidget( viewButton ); viewButton->setMenu( StandardPLPanel::viewSelectionMenu( mainView )); CONNECT( viewButton, clicked(), mainView, cycleViews() ); /* Search */ searchEdit = new SearchLineEdit( this ); searchEdit->setMaximumWidth( 250 ); searchEdit->setMinimumWidth( 80 ); searchEdit->setToolTip( qtr("Search the playlist") ); topbarLayout->addWidget( searchEdit ); CONNECT( searchEdit, textChanged( const QString& ), mainView, search( const QString& ) ); CONNECT( searchEdit, searchDelayedChanged( const QString& ), mainView, searchDelayed( const QString & ) ); CONNECT( mainView, viewChanged( const QModelIndex& ), this, changeView( const QModelIndex &) ); /* Connect the activation of the selector to a redefining of the PL */ DCONNECT( selector, categoryActivated( playlist_item_t *, bool ), mainView, setRootItem( playlist_item_t *, bool ) ); mainView->setRootItem( p_root, false ); CONNECT( selector, SDCategorySelected(bool), mainView, setWaiting(bool) ); /* */ split = new PlaylistSplitter( this ); /* Add the two sides of the QSplitter */ split->addWidget( leftSplitter ); split->addWidget( mainView ); QList<int> sizeList; sizeList << 180 << 420 ; split->setSizes( sizeList ); split->setStretchFactor( 0, 0 ); split->setStretchFactor( 1, 3 ); split->setCollapsible( 1, false ); leftSplitter->setMaximumWidth( 250 ); /* In case we want to keep the splitter information */ // components shall never write there setting to a fixed location, may infer // with other uses of the same component... getSettings()->beginGroup("Playlist"); split->restoreState( getSettings()->value("splitterSizes").toByteArray()); leftSplitter->restoreState( getSettings()->value("leftSplitterGeometry").toByteArray() ); getSettings()->endGroup(); layout->addWidget( split, 1, 0, 1, -1 ); setAcceptDrops( true ); setWindowTitle( qtr( "Playlist" ) ); setWindowRole( "vlc-playlist" ); setWindowIcon( QApplication::windowIcon() ); }
/************************************************ * Widget Listing: * Creation of the list of drawed lovely buttons ************************************************/ WidgetListing::WidgetListing( intf_thread_t *p_intf, QWidget *_parent ) : QListWidget( _parent ) { /* We need the parent to know the options checked */ parent = qobject_cast<ToolbarEditDialog *>(_parent); assert( parent ); /* Normal options */ setViewMode( QListView::IconMode ); setSpacing( 20 ); setDragEnabled( true ); /* All the buttons do not need a special rendering */ for( int i = 0; i < BUTTON_MAX; i++ ) { QListWidgetItem *widgetItem = new QListWidgetItem( this ); widgetItem->setText( qtr( nameL[i] ) ); widgetItem->setIcon( QIcon( iconL[i] ) ); widgetItem->setData( Qt::UserRole, QVariant( i ) ); addItem( widgetItem ); } /* Spacers are yet again a different thing */ QListWidgetItem *widgetItem = new QListWidgetItem( QIcon( ":/toolbar/space" ), qtr( "Spacer" ), this ); widgetItem->setData( Qt::UserRole, WIDGET_SPACER ); addItem( widgetItem ); widgetItem = new QListWidgetItem( QIcon( ":/toolbar/space" ), qtr( "Expanding Spacer" ), this ); widgetItem->setData( Qt::UserRole, WIDGET_SPACER_EXTEND ); addItem( widgetItem ); /** * For all other widgets, we create then, do a pseudo rendering in * a pixmaps for the view, and delete the object * * A lot of code is retaken from the Abstract, but not exactly... * So, rewrite. * They are better ways to deal with this, but I doubt that this is * necessary. If you feel like you have the time, be my guest. * -- * jb **/ for( int i = SPLITTER; i < SPECIAL_MAX; i++ ) { QWidget *widget = NULL; QListWidgetItem *widgetItem = new QListWidgetItem( this ); switch( i ) { case SPLITTER: { QFrame *line = new QFrame( this ); line->setFrameShape( QFrame::VLine ); line->setFrameShadow( QFrame::Raised ); line->setLineWidth( 0 ); line->setMidLineWidth( 1 ); widget = line; } widgetItem->setText( qtr("Splitter") ); break; case INPUT_SLIDER: { InputSlider *slider = new InputSlider( Qt::Horizontal, this ); widget = slider; } widgetItem->setText( qtr("Time Slider") ); break; case VOLUME: { SoundWidget *snd = new SoundWidget( this, p_intf, parent->getOptions() & WIDGET_SHINY ); widget = snd; } widgetItem->setText( qtr("Volume") ); break; case VOLUME_SPECIAL: { QListWidgetItem *widgetItem = new QListWidgetItem( this ); widgetItem->setText( qtr("Small Volume") ); widgetItem->setIcon( QIcon( ":/toolbar/volume-medium" ) ); widgetItem->setData( Qt::UserRole, QVariant( i ) ); addItem( widgetItem ); } continue; case TIME_LABEL: { QLabel *timeLabel = new QLabel( "12:42/2:12:42", this ); widget = timeLabel; } widgetItem->setText( qtr("Time") ); break; case MENU_BUTTONS: { QWidget *discFrame = new QWidget( this ); //discFrame->setLineWidth( 1 ); QHBoxLayout *discLayout = new QHBoxLayout( discFrame ); discLayout->setSpacing( 0 ); discLayout->setMargin( 0 ); QToolButton *prevSectionButton = new QToolButton( discFrame ); prevSectionButton->setIcon( QIcon( ":/toolbar/dvd_prev" ) ); discLayout->addWidget( prevSectionButton ); QToolButton *menuButton = new QToolButton( discFrame ); menuButton->setIcon( QIcon( ":/toolbar/dvd_menu" ) ); discLayout->addWidget( menuButton ); QToolButton *nextButton = new QToolButton( discFrame ); nextButton->setIcon( QIcon( ":/toolbar/dvd_next" ) ); discLayout->addWidget( nextButton ); widget = discFrame; } widgetItem->setText( qtr("DVD menus") ); break; case TELETEXT_BUTTONS: { QWidget *telexFrame = new QWidget( this ); QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame ); telexLayout->setSpacing( 0 ); telexLayout->setMargin( 0 ); QToolButton *telexOn = new QToolButton( telexFrame ); telexOn->setIcon( QIcon( ":/toolbar/tv" ) ); telexLayout->addWidget( telexOn ); QToolButton *telexTransparent = new QToolButton; telexOn->setIcon( QIcon( ":/toolbar/tvtelx" ) ); telexLayout->addWidget( telexTransparent ); QSpinBox *telexPage = new QSpinBox; telexLayout->addWidget( telexPage ); widget = telexFrame; } widgetItem->setText( qtr("Teletext") ); break; case ADVANCED_CONTROLLER: { AdvControlsWidget *advControls = new AdvControlsWidget( p_intf, this ); widget = advControls; } widgetItem->setText( qtr("Advanced Buttons") ); break; default: msg_Warn( p_intf, "This should not happen %i", i ); break; } if( widget == NULL ) continue; widgetItem->setIcon( QIcon( QPixmap::grabWidget( widget ) ) ); widget->hide(); widgetItem->setData( Qt::UserRole, QVariant( i ) ); addItem( widgetItem ); delete widget; } }
ColorDialog::ColorDialog(const QColor &foreground, const QColor &background, const QVector<QColor> &colors, const QStringList &names, QWidget *parent) : QDialog(parent) { bg = background; fg = foreground; colorList = colors; mapper = new QSignalMapper(this); QGroupBox *buttonGroupBox = new QGroupBox(tr("Highlighting colors")); QGridLayout *buttonLayout = new QGridLayout; for (int i = 0; i < colors.size(); ++i) { QLabel *label = new QLabel(names[i]); QToolButton *button = new QToolButton; button->setText(tr("Choose...")); button->setIcon(createIcon(button->iconSize(), colors[i])); connect(button, SIGNAL(clicked()), mapper, SLOT(map())); mapper->setMapping(button, i); buttonLayout->addWidget(label, i, 0); buttonLayout->addWidget(button, i, 1); } buttonGroupBox->setLayout(buttonLayout); connect(mapper, SIGNAL(mapped(int)), this, SLOT(selectColor(int))); QGroupBox *autoColorGroupBox = new QGroupBox(tr("Base colors")); QLabel *foregroundLabel = new QLabel(tr("Foreground:")); QToolButton *foregroundButton = new QToolButton; foregroundButton->setText(tr("Choose...")); foregroundButton->setIcon(createIcon(foregroundButton->iconSize(), fg)); QLabel *backgroundLabel = new QLabel(tr("Background:")); QToolButton *backgroundButton = new QToolButton; backgroundButton->setText(tr("Choose...")); backgroundButton->setIcon(createIcon(backgroundButton->iconSize(), bg)); QPushButton *createButton = new QPushButton(tr("Create New Colors")); connect(foregroundButton, SIGNAL(clicked()), this, SLOT(setForeground())); connect(backgroundButton, SIGNAL(clicked()), this, SLOT(setBackground())); connect(createButton, SIGNAL(clicked()), this, SLOT(createNewColors())); QGridLayout *autoColorLayout = new QGridLayout; autoColorLayout->addWidget(foregroundLabel, 0, 0); autoColorLayout->addWidget(foregroundButton, 0, 1); autoColorLayout->addWidget(backgroundLabel, 1, 0); autoColorLayout->addWidget(backgroundButton, 1, 1); autoColorLayout->addWidget(createButton, 2, 0, 1, 2); autoColorGroupBox->setLayout(autoColorLayout); QDialogButtonBox *buttons = new QDialogButtonBox(Qt::Horizontal); buttons->addButton(QDialogButtonBox::Ok); buttons->addButton(QDialogButtonBox::Cancel); connect(buttons, SIGNAL(accepted()), this, SLOT(accept())); connect(buttons, SIGNAL(rejected()), this, SLOT(reject())); QGridLayout *mainLayout = new QGridLayout; mainLayout->addWidget(buttonGroupBox, 0, 0, 2, 1); mainLayout->addWidget(autoColorGroupBox, 0, 1); mainLayout->addWidget(buttons, 2, 0, 1, 2); setLayout(mainLayout); setWindowTitle(tr("Configure Highlighting Colors")); }
void ColorDialog::setColorButton(int index, const QColor &color) { QToolButton *button = static_cast<QToolButton *>(mapper->mapping(index)); button->setIcon(createIcon(button->iconSize(), color)); colorList[index] = color; }
SVGView::SVGView(const QString &name, QWidget *parent) : QFrame(parent) { setFrameStyle(Sunken | StyledPanel); m_graphicsView = new QGraphicsView; m_graphicsView->setRenderHint(QPainter::Antialiasing, true); m_graphicsView->setDragMode(QGraphicsView::RubberBandDrag); m_graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate); int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize); QSize iconSize(size, size); m_domDocument = new QDomDocument; m_zoom = 1; m_rotation = 0; QToolButton *zoomInIcon = new QToolButton; zoomInIcon->setAutoRepeat(true); zoomInIcon->setAutoRepeatInterval(33); zoomInIcon->setAutoRepeatDelay(0); zoomInIcon->setIcon(QPixmap(":/zoomin.png")); zoomInIcon->setIconSize(iconSize); QToolButton *zoomOutIcon = new QToolButton; zoomOutIcon->setAutoRepeat(true); zoomOutIcon->setAutoRepeatInterval(33); zoomOutIcon->setAutoRepeatDelay(0); zoomOutIcon->setIcon(QPixmap(":/zoomout.png")); zoomOutIcon->setIconSize(iconSize); QToolButton *rotateLeftIcon = new QToolButton; rotateLeftIcon->setIcon(QPixmap(":/rotateleft.png")); rotateLeftIcon->setIconSize(iconSize); QToolButton *rotateRightIcon = new QToolButton; rotateRightIcon->setIcon(QPixmap(":/rotateright.png")); rotateRightIcon->setIconSize(iconSize); // Label layout QHBoxLayout *labelLayout = new QHBoxLayout; m_label = new QLabel(name); //TODO: put proper icons in here m_printButton = new QToolButton; m_printButton->setIcon(QIcon(QPixmap(":/resources/images/document-print.png"))); m_printButton->setText(tr("Print")); m_printButton->setToolTip(tr("Print")); m_loadPCBXMLButton = new QToolButton; m_loadPCBXMLButton->setIcon(QIcon(QPixmap(":/resources/images/applications-accessories.png"))); m_loadPCBXMLButton->setText(tr("Import XML")); m_loadPCBXMLButton->setToolTip(tr("Import XML")); labelLayout->addWidget(m_label); labelLayout->addStretch(); labelLayout->addWidget(m_printButton); labelLayout->addWidget(m_loadPCBXMLButton); QGridLayout *topLayout = new QGridLayout; topLayout->addLayout(labelLayout, 0, 0); topLayout->addWidget(m_graphicsView, 1, 0); setLayout(topLayout); connect(rotateLeftIcon, SIGNAL(clicked()), this, SLOT(rotateLeft())); connect(rotateRightIcon, SIGNAL(clicked()), this, SLOT(rotateRight())); connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn())); connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut())); connect(m_printButton, SIGNAL(clicked()), this, SLOT(print())); connect(m_loadPCBXMLButton, SIGNAL(clicked()), this, SLOT(importPCBXML())); setupMatrix(); }
Kleo::DNAttributeOrderConfigWidget::DNAttributeOrderConfigWidget( DNAttributeMapper * mapper, QWidget * parent, Qt::WindowFlags f ) : QWidget( parent, f ), d( new Private ) { assert( mapper ); d->mapper = mapper; QGridLayout * glay = new QGridLayout( this ); glay->setMargin( 0 ); glay->setSpacing( KDialog::spacingHint() ); glay->setColumnStretch( 0, 1 ); glay->setColumnStretch( 2, 1 ); int row = -1; ++row; glay->addWidget( new QLabel( i18n("Available attributes:"), this ), row, 0 ); glay->addWidget( new QLabel( i18n("Current attribute order:"), this ), row, 2 ); ++row; glay->setRowStretch( row, 1 ); #ifndef QT_NO_TREEWIDGET d->availableLV = new QTreeWidget( this ); prepare( d->availableLV ); d->availableLV->sortItems( 0, Qt::AscendingOrder ); glay->addWidget( d->availableLV, row, 0 ); d->currentLV = new QTreeWidget( this ); prepare( d->currentLV ); glay->addWidget( d->currentLV, row, 2 ); connect( d->availableLV, SIGNAL(itemClicked(QTreeWidgetItem*,int)), SLOT(slotAvailableSelectionChanged(QTreeWidgetItem*)) ); connect( d->currentLV, SIGNAL(itemClicked(QTreeWidgetItem*,int)), SLOT(slotCurrentOrderSelectionChanged(QTreeWidgetItem*)) ); d->placeHolderItem = new QTreeWidgetItem( d->availableLV ); d->placeHolderItem->setText( 0, "_X_" ); d->placeHolderItem->setText( 1, i18n("All others") ); #endif // the up/down/left/right arrow cross: QGridLayout * xlay = new QGridLayout(); xlay->setSpacing( 0 ); xlay->setObjectName( "xlay" ); xlay->setAlignment( Qt::AlignCenter ); static const struct { const char * icon; int row, col; const char * tooltip; const char * slot; } navButtons[] = { { "go-top", 0, 1, I18N_NOOP( "Move to top" ), SLOT(slotDoubleUpButtonClicked()) }, { "go-up", 1, 1, I18N_NOOP( "Move one up" ), SLOT(slotUpButtonClicked()) }, { "go-previous", 2, 0, I18N_NOOP( "Remove from current attribute order" ), SLOT(slotLeftButtonClicked()) }, { "go-next", 2, 2, I18N_NOOP( "Add to current attribute order" ), SLOT(slotRightButtonClicked()) }, { "go-down", 3, 1, I18N_NOOP( "Move one down" ), SLOT(slotDownButtonClicked()) }, { "go-bottom", 4, 1, I18N_NOOP( "Move to bottom" ), SLOT(slotDoubleDownButtonClicked()) } }; for ( unsigned int i = 0 ; i < sizeof navButtons / sizeof *navButtons ; ++i ) { QToolButton * tb = d->navTB[i] = new QToolButton( this ); tb->setIcon( KIcon( navButtons[i].icon ) ); tb->setEnabled( false ); tb->setToolTip( i18n( navButtons[i].tooltip ) ); xlay->addWidget( tb, navButtons[i].row, navButtons[i].col ); connect( tb, SIGNAL(clicked()), navButtons[i].slot ); } glay->addLayout( xlay, row, 1 ); }
/************************************************ * Widget Listing: * Creation of the list of drawed lovely buttons ************************************************/ WidgetListing::WidgetListing( intf_thread_t *p_intf, QWidget *_parent ) : QListWidget( _parent ) { /* We need the parent to know the options checked */ parent = qobject_cast<ToolbarEditDialog *>(_parent); assert( parent ); /* Normal options */ setViewMode( QListView::ListMode ); setTextElideMode( Qt::ElideNone ); setDragEnabled( true ); setIconSize( QSize( 64, 32 ) ); /* All the buttons do not need a special rendering */ for( int i = 0; i < BUTTON_MAX; i++ ) { QListWidgetItem *widgetItem = new QListWidgetItem( this ); widgetItem->setText( qtr( nameL[i] ) ); widgetItem->setSizeHint( QSize( widgetItem->sizeHint().width(), 32 ) ); QPixmap pix( iconL[i] ); widgetItem->setIcon( pix.scaled( 16, 16, Qt::KeepAspectRatio, Qt::SmoothTransformation ) ); widgetItem->setData( Qt::UserRole, QVariant( i ) ); widgetItem->setToolTip( widgetItem->text() ); addItem( widgetItem ); } /* Spacers are yet again a different thing */ QListWidgetItem *widgetItem = new QListWidgetItem( QIcon( ":/toolbar/space" ), qtr( "Spacer" ), this ); widgetItem->setData( Qt::UserRole, WIDGET_SPACER ); widgetItem->setToolTip( widgetItem->text() ); widgetItem->setSizeHint( QSize( widgetItem->sizeHint().width(), 32 ) ); addItem( widgetItem ); widgetItem = new QListWidgetItem( QIcon( ":/toolbar/space" ), qtr( "Expanding Spacer" ), this ); widgetItem->setData( Qt::UserRole, WIDGET_SPACER_EXTEND ); widgetItem->setToolTip( widgetItem->text() ); widgetItem->setSizeHint( QSize( widgetItem->sizeHint().width(), 32 ) ); addItem( widgetItem ); /** * For all other widgets, we create then, do a pseudo rendering in * a pixmaps for the view, and delete the object * * A lot of code is retaken from the Abstract, but not exactly... * So, rewrite. * They are better ways to deal with this, but I doubt that this is * necessary. If you feel like you have the time, be my guest. * -- * jb **/ for( int i = SPLITTER; i < SPECIAL_MAX; i++ ) { QWidget *widget = NULL; QListWidgetItem *widgetItem = new QListWidgetItem( this ); widgetItem->setSizeHint( QSize( widgetItem->sizeHint().width(), 32 ) ); switch( i ) { case SPLITTER: { QFrame *line = new QFrame( this ); line->setFrameShape( QFrame::VLine ); line->setFrameShadow( QFrame::Raised ); line->setLineWidth( 0 ); line->setMidLineWidth( 1 ); widget = line; } widgetItem->setText( qtr("Splitter") ); break; case INPUT_SLIDER: { SeekSlider *slider = new SeekSlider( Qt::Horizontal, this ); widget = slider; } widgetItem->setText( qtr("Time Slider") ); break; case VOLUME: { SoundWidget *snd = new SoundWidget( this, p_intf, parent->getOptions() & WIDGET_SHINY ); widget = snd; } widgetItem->setText( qtr("Volume") ); break; case VOLUME_SPECIAL: { QListWidgetItem *widgetItem = new QListWidgetItem( this ); widgetItem->setText( qtr("Small Volume") ); widgetItem->setIcon( QIcon( ":/toolbar/volume-medium" ) ); widgetItem->setData( Qt::UserRole, QVariant( i ) ); addItem( widgetItem ); } continue; case TIME_LABEL: { QLabel *timeLabel = new QLabel( "12:42/2:12:42", this ); widget = timeLabel; } widgetItem->setText( qtr("Time") ); break; case MENU_BUTTONS: { QWidget *discFrame = new QWidget( this ); //discFrame->setLineWidth( 1 ); QHBoxLayout *discLayout = new QHBoxLayout( discFrame ); discLayout->setSpacing( 0 ); discLayout->setMargin( 0 ); QToolButton *prevSectionButton = new QToolButton( discFrame ); prevSectionButton->setIcon( QIcon( ":/toolbar/dvd_prev" ) ); prevSectionButton->setToolTip( qtr("Previous chapter") ); discLayout->addWidget( prevSectionButton ); QToolButton *menuButton = new QToolButton( discFrame ); menuButton->setIcon( QIcon( ":/toolbar/dvd_menu" ) ); menuButton->setToolTip( qtr("Go to the DVD menu") ); discLayout->addWidget( menuButton ); QToolButton *nextButton = new QToolButton( discFrame ); nextButton->setIcon( QIcon( ":/toolbar/dvd_next" ) ); nextButton->setToolTip( qtr("Next chapter") ); discLayout->addWidget( nextButton ); widget = discFrame; } widgetItem->setText( qtr("DVD menus") ); break; case TELETEXT_BUTTONS: { QWidget *telexFrame = new QWidget( this ); QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame ); telexLayout->setSpacing( 0 ); telexLayout->setMargin( 0 ); QToolButton *telexOn = new QToolButton( telexFrame ); telexOn->setIcon( QIcon( ":/toolbar/tv" ) ); telexLayout->addWidget( telexOn ); QToolButton *telexTransparent = new QToolButton; telexTransparent->setIcon( QIcon( ":/toolbar/tvtelx" ) ); telexTransparent->setToolTip( qtr("Teletext transparency") ); telexLayout->addWidget( telexTransparent ); QSpinBox *telexPage = new QSpinBox; telexLayout->addWidget( telexPage ); widget = telexFrame; } widgetItem->setText( qtr("Teletext") ); break; case ADVANCED_CONTROLLER: { AdvControlsWidget *advControls = new AdvControlsWidget( p_intf, this ); widget = advControls; } widgetItem->setText( qtr("Advanced Buttons") ); break; case PLAYBACK_BUTTONS: { widget = new QWidget; DeckButtonsLayout *layout = new DeckButtonsLayout( widget ); BrowseButton *prev = new BrowseButton( widget, BrowseButton::Backward ); BrowseButton *next = new BrowseButton( widget ); RoundButton *play = new RoundButton( widget ); layout->setBackwardButton( prev ); layout->setForwardButton( next ); layout->setRoundButton( play ); } widgetItem->setText( qtr("Playback Buttons") ); break; case ASPECT_RATIO_COMBOBOX: widget = new AspectRatioComboBox( p_intf ); widgetItem->setText( qtr("Aspect ratio selector") ); break; case SPEED_LABEL: widget = new SpeedLabel( p_intf, this ); widgetItem->setText( qtr("Speed selector") ); break; case TIME_LABEL_ELAPSED: widget = new QLabel( "2:42", this ); widgetItem->setText( qtr("Elapsed time") ); break; case TIME_LABEL_REMAINING: widget = new QLabel( "-2:42", this ); widgetItem->setText( qtr("Total/Remaining time") ); break; default: msg_Warn( p_intf, "This should not happen %i", i ); break; } if( widget == NULL ) continue; widgetItem->setIcon( QIcon( QPixmap::grabWidget( widget ) ) ); widgetItem->setToolTip( widgetItem->text() ); widget->hide(); widgetItem->setData( Qt::UserRole, QVariant( i ) ); addItem( widgetItem ); delete widget; } }
controlMainWindow::controlMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::controlMainWindow) { ui->setupUi(this); ui->statusBar->addWidget(&m_txWidget); connect(&m_socketClient,SIGNAL(tx()),&m_txWidget,SLOT(tx())); connect(&m_socketClient,SIGNAL(rx()),&m_txWidget,SLOT(rx())); //Botones para la barra de herramientas: QToolButton* btnConnect = new QToolButton(this); btnConnect->setMinimumSize(64,64); btnConnect->setMaximumSize(64,64); btnConnect->setIcon(QIcon(":/icons/icons/connect-icon.png")); btnConnect->setIconSize(QSize(64,64)); connect(btnConnect,SIGNAL(toggled(bool)),ui->connectionWidget,SLOT(connectSocket(bool))); btnConnect->setCheckable(true); QToolButton* btnShowSensors = new QToolButton(this); btnShowSensors->setText("Sensors"); btnShowSensors->setCheckable(true); btnShowSensors->setChecked(false); connect(btnShowSensors,SIGNAL(toggled(bool)),ui->sensorViewWidget,SLOT(setVisible(bool))); connect(btnShowSensors,SIGNAL(toggled(bool)),&m_socketClient,SLOT(requestSensorData(bool))); QToolButton* btnShowBright = new QToolButton(this); btnShowBright->setText("Bright"); btnShowBright->setCheckable(true); btnShowBright->setChecked(false); connect(btnShowBright,SIGNAL(toggled(bool)),ui->groupBrightness,SLOT(setVisible(bool))); QToolButton* btnOffsetTool = new QToolButton(this); btnOffsetTool->setText("OffsetTool"); btnOffsetTool->setCheckable(true); btnOffsetTool->setChecked(false); connect(btnOffsetTool,SIGNAL(toggled(bool)),ui->groupOffset ,SLOT(setVisible(bool))); QToolButton* btnShowEffects = new QToolButton(this); btnShowEffects->setText("Effects"); btnShowEffects->setCheckable(true); btnShowEffects->setChecked(true); connect(btnShowEffects,SIGNAL(toggled(bool)),ui->effectsWidget ,SLOT(setVisible(bool))); ui->mainToolBar->addWidget(btnConnect); ui->mainToolBar->addWidget(btnShowSensors); ui->mainToolBar->addWidget(btnShowBright); ui->mainToolBar->addWidget(btnShowEffects); ui->mainToolBar->addWidget(btnOffsetTool); // ui->sensorViewWidget->hide(); // ui->effectsWidget->hide(); ui->groupBrightness->hide(); ui->groupOffset->hide(); connect(ui->connectionWidget,SIGNAL(ready()) ,this,SLOT(enableUI())); connect(ui->connectionWidget,SIGNAL(notReady()) ,this,SLOT(disableUI())); ui->connectionWidget->setClient(&m_socketClient); ui->sensorViewWidget->setClient(&m_socketClient); connect(ui->btnOff, SIGNAL(clicked(bool)),&m_socketClient, SLOT(off())); connect(ui->btnNext, SIGNAL(clicked(bool)),&m_socketClient, SLOT(nextEffect())); connect(ui->btnPrev, SIGNAL(clicked(bool)),&m_socketClient, SLOT(prevEffect())); connect(ui->btnCircle, SIGNAL(clicked(bool)),&m_socketClient, SLOT(animationCircle())); connect(ui->btnDoubleCircle, SIGNAL(clicked(bool)),&m_socketClient, SLOT(animationDoubleCircle())); connect(ui->btnRainbow, SIGNAL(clicked(bool)),&m_socketClient, SLOT(animationRainbow())); connect(ui->btnFlash , SIGNAL(clicked(bool)),&m_socketClient, SLOT(animationFlash())); connect(ui->btnSetColor, SIGNAL(clicked(bool)),this, SLOT(setColor())); connect(ui->sliderBrightness, SIGNAL(valueChanged(int)),this, SLOT(setBrightness(int))); connect(ui->dialOffset, SIGNAL(valueChanged(int)),&m_socketClient,SLOT(setOffset(int))); disableUI(); }
bossWindow::bossWindow(QWidget *parent) : QWidget(parent), ui(new Ui::bossWindow) { ui->setupUi(this); #pragma region window initialize QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity"); animation->setDuration(700); animation->setStartValue(0); animation->setEndValue(1); animation->start(); //界面动画,改变透明度的方式出现0 - 1渐变 //设置窗体标题栏隐藏并设置位于顶层 QPalette palette; setWindowOpacity(1); QPixmap pixmap("image/uiBG.png"); palette.setBrush(ui->Under->backgroundRole(),QBrush(pixmap)); ui->Under->setPalette(palette); ui->Under->setMask(pixmap.mask()); //可以将图片中透明部分显示为透明的 ui->Under->setAutoFillBackground(true); ui->lineEdit_passwd->setEchoMode(QLineEdit::Password); setWindowFlags(Qt::FramelessWindowHint); setAttribute(Qt::WA_TranslucentBackground); //构建最小化、最大化、关闭按钮 QToolButton *minButton = new QToolButton(this); QToolButton *closeButton= new QToolButton(this); connect (minButton,SIGNAL(clicked()),this,SLOT(showMinimized())); connect (closeButton,SIGNAL(clicked()),this,SLOT(wind_close()));//构建新槽 关闭当前窗口=注销 //获取最小化、关闭按钮图标 QPixmap minPix = style()->standardPixmap(QStyle::SP_TitleBarMinButton); QPixmap closePix = style()->standardPixmap(QStyle::SP_TitleBarCloseButton); //设置最小化、关闭按钮图标 minButton->setIcon(minPix); closeButton->setIcon(closePix); //设置最小化、关闭按钮在界面的位置 minButton->setGeometry(700-30,10,20,20); closeButton->setGeometry(700-8,10,20,20); //设置鼠标移至按钮上的提示信息 minButton->setToolTip(tr("最小化")); closeButton->setToolTip(tr("关闭")); //设置最小化、关闭按钮的样式 minButton->setStyleSheet("background-color:transparent;"); closeButton->setStyleSheet("background-color:transparent;"); qDebug()<< "asdasd"; // ui->frame_menu->hide(); ui->frame_order->hide();//查看页面隐藏 ui->frame_scy->hide(); ui->label_username->setText(all_SCY[active_scy].show_username());//用户名设置 ui->lcdNumber_amount->display(all_SCY[active_scy].show_amount_count());//总金额 ui->lcdNumber_counter->display(all_SCY[active_scy].show_order_count());//总订单数 #pragma endregion window initialize int i; /*菜单初始化*/ model_menu2->setHorizontalHeaderItem(0,new QStandardItem(QObject::tr("Name")));//行标设置 model_menu2->setHorizontalHeaderItem(1,new QStandardItem(QObject::tr("Price"))); model_menu2->setHorizontalHeaderItem(2,new QStandardItem(QObject::tr("Rank"))); ui->tableView_menu->setSelectionBehavior(QAbstractItemView::SelectRows);//点击选中行 ui->tableView_menu->setEditTriggers(QAbstractItemView::NoEditTriggers);//不能编辑 /*输出菜单至界面*/ for (i = 0;i<all_food.size();i++) { model_menu2->setItem(i, 0, new QStandardItem(all_food[i].show_food_name()));//输出菜品名字 model_menu2->setItem(i, 1, new QStandardItem(QString::number(all_food[i].show_food_price(),10)));//价格 model_menu2->setItem(i, 2, new QStandardItem("★★★★★"));//评分 } ui->tableView_menu->setModel(model_menu2);//讲model与tableview关联 ui->tableView_menu->setColumnWidth(0,184);//设置列宽 ui->tableView_menu->setColumnWidth(1,86); ui->tableView_menu->setColumnWidth(2,86); model_orders->setHorizontalHeaderItem(0,new QStandardItem(QObject::tr("OrderID"))); model_orders->setHorizontalHeaderItem(1,new QStandardItem(QObject::tr("Address"))); model_orders->setHorizontalHeaderItem(2,new QStandardItem(QObject::tr("Amount"))); model_orders->setHorizontalHeaderItem(3,new QStandardItem(QObject::tr("state"))); model_orders->setHorizontalHeaderItem(4,new QStandardItem(QObject::tr("Customer"))); model_orders->setHorizontalHeaderItem(5,new QStandardItem(QObject::tr("Deliver"))); ui->tableView_orders ->setSelectionBehavior(QAbstractItemView::SelectRows); ui->tableView_orders->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->tableView_orders->setModel(model_orders); ui->tableView_orders->setColumnWidth(0,50); ui->tableView_orders->setColumnWidth(1,200); ui->tableView_orders->setColumnWidth(2,50); ui->tableView_orders->setColumnWidth(3,80); ui->tableView_orders->setColumnWidth(4,80); ui->tableView_orders->setColumnWidth(5,80); set_view_orders(); model_scy->setHorizontalHeaderItem(0,new QStandardItem(QObject::tr("ID"))); model_scy->setHorizontalHeaderItem(1,new QStandardItem(QObject::tr("Name"))); model_scy->setHorizontalHeaderItem(2,new QStandardItem(QObject::tr("Delivering order"))); model_scy->setHorizontalHeaderItem(3,new QStandardItem(QObject::tr("Amount count"))); model_scy->setHorizontalHeaderItem(4,new QStandardItem(QObject::tr("Order count"))); ui->tableView_scy ->setSelectionBehavior(QAbstractItemView::SelectRows); ui->tableView_scy->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->tableView_scy->setModel(model_scy); set_view_scy(); }
/********************************************************************** * Speed control widget **********************************************************************/ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i, QWidget *_parent ) : QFrame( _parent ), p_intf( _p_i ) { QSizePolicy sizePolicy( QSizePolicy::Fixed, QSizePolicy::Maximum ); sizePolicy.setHorizontalStretch( 0 ); sizePolicy.setVerticalStretch( 0 ); speedSlider = new QSlider( this ); speedSlider->setSizePolicy( sizePolicy ); speedSlider->setMinimumSize( QSize( 140, 20 ) ); speedSlider->setOrientation( Qt::Horizontal ); speedSlider->setTickPosition( QSlider::TicksBelow ); speedSlider->setRange( -34, 34 ); speedSlider->setSingleStep( 1 ); speedSlider->setPageStep( 1 ); speedSlider->setTickInterval( 17 ); CONNECT( speedSlider, valueChanged( int ), this, updateRate( int ) ); QToolButton *normalSpeedButton = new QToolButton( this ); normalSpeedButton->setMaximumSize( QSize( 26, 16 ) ); normalSpeedButton->setAutoRaise( true ); normalSpeedButton->setText( "1x" ); normalSpeedButton->setToolTip( qtr( "Revert to normal play speed" ) ); CONNECT( normalSpeedButton, clicked(), this, resetRate() ); QToolButton *slowerButton = new QToolButton( this ); slowerButton->setMaximumSize( QSize( 26, 16 ) ); slowerButton->setAutoRaise( true ); slowerButton->setToolTip( tooltipL[SLOWER_BUTTON] ); slowerButton->setIcon( QIcon( iconL[SLOWER_BUTTON] ) ); CONNECT( slowerButton, clicked(), THEMIM->getIM(), slower() ); QToolButton *fasterButton = new QToolButton( this ); fasterButton->setMaximumSize( QSize( 26, 16 ) ); fasterButton->setAutoRaise( true ); fasterButton->setToolTip( tooltipL[FASTER_BUTTON] ); fasterButton->setIcon( QIcon( iconL[FASTER_BUTTON] ) ); CONNECT( fasterButton, clicked(), THEMIM->getIM(), faster() ); /* spinBox = new QDoubleSpinBox(); spinBox->setDecimals( 2 ); spinBox->setMaximum( 32 ); spinBox->setMinimum( 0.03F ); spinBox->setSingleStep( 0.10F ); spinBox->setAlignment( Qt::AlignRight ); CONNECT( spinBox, valueChanged( double ), this, updateSpinBoxRate( double ) ); */ QGridLayout* speedControlLayout = new QGridLayout( this ); speedControlLayout->addWidget( speedSlider, 0, 0, 1, 3 ); speedControlLayout->addWidget( slowerButton, 1, 0 ); speedControlLayout->addWidget( normalSpeedButton, 1, 1, 1, 1, Qt::AlignRight ); speedControlLayout->addWidget( fasterButton, 1, 2, 1, 1, Qt::AlignRight ); //speedControlLayout->addWidget( spinBox ); speedControlLayout->setContentsMargins( 0, 0, 0, 0 ); speedControlLayout->setSpacing( 0 ); lastValue = 0; activateOnState(); }
TimelineSideBarWidget::TimelineSideBarWidget(QWidget* parent, SearchModel* searchModel, SearchModificationHelper* searchModificationHelper) : SidebarWidget(parent), d(new TimelineSideBarWidgetPriv) { setObjectName("TimeLine Sidebar"); d->searchModificationHelper = searchModificationHelper; d->timer = new QTimer(this); setAttribute(Qt::WA_DeleteOnClose); QVBoxLayout* vlay = new QVBoxLayout(this); QFrame* panel = new QFrame(this); panel->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); panel->setLineWidth(1); QGridLayout* grid = new QGridLayout(panel); // --------------------------------------------------------------- QWidget* hbox1 = new QWidget(panel); QHBoxLayout* hlay = new QHBoxLayout(hbox1); QLabel* label1 = new QLabel(i18n("Time Unit:"), hbox1); d->timeUnitCB = new KComboBox(hbox1); d->timeUnitCB->addItem(i18n("Day"), TimeLineWidget::Day); d->timeUnitCB->addItem(i18n("Week"), TimeLineWidget::Week); d->timeUnitCB->addItem(i18n("Month"), TimeLineWidget::Month); d->timeUnitCB->addItem(i18n("Year"), TimeLineWidget::Year); d->timeUnitCB->setCurrentIndex((int)TimeLineWidget::Month); d->timeUnitCB->setFocusPolicy(Qt::NoFocus); d->timeUnitCB->setWhatsThis(i18n("<p>Select the histogram time unit.</p>" "<p>You can change the graph decade to zoom in or zoom out over time.</p>")); QWidget* scaleBox = new QWidget(hbox1); QHBoxLayout* hlay2 = new QHBoxLayout(scaleBox); d->scaleBG = new QButtonGroup(scaleBox); d->scaleBG->setExclusive(true); scaleBox->setWhatsThis( i18n("<p>Select the histogram scale.</p>" "<p>If the date's maximal counts are small, you can use the linear scale.</p>" "<p>Logarithmic scale can be used when the maximal counts are big; " "if it is used, all values (small and large) will be visible on the " "graph.</p>")); QToolButton* linHistoButton = new QToolButton(scaleBox); linHistoButton->setToolTip( i18n( "Linear" ) ); linHistoButton->setIcon(KIcon("view-object-histogram-linear")); linHistoButton->setCheckable(true); d->scaleBG->addButton(linHistoButton, TimeLineWidget::LinScale); QToolButton* logHistoButton = new QToolButton(scaleBox); logHistoButton->setToolTip( i18n( "Logarithmic" ) ); logHistoButton->setIcon(KIcon("view-object-histogram-logarithmic")); logHistoButton->setCheckable(true); d->scaleBG->addButton(logHistoButton, TimeLineWidget::LogScale); hlay2->setMargin(0); hlay2->setSpacing(0); hlay2->addWidget(linHistoButton); hlay2->addWidget(logHistoButton); hlay->setMargin(0); hlay->setSpacing(KDialog::spacingHint()); hlay->addWidget(label1); hlay->addWidget(d->timeUnitCB); hlay->addItem(new QSpacerItem(10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum)); hlay->addWidget(scaleBox); // --------------------------------------------------------------- d->timeLineWidget = new TimeLineWidget(panel); d->scrollBar = new QScrollBar(panel); d->scrollBar->setOrientation(Qt::Horizontal); d->scrollBar->setMinimum(0); d->scrollBar->setSingleStep(1); d->cursorDateLabel = new KSqueezedTextLabel(0, panel); d->cursorCountLabel = new QLabel(panel); d->cursorCountLabel->setAlignment(Qt::AlignRight); // --------------------------------------------------------------- KHBox* hbox2 = new KHBox(panel); hbox2->setMargin(0); hbox2->setSpacing(KDialog::spacingHint()); d->resetButton = new QToolButton(hbox2); d->resetButton->setIcon(SmallIcon("document-revert")); d->resetButton->setToolTip(i18n("Clear current selection")); d->resetButton->setWhatsThis(i18n("If you press this button, the current date selection on the time-line will be cleared.")); d->nameEdit = new KLineEdit(hbox2); d->nameEdit->setClearButtonShown(true); d->nameEdit->setWhatsThis(i18n("Enter the name of the current dates search to save in the " "\"My Date Searches\" view")); d->saveButton = new QToolButton(hbox2); d->saveButton->setIcon(SmallIcon("document-save")); d->saveButton->setEnabled(false); d->saveButton->setToolTip(i18n("Save current selection to a new virtual Album")); d->saveButton->setWhatsThis(i18n("If you press this button, the dates selected on the time-line will be " "saved to a new search virtual Album using the name set on the left.")); // --------------------------------------------------------------- grid->addWidget(hbox1, 0, 0, 1, 4); grid->addWidget(d->cursorDateLabel, 1, 0, 1, 3); grid->addWidget(d->cursorCountLabel, 1, 3, 1, 1); grid->addWidget(d->timeLineWidget, 2, 0, 1, 4); grid->addWidget(d->scrollBar, 3, 0, 1, 4); grid->addWidget(hbox2, 4, 0, 1, 4); grid->setColumnStretch(2, 10); grid->setMargin(KDialog::spacingHint()); grid->setSpacing(KDialog::spacingHint()); // --------------------------------------------------------------- d->timeLineFolderView = new EditableSearchTreeView(this, searchModel, searchModificationHelper); d->timeLineFolderView->setConfigGroup(getConfigGroup()); d->timeLineFolderView->filteredModel()->listTimelineSearches(); d->timeLineFolderView->filteredModel()->setListTemporarySearches(false); d->timeLineFolderView->setAlbumManagerCurrentAlbum(true); d->searchDateBar = new SearchTextBar(this, "TimeLineViewSearchDateBar"); d->searchDateBar->setModel(d->timeLineFolderView->filteredModel(), AbstractAlbumModel::AlbumIdRole, AbstractAlbumModel::AlbumTitleRole); d->searchDateBar->setFilterModel(d->timeLineFolderView->albumFilterModel()); vlay->addWidget(panel); vlay->addWidget(d->timeLineFolderView); vlay->addItem(new QSpacerItem(KDialog::spacingHint(), KDialog::spacingHint(), QSizePolicy::Minimum, QSizePolicy::Minimum)); vlay->addWidget(d->searchDateBar); vlay->setMargin(0); vlay->setSpacing(0); // --------------------------------------------------------------- connect(AlbumManager::instance(), SIGNAL(signalDatesMapDirty(const QMap<QDateTime, int>&)), d->timeLineWidget, SLOT(slotDatesMap(const QMap<QDateTime, int>&))); connect(d->timeLineFolderView, SIGNAL(currentAlbumChanged(Album*)), this, SLOT(slotAlbumSelected(Album*))); connect(d->timeUnitCB, SIGNAL(activated(int)), this, SLOT(slotTimeUnitChanged(int))); connect(d->scaleBG, SIGNAL(buttonReleased(int)), this, SLOT(slotScaleChanged(int))); connect(d->timeLineWidget, SIGNAL(signalDateMapChanged()), this, SLOT(slotInit())); connect(d->timeLineWidget, SIGNAL(signalCursorPositionChanged()), this, SLOT(slotCursorPositionChanged())); connect(d->timeLineWidget, SIGNAL(signalSelectionChanged()), this, SLOT(slotSelectionChanged())); connect(d->timeLineWidget, SIGNAL(signalRefDateTimeChanged()), this, SLOT(slotRefDateTimeChanged())); connect(d->timer, SIGNAL(timeout()), this, SLOT(slotUpdateCurrentDateSearchAlbum())); connect(d->resetButton, SIGNAL(clicked()), this, SLOT(slotResetSelection())); connect(d->saveButton, SIGNAL(clicked()), this, SLOT(slotSaveSelection())); connect(d->scrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotScrollBarValueChanged(int))); connect(d->nameEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotCheckAboutSelection())); connect(d->nameEdit, SIGNAL(returnPressed(const QString&)), d->saveButton, SLOT(animateClick())); }
QgsBookmarks::QgsBookmarks( QWidget *parent ) : QgsDockWidget( parent ) { setupUi( this ); connect( lstBookmarks, &QTreeView::doubleClicked, this, &QgsBookmarks::lstBookmarks_doubleClicked ); restorePosition(); bookmarksDockContents->layout()->setMargin( 0 ); bookmarksDockContents->layout()->setContentsMargins( 0, 0, 0, 0 ); static_cast< QGridLayout * >( bookmarksDockContents->layout() )->setVerticalSpacing( 0 ); QToolButton *btnImpExp = new QToolButton; btnImpExp->setAutoRaise( true ); btnImpExp->setToolTip( tr( "Import/Export Bookmarks" ) ); btnImpExp->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSharing.svg" ) ) ); btnImpExp->setPopupMode( QToolButton::InstantPopup ); QMenu *share = new QMenu( this ); QAction *btnExport = share->addAction( tr( "&Export" ) ); QAction *btnImport = share->addAction( tr( "&Import" ) ); btnExport->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSharingExport.svg" ) ) ); btnImport->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSharingImport.svg" ) ) ); connect( btnExport, &QAction::triggered, this, &QgsBookmarks::exportToXml ); connect( btnImport, &QAction::triggered, this, &QgsBookmarks::importFromXml ); btnImpExp->setMenu( share ); connect( actionAdd, &QAction::triggered, this, &QgsBookmarks::addClicked ); connect( actionDelete, &QAction::triggered, this, &QgsBookmarks::deleteClicked ); connect( actionZoomTo, &QAction::triggered, this, &QgsBookmarks::zoomToBookmark ); mBookmarkToolbar->addWidget( btnImpExp ); // open the database QSqlDatabase db = QSqlDatabase::addDatabase( QStringLiteral( "QSQLITE" ), QStringLiteral( "bookmarks" ) ); db.setDatabaseName( QgsApplication::qgisUserDatabaseFilePath() ); if ( !db.open() ) { QMessageBox::warning( this, tr( "Error" ), tr( "Unable to open bookmarks database.\nDatabase: %1\nDriver: %2\nDatabase: %3" ) .arg( QgsApplication::qgisUserDatabaseFilePath(), db.lastError().driverText(), db.lastError().databaseText() ) ); deleteLater(); return; } mQgisModel = new QSqlTableModel( this, db ); mQgisModel->setTable( QStringLiteral( "tbl_bookmarks" ) ); mQgisModel->setSort( 0, Qt::AscendingOrder ); mQgisModel->select(); mQgisModel->setEditStrategy( QSqlTableModel::OnFieldChange ); // set better headers then column names from table mQgisModel->setHeaderData( 0, Qt::Horizontal, tr( "ID" ) ); mQgisModel->setHeaderData( 1, Qt::Horizontal, tr( "Name" ) ); mQgisModel->setHeaderData( 2, Qt::Horizontal, tr( "Project" ) ); mQgisModel->setHeaderData( 3, Qt::Horizontal, tr( "xMin" ) ); mQgisModel->setHeaderData( 4, Qt::Horizontal, tr( "yMin" ) ); mQgisModel->setHeaderData( 5, Qt::Horizontal, tr( "xMax" ) ); mQgisModel->setHeaderData( 6, Qt::Horizontal, tr( "yMax" ) ); mQgisModel->setHeaderData( 7, Qt::Horizontal, tr( "SRID" ) ); mProjectModel = new QgsProjectBookmarksTableModel(); mModel.reset( new QgsMergedBookmarksTableModel( *mQgisModel, *mProjectModel, lstBookmarks ) ); lstBookmarks->setModel( mModel.get() ); QgsSettings settings; lstBookmarks->header()->restoreState( settings.value( QStringLiteral( "Windows/Bookmarks/headerstate" ) ).toByteArray() ); #ifndef QGISDEBUG lstBookmarks->setColumnHidden( 0, true ); #endif }
View2D::View2D(const QString &name, QWidget *parent) : QFrame(parent) { setFrameStyle(Sunken | StyledPanel); graphicsView = new GraphicsView(this); graphicsView->setRenderHint(QPainter::Antialiasing, false); graphicsView->setDragMode(QGraphicsView::RubberBandDrag); graphicsView->setOptimizationFlags(QGraphicsView::DontSavePainterState); graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate); graphicsView->setTransformationAnchor(QGraphicsView::AnchorUnderMouse); int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize); QSize iconSize(size, size); QToolButton *zoomInIcon = new QToolButton; zoomInIcon->setAutoRepeat(true); zoomInIcon->setAutoRepeatInterval(33); zoomInIcon->setAutoRepeatDelay(0); zoomInIcon->setIcon(QPixmap(":/zoomin.png")); zoomInIcon->setIconSize(iconSize); QToolButton *zoomOutIcon = new QToolButton; zoomOutIcon->setAutoRepeat(true); zoomOutIcon->setAutoRepeatInterval(33); zoomOutIcon->setAutoRepeatDelay(0); zoomOutIcon->setIcon(QPixmap(":/zoomout.png")); zoomOutIcon->setIconSize(iconSize); zoomSlider = new QSlider; zoomSlider->setMinimum(0); zoomSlider->setMaximum(500); zoomSlider->setValue(250); zoomSlider->setTickPosition(QSlider::TicksRight); // Zoom slider layout QVBoxLayout *zoomSliderLayout = new QVBoxLayout; zoomSliderLayout->addWidget(zoomInIcon); zoomSliderLayout->addWidget(zoomSlider); zoomSliderLayout->addWidget(zoomOutIcon); QToolButton *rotateLeftIcon = new QToolButton; rotateLeftIcon->setIcon(QPixmap(":/rotateleft.png")); rotateLeftIcon->setIconSize(iconSize); QToolButton *rotateRightIcon = new QToolButton; rotateRightIcon->setIcon(QPixmap(":/rotateright.png")); rotateRightIcon->setIconSize(iconSize); rotateSlider = new QSlider; rotateSlider->setOrientation(Qt::Horizontal); rotateSlider->setMinimum(-360); rotateSlider->setMaximum(360); rotateSlider->setValue(0); rotateSlider->setTickPosition(QSlider::TicksBelow); // Rotate slider layout QHBoxLayout *rotateSliderLayout = new QHBoxLayout; rotateSliderLayout->addWidget(rotateLeftIcon); rotateSliderLayout->addWidget(rotateSlider); rotateSliderLayout->addWidget(rotateRightIcon); resetButton = new QToolButton; resetButton->setText(tr("0")); resetButton->setEnabled(false); // Label layout QHBoxLayout *labelLayout = new QHBoxLayout; label = new QLabel(name); deleteVertexButton = new QToolButton; deleteVertexButton->setText(tr("Delete")); label2 = new QLabel(tr("Pointer Mode")); selectModeButton = new QToolButton; selectModeButton->setText(tr("Select")); selectModeButton->setCheckable(true); selectModeButton->setChecked(true); dragModeButton = new QToolButton; dragModeButton->setText(tr("Drag")); dragModeButton->setCheckable(true); dragModeButton->setChecked(false); antialiasButton = new QToolButton; antialiasButton->setText(tr("Antialiasing")); antialiasButton->setCheckable(true); antialiasButton->setChecked(false); openGlButton = new QToolButton; openGlButton->setText(tr("OpenGL")); openGlButton->setCheckable(true); #ifndef QT_NO_OPENGL openGlButton->setEnabled(QGLFormat::hasOpenGL()); #else openGlButton->setEnabled(false); #endif printButton = new QToolButton; printButton->setIcon(QIcon(QPixmap(":/fileprint.png"))); QButtonGroup *pointerModeGroup = new QButtonGroup; pointerModeGroup->setExclusive(true); pointerModeGroup->addButton(selectModeButton); pointerModeGroup->addButton(dragModeButton); labelLayout->addWidget(label); labelLayout->addStretch(); //labelLayout->addWidget(label2); //labelLayout->addWidget(selectModeButton); //labelLayout->addWidget(dragModeButton); //labelLayout->addStretch(); //labelLayout->addWidget(antialiasButton); //labelLayout->addWidget(openGlButton); //labelLayout->addWidget(printButton); labelLayout->addWidget(deleteVertexButton); QGridLayout *topLayout = new QGridLayout; //topLayout->addLayout(labelLayout, 0, 0); topLayout->addWidget(graphicsView, 1, 0); topLayout->addLayout(zoomSliderLayout, 1, 1); topLayout->addLayout(rotateSliderLayout, 2, 0); topLayout->addWidget(resetButton, 2, 1); setLayout(topLayout); connect(resetButton, SIGNAL(clicked()), this, SLOT(resetView())); connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix())); connect(rotateSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix())); connect(graphicsView->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setResetButtonEnabled())); connect(graphicsView->horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setResetButtonEnabled())); connect(selectModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode())); connect(dragModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode())); connect(antialiasButton, SIGNAL(toggled(bool)), this, SLOT(toggleAntialiasing())); connect(openGlButton, SIGNAL(toggled(bool)), this, SLOT(toggleOpenGL())); connect(rotateLeftIcon, SIGNAL(clicked()), this, SLOT(rotateLeft())); connect(rotateRightIcon, SIGNAL(clicked()), this, SLOT(rotateRight())); connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn())); connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut())); connect(printButton, SIGNAL(clicked()), this, SLOT(print())); connect(deleteVertexButton, SIGNAL(clicked()), this, SLOT(deleteVertex())); setupMatrix(); }
QbsRunConfigurationWidget::QbsRunConfigurationWidget(QbsRunConfiguration *rc, QWidget *parent) : QWidget(parent), m_rc(rc), m_ignoreChange(false), m_isShown(false) { QVBoxLayout *vboxTopLayout = new QVBoxLayout(this); vboxTopLayout->setMargin(0); QHBoxLayout *hl = new QHBoxLayout(); hl->addStretch(); m_disabledIcon = new QLabel(this); m_disabledIcon->setPixmap(QPixmap(QLatin1String(":/projectexplorer/images/compile_warning.png"))); hl->addWidget(m_disabledIcon); m_disabledReason = new QLabel(this); m_disabledReason->setVisible(false); hl->addWidget(m_disabledReason); hl->addStretch(); vboxTopLayout->addLayout(hl); m_detailsContainer = new Utils::DetailsWidget(this); m_detailsContainer->setState(Utils::DetailsWidget::NoSummary); vboxTopLayout->addWidget(m_detailsContainer); QWidget *detailsWidget = new QWidget(m_detailsContainer); m_detailsContainer->setWidget(detailsWidget); QFormLayout *toplayout = new QFormLayout(detailsWidget); toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); toplayout->setMargin(0); m_executableLineEdit = new QLineEdit(this); m_executableLineEdit->setEnabled(false); toplayout->addRow(tr("Executable:"), m_executableLineEdit); QLabel *argumentsLabel = new QLabel(tr("Arguments:"), this); m_argumentsLineEdit = new QLineEdit(m_rc->rawCommandLineArguments(), this); argumentsLabel->setBuddy(m_argumentsLineEdit); toplayout->addRow(argumentsLabel, m_argumentsLineEdit); m_workingDirectoryEdit = new Utils::PathChooser(this); m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory); ProjectExplorer::EnvironmentAspect *aspect = m_rc->extraAspect<ProjectExplorer::EnvironmentAspect>(); if (aspect) { connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged())); environmentWasChanged(); } m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory")); QToolButton *resetButton = new QToolButton(this); resetButton->setToolTip(tr("Reset to default")); resetButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_RESET))); QHBoxLayout *boxlayout = new QHBoxLayout(); boxlayout->setMargin(0); boxlayout->addWidget(m_workingDirectoryEdit); boxlayout->addWidget(resetButton); toplayout->addRow(tr("Working directory:"), boxlayout); QHBoxLayout *innerBox = new QHBoxLayout(); m_useTerminalCheck = new QCheckBox(tr("Run in terminal"), this); m_useTerminalCheck->setChecked(m_rc->runMode() == ProjectExplorer::LocalApplicationRunConfiguration::Console); m_useTerminalCheck->setVisible(!m_rc->forcedGuiMode()); innerBox->addWidget(m_useTerminalCheck); innerBox->addStretch(); toplayout->addRow(QString(), innerBox); runConfigurationEnabledChange(); connect(m_workingDirectoryEdit, SIGNAL(changed(QString)), this, SLOT(workDirectoryEdited())); connect(resetButton, SIGNAL(clicked()), this, SLOT(workingDirectoryWasReset())); connect(m_argumentsLineEdit, SIGNAL(textEdited(QString)), this, SLOT(argumentsEdited(QString))); connect(m_useTerminalCheck, SIGNAL(toggled(bool)), this, SLOT(termToggled(bool))); connect(m_rc, SIGNAL(baseWorkingDirectoryChanged(QString)), this, SLOT(workingDirectoryChanged(QString))); connect(m_rc, SIGNAL(commandLineArgumentsChanged(QString)), this, SLOT(commandLineArgumentsChanged(QString))); connect(m_rc, SIGNAL(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode)), this, SLOT(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode))); connect(m_rc, SIGNAL(targetInformationChanged()), this, SLOT(targetInformationHasChanged()), Qt::QueuedConnection); connect(m_rc, SIGNAL(enabledChanged()), this, SLOT(runConfigurationEnabledChange())); }
// Configuration widget CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *cmakeRunConfiguration, QWidget *parent) : QWidget(parent), m_ignoreChange(false), m_cmakeRunConfiguration(cmakeRunConfiguration) { QFormLayout *fl = new QFormLayout(); fl->setMargin(0); fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); QLineEdit *argumentsLineEdit = new QLineEdit(); argumentsLineEdit->setText(cmakeRunConfiguration->commandLineArguments()); connect(argumentsLineEdit, SIGNAL(textChanged(QString)), this, SLOT(setArguments(QString))); fl->addRow(tr("Arguments:"), argumentsLineEdit); m_workingDirectoryEdit = new Utils::PathChooser(); m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory); m_workingDirectoryEdit->setBaseFileName(m_cmakeRunConfiguration->target()->project()->projectDirectory()); m_workingDirectoryEdit->setPath(m_cmakeRunConfiguration->baseWorkingDirectory()); m_workingDirectoryEdit->setHistoryCompleter(QLatin1String("CMake.WorkingDir.History")); EnvironmentAspect *aspect = m_cmakeRunConfiguration->extraAspect<EnvironmentAspect>(); if (aspect) { connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged())); environmentWasChanged(); } m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory")); QToolButton *resetButton = new QToolButton(); resetButton->setToolTip(tr("Reset to default.")); resetButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_RESET))); QHBoxLayout *boxlayout = new QHBoxLayout(); boxlayout->addWidget(m_workingDirectoryEdit); boxlayout->addWidget(resetButton); fl->addRow(tr("Working directory:"), boxlayout); QCheckBox *runInTerminal = new QCheckBox; fl->addRow(tr("Run in Terminal"), runInTerminal); m_detailsContainer = new Utils::DetailsWidget(this); m_detailsContainer->setState(Utils::DetailsWidget::NoSummary); QWidget *m_details = new QWidget(m_detailsContainer); m_detailsContainer->setWidget(m_details); m_details->setLayout(fl); QVBoxLayout *vbx = new QVBoxLayout(this); vbx->setMargin(0); vbx->addWidget(m_detailsContainer); connect(m_workingDirectoryEdit, SIGNAL(changed(QString)), this, SLOT(setWorkingDirectory())); connect(resetButton, SIGNAL(clicked()), this, SLOT(resetWorkingDirectory())); connect(runInTerminal, SIGNAL(toggled(bool)), this, SLOT(runInTerminalToggled(bool))); connect(m_cmakeRunConfiguration, SIGNAL(baseWorkingDirectoryChanged(QString)), this, SLOT(workingDirectoryChanged(QString))); setEnabled(m_cmakeRunConfiguration->isEnabled()); }
CapNJoinMenu::CapNJoinMenu(QWidget *parent) : QMenu(parent) { QGridLayout *mainLayout = new QGridLayout(); mainLayout->setMargin(2); // The cap group capGroup = new QButtonGroup(this); capGroup->setExclusive(true); QToolButton *button = 0; button = new QToolButton(this); button->setIcon(koIcon("stroke-cap-butt")); button->setCheckable(true); button->setToolTip(i18n("Butt cap")); capGroup->addButton(button, Qt::FlatCap); mainLayout->addWidget(button, 2, 0); button = new QToolButton(this); button->setIcon(koIcon("stroke-cap-round")); button->setCheckable(true); button->setToolTip(i18n("Round cap")); capGroup->addButton(button, Qt::RoundCap); mainLayout->addWidget(button, 2, 1); button = new QToolButton(this); button->setIcon(koIcon("stroke-cap-square")); button->setCheckable(true); button->setToolTip(i18n("Square cap")); capGroup->addButton(button, Qt::SquareCap); mainLayout->addWidget(button, 2, 2, Qt::AlignLeft); // The join group joinGroup = new QButtonGroup(this); joinGroup->setExclusive(true); button = new QToolButton(this); button->setIcon(koIcon("stroke-join-miter")); button->setCheckable(true); button->setToolTip(i18n("Miter join")); joinGroup->addButton(button, Qt::MiterJoin); mainLayout->addWidget(button, 3, 0); button = new QToolButton(this); button->setIcon(koIcon("stroke-join-round")); button->setCheckable(true); button->setToolTip(i18n("Round join")); joinGroup->addButton(button, Qt::RoundJoin); mainLayout->addWidget(button, 3, 1); button = new QToolButton(this); button->setIcon(koIcon("stroke-join-bevel")); button->setCheckable(true); button->setToolTip(i18n("Bevel join")); joinGroup->addButton(button, Qt::BevelJoin); mainLayout->addWidget(button, 3, 2, Qt::AlignLeft); // Miter limit // set min/max/step and value in points, then set actual unit miterLimit = new KisDoubleParseUnitSpinBox(this); miterLimit->setMinMaxStep(0.0, 1000.0, 0.5); miterLimit->setDecimals(2); miterLimit->setUnit(KoUnit(KoUnit::Point)); miterLimit->setToolTip(i18n("Miter limit")); mainLayout->addWidget(miterLimit, 4, 0, 1, 3); mainLayout->setSizeConstraint(QLayout::SetMinAndMaxSize); setLayout(mainLayout); }
/** * Constructor. */ QG_LayerWidget::QG_LayerWidget(QG_ActionHandler* ah, QWidget* parent, const char* name, Qt::WindowFlags f) : QWidget(parent, f) { setObjectName(name); actionHandler = ah; layerList = nullptr; showByBlock = false; lastLayer = nullptr; layerModel = new QG_LayerModel(this); layerView = new QTableView(this); layerView->setModel (layerModel); layerView->setShowGrid (false); layerView->setSelectionMode(QAbstractItemView::SingleSelection); layerView->setEditTriggers(QAbstractItemView::NoEditTriggers); layerView->setFocusPolicy(Qt::NoFocus); layerView->setMinimumHeight(140); layerView->setColumnWidth(QG_LayerModel::VISIBLE, 18); layerView->setColumnWidth(QG_LayerModel::LOCKED, 18); layerView->setColumnWidth(QG_LayerModel::PRINT, 24); layerView->setColumnWidth(QG_LayerModel::CONSTRUCTION, 18); layerView->verticalHeader()->hide(); layerView->horizontalHeader()->setStretchLastSection(true); layerView->horizontalHeader()->hide(); QVBoxLayout* lay = new QVBoxLayout(this); lay->setSpacing ( 0 ); lay->setContentsMargins(2, 2, 2, 2); QHBoxLayout* layButtons = new QHBoxLayout; QToolButton* but; const QSize minButSize(22,22); // show all layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/visiblelayer.png")); but->setMinimumSize(minButSize); but->setToolTip(tr("Show all layers")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersDefreezeAll())); layButtons->addWidget(but); // hide all layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/hiddenlayer.png")); but->setMinimumSize(minButSize); but->setToolTip(tr("Hide all layers")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersFreezeAll())); layButtons->addWidget(but); // add layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/layeradd.png")); but->setMinimumSize(minButSize); but->setToolTip(tr("Add a layer")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersAdd())); layButtons->addWidget(but); // remove layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/layerremove.png")); but->setMinimumSize(minButSize); but->setToolTip(tr("Remove the current layer")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersRemove())); layButtons->addWidget(but); // rename layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/layeredit.png")); but->setMinimumSize(minButSize); but->setToolTip(tr("Modify layer attributes / rename")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersEdit())); layButtons->addWidget(but); // lineEdit to filter layer list with RegEx matchLayerName = new QLineEdit(this); matchLayerName->setReadOnly(false); //matchLayerName->setText("*"); matchLayerName->setToolTip(tr("Looking for matching layer names")); connect(matchLayerName, SIGNAL( textChanged(QString) ), this, SLOT( slotUpdateLayerList() ) ); //lay->addWidget(caption); lay->addWidget(matchLayerName); lay->addLayout(layButtons); lay->addWidget(layerView); this->setLayout(lay); connect(layerView, SIGNAL(pressed(QModelIndex)), this, SLOT(slotActivated(QModelIndex))); }
TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerInfo_User *_ownUser, const ServerInfo_Room &info) : Tab(_tabSupervisor), client(_client), roomId(info.room_id()), roomName(QString::fromStdString(info.name())), ownUser(_ownUser) { const int gameTypeListSize = info.gametype_list_size(); for (int i = 0; i < gameTypeListSize; ++i) gameTypes.insert(info.gametype_list(i).game_type_id(), QString::fromStdString(info.gametype_list(i).description())); QMap<int, GameTypeMap> tempMap; tempMap.insert(info.room_id(), gameTypes); gameSelector = new GameSelector(client, tabSupervisor, this, QMap<int, QString>(), tempMap, true, true); userList = new UserList(tabSupervisor, client, UserList::RoomList); connect(userList, SIGNAL(openMessageDialog(const QString &, bool)), this, SIGNAL(openMessageDialog(const QString &, bool))); chatView = new ChatView(tabSupervisor, 0, true); connect(chatView, SIGNAL(showMentionPopup(QString&)), this, SLOT(actShowMentionPopup(QString&))); connect(chatView, SIGNAL(messageClickedSignal()), this, SLOT(focusTab())); connect(chatView, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool))); connect(chatView, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString))); connect(chatView, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString))); connect(chatView, SIGNAL(addMentionTag(QString)), this, SLOT(addMentionTag(QString))); sayLabel = new QLabel; sayEdit = new QLineEdit; sayLabel->setBuddy(sayEdit); connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(sendMessage())); QMenu *chatSettingsMenu = new QMenu(this); aClearChat = chatSettingsMenu->addAction(QString()); aClearChat->setShortcut(QKeySequence("F12")); connect(aClearChat, SIGNAL(triggered()), this, SLOT(actClearChat())); chatSettingsMenu->addSeparator(); aOpenChatSettings = chatSettingsMenu->addAction(QString()); connect(aOpenChatSettings, SIGNAL(triggered()), this, SLOT(actOpenChatSettings())); QToolButton *chatSettingsButton = new QToolButton; chatSettingsButton->setIcon(QIcon(":/resources/icon_settings.svg")); chatSettingsButton->setMenu(chatSettingsMenu); chatSettingsButton->setPopupMode(QToolButton::InstantPopup); QHBoxLayout *sayHbox = new QHBoxLayout; sayHbox->addWidget(sayLabel); sayHbox->addWidget(sayEdit); sayHbox->addWidget(chatSettingsButton); QVBoxLayout *chatVbox = new QVBoxLayout; chatVbox->addWidget(chatView); chatVbox->addLayout(sayHbox); chatGroupBox = new QGroupBox; chatGroupBox->setLayout(chatVbox); QSplitter *splitter = new QSplitter(Qt::Vertical); splitter->addWidget(gameSelector); splitter->addWidget(chatGroupBox); QHBoxLayout *hbox = new QHBoxLayout; hbox->addWidget(splitter, 3); hbox->addWidget(userList, 1); aLeaveRoom = new QAction(this); connect(aLeaveRoom, SIGNAL(triggered()), this, SLOT(actLeaveRoom())); roomMenu = new QMenu(this); roomMenu->addAction(aLeaveRoom); addTabMenu(roomMenu); retranslateUi(); setLayout(hbox); const int userListSize = info.user_list_size(); for (int i = 0; i < userListSize; ++i) userList->processUserInfo(info.user_list(i), true); userList->sortItems(); const int gameListSize = info.game_list_size(); for (int i = 0; i < gameListSize; ++i) gameSelector->processGameInfo(info.game_list(i)); }
KoPADocumentStructureDocker::KoPADocumentStructureDocker(KoDocumentSectionView::DisplayMode mode, KoPageApp::PageType pageType, QWidget* parent) : QDockWidget(parent) , KoCanvasObserverBase() , m_doc(0) , m_model(0) { setWindowTitle(i18n("Document")); QWidget *mainWidget = new QWidget(this); QGridLayout* layout = new QGridLayout(mainWidget); layout->addWidget(m_sectionView = new KoDocumentSectionView(mainWidget), 0, 0, 1, -1); QToolButton *button = new QToolButton(mainWidget); button->setIcon(koIcon("list-add")); if (pageType == KoPageApp::Slide) { button->setToolTip(i18n("Add a new slide or layer")); } else { button->setToolTip(i18n("Add a new page or layer")); } layout->addWidget(button, 1, 0); QMenu *menu = new QMenu(button); button->setMenu(menu); button->setPopupMode(QToolButton::InstantPopup); menu->addAction(koIcon("document-new"), (pageType == KoPageApp::Slide) ? i18n("Slide") : i18n("Page"), this, SLOT(addPage())); m_addLayerAction = menu->addAction(koIcon("layer-new"), i18n("Layer"), this, SLOT(addLayer())); m_buttonGroup = new QButtonGroup(mainWidget); m_buttonGroup->setExclusive(false); button = new QToolButton(mainWidget); button->setIcon(koIcon("list-remove")); button->setToolTip(i18n("Delete selected objects")); m_buttonGroup->addButton(button, Button_Delete); layout->addWidget(button, 1, 1); button = new QToolButton(mainWidget); button->setIcon(koIcon("arrow-up")); button->setToolTip(i18n("Raise selected objects")); m_buttonGroup->addButton(button, Button_Raise); layout->addWidget(button, 1, 3); button = new QToolButton(mainWidget); button->setIcon(koIcon("arrow-down")); button->setToolTip(i18n("Lower selected objects")); m_buttonGroup->addButton(button, Button_Lower); layout->addWidget(button, 1, 4); button = new QToolButton(mainWidget); menu = new QMenu(button); QActionGroup *group = new QActionGroup(this); m_viewModeActions.insert(KoDocumentSectionView::MinimalMode, menu->addAction(koIcon("view-list-text"), i18n("Minimal View"), this, SLOT(minimalView()))); m_viewModeActions.insert(KoDocumentSectionView::DetailedMode, menu->addAction(koIcon("view-list-details"), i18n("Detailed View"), this, SLOT(detailedView()))); m_viewModeActions.insert(KoDocumentSectionView::ThumbnailMode, menu->addAction(koIcon("view-preview"), i18n("Thumbnail View"), this, SLOT(thumbnailView()))); foreach (QAction* action, m_viewModeActions) { action->setCheckable(true); action->setActionGroup(group); }
void setupUi(QDialog *MVPPlayerRemoteDialog) { if (MVPPlayerRemoteDialog->objectName().isEmpty()) MVPPlayerRemoteDialog->setObjectName(QStringLiteral("MVPPlayerRemoteDialog")); MVPPlayerRemoteDialog->resize(380, 396); MVPPlayerRemoteDialog->setAcceptDrops(true); verticalLayout_4 = new QVBoxLayout(MVPPlayerRemoteDialog); verticalLayout_4->setObjectName(QStringLiteral("verticalLayout_4")); verticalLayout_2 = new QVBoxLayout(); #ifndef Q_OS_MAC verticalLayout_2->setSpacing(-1); #endif verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2")); verticalLayout_2->setContentsMargins(-1, 0, 0, -1); verticalLayout_3 = new QVBoxLayout(); verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3")); verticalLayout_3->setSizeConstraint(QLayout::SetMinimumSize); horizontalLayout_4 = new QHBoxLayout(); horizontalLayout_4->setObjectName(QStringLiteral("horizontalLayout_4")); horizontalLayout_4->setSizeConstraint(QLayout::SetMinimumSize); sliderVolume = new QSlider(MVPPlayerRemoteDialog); sliderVolume->setObjectName(QStringLiteral("sliderVolume")); QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(sliderVolume->sizePolicy().hasHeightForWidth()); sliderVolume->setSizePolicy(sizePolicy); sliderVolume->setMinimumSize(QSize(0, 0)); sliderVolume->setMaximum(100); sliderVolume->setValue(100); sliderVolume->setOrientation(Qt::Horizontal); horizontalLayout_4->addWidget(sliderVolume); lblVol = new QLabel(MVPPlayerRemoteDialog); lblVol->setObjectName(QStringLiteral("lblVol")); QSizePolicy sizePolicy1(QSizePolicy::Maximum, QSizePolicy::Preferred); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(lblVol->sizePolicy().hasHeightForWidth()); lblVol->setSizePolicy(sizePolicy1); lblVol->setPixmap(QPixmap(QString::fromUtf8(":/mvpplayer/app/icon.png"))); lblVol->setAlignment(Qt::AlignCenter); horizontalLayout_4->addWidget(lblVol); verticalLayout_3->addLayout(horizontalLayout_4); layoutButtonsBar = new QHBoxLayout(); layoutButtonsBar->setObjectName(QStringLiteral("layoutButtonsBar")); btnServer = new QToolButton(MVPPlayerRemoteDialog); btnServer->setObjectName(QStringLiteral("btnServer")); QIcon icon; icon.addFile(QStringLiteral(":/mvpplayer/toolbar/connection.png"), QSize(), QIcon::Normal, QIcon::Off); btnServer->setIcon(icon); btnServer->setIconSize(QSize(32, 32)); btnServer->setCheckable(true); layoutButtonsBar->addWidget(btnServer); verticalLayout_3->addLayout(layoutButtonsBar); verticalLayout_2->addLayout(verticalLayout_3); line_2 = new QFrame(MVPPlayerRemoteDialog); line_2->setObjectName(QStringLiteral("line_2")); line_2->setFrameShape(QFrame::HLine); line_2->setFrameShadow(QFrame::Sunken); verticalLayout_2->addWidget(line_2); cbMute = new QCheckBox(MVPPlayerRemoteDialog); cbMute->setObjectName(QStringLiteral("cbMute")); cbMute->setChecked(true); verticalLayout_2->addWidget(cbMute); verticalLayout = new QVBoxLayout(); verticalLayout->setObjectName(QStringLiteral("verticalLayout")); verticalLayout->setSizeConstraint(QLayout::SetNoConstraint); horizontalLayout_2 = new QHBoxLayout(); horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2")); label = new QLabel(MVPPlayerRemoteDialog); label->setObjectName(QStringLiteral("label")); horizontalLayout_2->addWidget(label); lblCurrentTrack = new QLabel(MVPPlayerRemoteDialog); lblCurrentTrack->setObjectName(QStringLiteral("lblCurrentTrack")); QSizePolicy sizePolicy2(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); sizePolicy2.setHorizontalStretch(0); sizePolicy2.setVerticalStretch(0); sizePolicy2.setHeightForWidth(lblCurrentTrack->sizePolicy().hasHeightForWidth()); lblCurrentTrack->setSizePolicy(sizePolicy2); lblCurrentTrack->setWordWrap(true); horizontalLayout_2->addWidget(lblCurrentTrack); lblTrackLength = new QLabel(MVPPlayerRemoteDialog); lblTrackLength->setObjectName(QStringLiteral("lblTrackLength")); lblTrackLength->setAlignment(Qt::AlignCenter); horizontalLayout_2->addWidget(lblTrackLength); verticalLayout->addLayout(horizontalLayout_2); horizontalLayout_3 = new QHBoxLayout(); horizontalLayout_3->setObjectName(QStringLiteral("horizontalLayout_3")); sliderPosition = new QSlider(MVPPlayerRemoteDialog); sliderPosition->setObjectName(QStringLiteral("sliderPosition")); sliderPosition->setMaximum(100); sliderPosition->setOrientation(Qt::Horizontal); sliderPosition->setInvertedAppearance(false); sliderPosition->setInvertedControls(false); sliderPosition->setTickPosition(QSlider::TicksBelow); sliderPosition->setTickInterval(1); horizontalLayout_3->addWidget(sliderPosition); verticalLayout->addLayout(horizontalLayout_3); horizontalLayout_5 = new QHBoxLayout(); horizontalLayout_5->setObjectName(QStringLiteral("horizontalLayout_5")); btnClearPlaylist = new QToolButton(MVPPlayerRemoteDialog); btnClearPlaylist->setObjectName(QStringLiteral("btnClearPlaylist")); QIcon icon1; icon1.addFile(QStringLiteral(":/mvpplayer/action/cancel.png"), QSize(), QIcon::Normal, QIcon::Off); btnClearPlaylist->setIcon(icon1); horizontalLayout_5->addWidget(btnClearPlaylist); lblPlaylist = new QLabel(MVPPlayerRemoteDialog); lblPlaylist->setObjectName(QStringLiteral("lblPlaylist")); horizontalLayout_5->addWidget(lblPlaylist); verticalLayout->addLayout(horizontalLayout_5); playlist = new QListWidget(MVPPlayerRemoteDialog); playlist->setObjectName(QStringLiteral("playlist")); QSizePolicy sizePolicy3(QSizePolicy::Expanding, QSizePolicy::Maximum); sizePolicy3.setHorizontalStretch(0); sizePolicy3.setVerticalStretch(0); sizePolicy3.setHeightForWidth(playlist->sizePolicy().hasHeightForWidth()); playlist->setSizePolicy(sizePolicy3); playlist->setDragDropMode(QAbstractItemView::DropOnly); verticalLayout->addWidget(playlist); verticalLayout_2->addLayout(verticalLayout); verticalLayout_4->addLayout(verticalLayout_2); QWidget::setTabOrder(cbMute, sliderPosition); QWidget::setTabOrder(sliderPosition, playlist); retranslateUi(MVPPlayerRemoteDialog); QMetaObject::connectSlotsByName(MVPPlayerRemoteDialog); } // setupUi