void ExportThread::run() { if( m_exportMode != EXPORT_NONE ) { quint32 objectCount = 0; quint32 totalCount = m_items.size() + m_outfits.size() + m_effects.size() + m_projectiles.size() + m_sprites.size() + m_pictures.size(); QTime time; time.start(); setMinimum( 0 ); setMaximum( totalCount ); emit valueChanged( 0 ); if( m_exportMode != EXPORT_LIBRARY ) { if( m_items.size() > 0 ) { setLabel( tr( "Exporting Items..." ) ); exportItems( tr( "Items" ), m_items, objectCount, time ); } if( m_outfits.size() > 0 ) { setLabel( tr( "Exporting Outfits..." ) ); exportItems( tr( "Outfits" ), m_outfits, objectCount, time ); } if( m_effects.size() > 0 ) { setLabel( tr( "Exporting Effects..." ) ); exportItems( tr( "Effects" ), m_effects, objectCount, time ); } if( m_projectiles.size() > 0 ) { setLabel( tr( "Exporting Projectiles..." ) ); exportItems( tr( "Projectiles" ), m_projectiles, objectCount, time ); } } if( m_exportMode != EXPORT_ITEM && m_exportMode != EXPORT_LIBRARY ) { if( m_sprites.size() > 0 ) { setLabel( tr( "Exporting Sprites..." ) ); exportSprites( tr( "Sprites" ), m_sprites, objectCount, time ); } if( m_pictures.size() > 0 ) { setLabel( tr( "Exporting Pictures..." ) ); exportSprites( tr( "Pictures" ), m_pictures, objectCount, time ); } } if( !isCanceled() && objectCount > 0 ) emit success( time.elapsed() ); } }
QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle* style, QWidget* parent ) : QDialog( parent ) , mStyle( style ) , mModified( false ) { setupUi( this ); #ifdef Q_OS_MAC setWindowModality( Qt::WindowModal ); #endif QSettings settings; restoreGeometry( settings.value( QStringLiteral( "/Windows/StyleV2Manager/geometry" ) ).toByteArray() ); mSplitter->setSizes( QList<int>() << 170 << 540 ); mSplitter->restoreState( settings.value( QStringLiteral( "/Windows/StyleV2Manager/splitter" ) ).toByteArray() ); tabItemType->setDocumentMode( true ); searchBox->setPlaceholderText( tr( "Type here to filter symbols..." ) ); connect( this, SIGNAL( finished( int ) ), this, SLOT( onFinished() ) ); connect( listItems, SIGNAL( doubleClicked( const QModelIndex & ) ), this, SLOT( editItem() ) ); connect( btnAddItem, SIGNAL( clicked() ), this, SLOT( addItem() ) ); connect( actnEditItem, SIGNAL( triggered( bool ) ), this, SLOT( editItem() ) ); connect( actnRemoveItem, SIGNAL( triggered( bool ) ), this, SLOT( removeItem() ) ); btnRemoveItem->setDefaultAction( actnRemoveItem ); btnEditItem->setDefaultAction( actnEditItem ); QMenu *shareMenu = new QMenu( tr( "Share menu" ), this ); shareMenu->addAction( actnExportAsPNG ); shareMenu->addAction( actnExportAsSVG ); QAction *exportAction = new QAction( tr( "Export..." ), this ); shareMenu->addAction( exportAction ); QAction *importAction = new QAction( tr( "Import..." ), this ); shareMenu->addAction( importAction ); exportAction->setIcon( QIcon( QgsApplication::iconPath( "mActionFileSave.svg" ) ) ); importAction->setIcon( QIcon( QgsApplication::iconPath( "mActionFileOpen.svg" ) ) ); connect( actnExportAsPNG, SIGNAL( triggered() ), this, SLOT( exportItemsPNG() ) ); connect( actnExportAsSVG, SIGNAL( triggered() ), this, SLOT( exportItemsSVG() ) ); connect( exportAction, SIGNAL( triggered() ), this, SLOT( exportItems() ) ); connect( importAction, SIGNAL( triggered() ), this, SLOT( importItems() ) ); btnShare->setMenu( shareMenu ); // Set editing mode off by default mGrouppingMode = false; QStandardItemModel* model = new QStandardItemModel( listItems ); listItems->setModel( model ); listItems->setSelectionMode( QAbstractItemView::ExtendedSelection ); connect( model, SIGNAL( itemChanged( QStandardItem* ) ), this, SLOT( itemChanged( QStandardItem* ) ) ); connect( listItems->selectionModel(), SIGNAL( currentChanged( const QModelIndex&, const QModelIndex& ) ), this, SLOT( symbolSelected( const QModelIndex& ) ) ); connect( listItems->selectionModel(), SIGNAL( selectionChanged( const QItemSelection, const QItemSelection ) ), this, SLOT( selectedSymbolsChanged( const QItemSelection&, const QItemSelection& ) ) ); populateTypes(); QStandardItemModel* groupModel = new QStandardItemModel( groupTree ); groupTree->setModel( groupModel ); groupTree->setHeaderHidden( true ); populateGroups(); connect( groupTree->selectionModel(), SIGNAL( currentChanged( const QModelIndex&, const QModelIndex& ) ), this, SLOT( groupChanged( const QModelIndex& ) ) ); connect( groupModel, SIGNAL( itemChanged( QStandardItem* ) ), this, SLOT( groupRenamed( QStandardItem* ) ) ); QMenu *groupMenu = new QMenu( tr( "Group actions" ), this ); connect( actnGroupSymbols, SIGNAL( triggered() ), this, SLOT( groupSymbolsAction() ) ); groupMenu->addAction( actnGroupSymbols ); connect( actnFinishGrouping, SIGNAL( triggered() ), this, SLOT( groupSymbolsAction() ) ); actnFinishGrouping->setVisible( false ); groupMenu->addAction( actnFinishGrouping ); groupMenu->addAction( actnEditSmartGroup ); btnManageGroups->setMenu( groupMenu ); connect( searchBox, SIGNAL( textChanged( QString ) ), this, SLOT( filterSymbols( QString ) ) ); tagsLineEdit->installEventFilter( this ); // Context menu for groupTree groupTree->setContextMenuPolicy( Qt::CustomContextMenu ); connect( groupTree, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( grouptreeContextMenu( const QPoint& ) ) ); // Context menu for listItems listItems->setContextMenuPolicy( Qt::CustomContextMenu ); connect( listItems, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( listitemsContextMenu( const QPoint& ) ) ); // Menu for the "Add item" toolbutton when in colorramp mode QStringList rampTypes; rampTypes << tr( "Gradient" ) << tr( "Random" ) << tr( "ColorBrewer" ) << tr( "Preset colors" ); rampTypes << tr( "cpt-city" ); // todo, only for rasters? mMenuBtnAddItemColorRamp = new QMenu( this ); Q_FOREACH ( const QString& rampType, rampTypes ) mMenuBtnAddItemColorRamp->addAction( new QAction( rampType, this ) ); connect( mMenuBtnAddItemColorRamp, SIGNAL( triggered( QAction* ) ), this, SLOT( addColorRamp( QAction* ) ) ); // Context menu for symbols/colorramps. The menu entries for every group are created when displaying the menu. mGroupMenu = new QMenu( this ); mGroupListMenu = new QMenu( mGroupMenu ); mGroupListMenu->setTitle( tr( "Add to group" ) ); mGroupListMenu->setEnabled( false ); mGroupMenu->addMenu( mGroupListMenu ); actnUngroup->setData( 0 ); connect( actnUngroup, SIGNAL( triggered( bool ) ), this, SLOT( groupSelectedSymbols() ) ); mGroupMenu->addAction( actnUngroup ); mGroupMenu->addSeparator()->setParent( this ); mGroupMenu->addAction( actnRemoveItem ); mGroupMenu->addAction( actnEditItem ); mGroupMenu->addSeparator()->setParent( this ); mGroupMenu->addAction( actnExportAsPNG ); mGroupMenu->addAction( actnExportAsSVG ); // Context menu for the group tree mGroupTreeContextMenu = new QMenu( this ); connect( actnEditSmartGroup, SIGNAL( triggered( bool ) ), this, SLOT( editSmartgroupAction() ) ); mGroupTreeContextMenu->addAction( actnEditSmartGroup ); connect( actnAddGroup, SIGNAL( triggered( bool ) ), this, SLOT( addGroup() ) ); mGroupTreeContextMenu->addAction( actnAddGroup ); connect( actnRemoveGroup, SIGNAL( triggered( bool ) ), this, SLOT( removeGroup() ) ); mGroupTreeContextMenu->addAction( actnRemoveGroup ); on_tabItemType_currentChanged( 0 ); }
QgsStyleV2ManagerDialog::QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* parent ) : QDialog( parent ), mStyle( style ), mModified( false ) { setupUi( this ); #ifdef Q_OS_MAC setWindowModality( Qt::WindowModal ); #endif QSettings settings; restoreGeometry( settings.value( "/Windows/StyleV2Manager/geometry" ).toByteArray() ); mSplitter->setSizes( QList<int>() << 170 << 540 ); mSplitter->restoreState( settings.value( "/Windows/StyleV2Manager/splitter" ).toByteArray() ); tabItemType->setDocumentMode( true ); searchBox->setPlaceholderText( tr( "Type here to filter symbols..." ) ); connect( this, SIGNAL( finished( int ) ), this, SLOT( onFinished() ) ); connect( listItems, SIGNAL( doubleClicked( const QModelIndex & ) ), this, SLOT( editItem() ) ); connect( btnAddItem, SIGNAL( clicked() ), this, SLOT( addItem() ) ); connect( btnEditItem, SIGNAL( clicked() ), this, SLOT( editItem() ) ); connect( btnRemoveItem, SIGNAL( clicked() ), this, SLOT( removeItem() ) ); QMenu *shareMenu = new QMenu( tr( "Share Menu" ), this ); QAction *exportAsPNGAction = shareMenu->addAction( tr( "Export as PNG" ) ); QAction *exportAsSVGAction = shareMenu->addAction( tr( "Export as SVG" ) ); QAction *exportAction = shareMenu->addAction( tr( "Export" ) ); QAction *importAction = shareMenu->addAction( tr( "Import" ) ); exportAsPNGAction->setIcon( QIcon( QgsApplication::iconPath( "mActionSharingExport.svg" ) ) ); exportAsSVGAction->setIcon( QIcon( QgsApplication::iconPath( "mActionSharingExport.svg" ) ) ); exportAction->setIcon( QIcon( QgsApplication::iconPath( "mActionSharingExport.svg" ) ) ); importAction->setIcon( QIcon( QgsApplication::iconPath( "mActionSharingImport.svg" ) ) ); connect( exportAsPNGAction, SIGNAL( triggered() ), this, SLOT( exportItemsPNG() ) ); connect( exportAsSVGAction, SIGNAL( triggered() ), this, SLOT( exportItemsSVG() ) ); connect( exportAction, SIGNAL( triggered() ), this, SLOT( exportItems() ) ); connect( importAction, SIGNAL( triggered() ), this, SLOT( importItems() ) ); btnShare->setMenu( shareMenu ); // Set editing mode off by default mGrouppingMode = false; QStandardItemModel* model = new QStandardItemModel( listItems ); listItems->setModel( model ); listItems->setSelectionMode( QAbstractItemView::ExtendedSelection ); connect( model, SIGNAL( itemChanged( QStandardItem* ) ), this, SLOT( itemChanged( QStandardItem* ) ) ); connect( listItems->selectionModel(), SIGNAL( currentChanged( const QModelIndex&, const QModelIndex& ) ), this, SLOT( symbolSelected( const QModelIndex& ) ) ); populateTypes(); QStandardItemModel* groupModel = new QStandardItemModel( groupTree ); groupTree->setModel( groupModel ); groupTree->setHeaderHidden( true ); populateGroups(); connect( groupTree->selectionModel(), SIGNAL( currentChanged( const QModelIndex&, const QModelIndex& ) ), this, SLOT( groupChanged( const QModelIndex& ) ) ); connect( groupModel, SIGNAL( itemChanged( QStandardItem* ) ), this, SLOT( groupRenamed( QStandardItem* ) ) ); QMenu *groupMenu = new QMenu( tr( "Group Actions" ), this ); QAction *groupSymbols = groupMenu->addAction( tr( "Group Symbols" ) ); QAction *editSmartgroup = groupMenu->addAction( tr( "Edit Smart Group" ) ); btnManageGroups->setMenu( groupMenu ); connect( groupSymbols, SIGNAL( triggered() ), this, SLOT( groupSymbolsAction() ) ); connect( editSmartgroup, SIGNAL( triggered() ), this, SLOT( editSmartgroupAction() ) ); connect( btnAddGroup, SIGNAL( clicked() ), this, SLOT( addGroup() ) ); connect( btnRemoveGroup, SIGNAL( clicked() ), this, SLOT( removeGroup() ) ); on_tabItemType_currentChanged( 0 ); connect( searchBox, SIGNAL( textChanged( QString ) ), this, SLOT( filterSymbols( QString ) ) ); tagsLineEdit->installEventFilter( this ); // Context menu for groupTree groupTree->setContextMenuPolicy( Qt::CustomContextMenu ); connect( groupTree, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( grouptreeContextMenu( const QPoint& ) ) ); // Context menu for listItems listItems->setContextMenuPolicy( Qt::CustomContextMenu ); connect( listItems, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( listitemsContextMenu( const QPoint& ) ) ); }