コード例 #1
0
ファイル: DccDialog.cpp プロジェクト: CardinalSins/KVIrc
void DccRenameDialog::renameClicked()
{
	hide();
	emit renameSelected(this, m_pDescriptor);
	//g_pApp->collectGarbage(this);
	this->deleteLater();
}
コード例 #2
0
LayerList::LayerList(QWidget *parent)
	: QDockWidget(tr("Layers"), parent), _client(0), _selected(0), _noupdate(false), _op(false), _lockctrl(false)
{
	_ui = new Ui_LayerBox;
	QWidget *w = new QWidget(this);
	setWidget(w);
	_ui->setupUi(w);

	_ui->layerlist->setDragEnabled(true);
	_ui->layerlist->viewport()->setAcceptDrops(true);
	_ui->layerlist->setEnabled(false);
	_ui->layerlist->setSelectionMode(QAbstractItemView::SingleSelection);

	// Populate blend mode combobox
	for(int b=0;b<paintcore::BLEND_MODES;++b) {
		if(paintcore::BLEND_MODE[b].layermode)
			_ui->blendmode->addItem(
				QApplication::translate("paintcore", paintcore::BLEND_MODE[b].name),
				paintcore::BLEND_MODE[b].id
			);
	}

	// Layer menu
	_layermenu = new QMenu(this);
	_menuHideAction = _layermenu->addAction(tr("Hide from self"), this, SLOT(hideSelected()));
	_menuHideAction->setCheckable(true);
	_menuRenameAction = _layermenu->addAction(tr("Rename"), this, SLOT(renameSelected()));
	_menuMergeAction = _layermenu->addAction(tr("Merge down"), this, SLOT(mergeSelected()));
	_menuDeleteAction = _layermenu->addAction(tr("Delete"), this, SLOT(deleteSelected()));

	// Layer ACL menu
	_aclmenu = new LayerAclMenu(this);
	_ui->lockButton->setMenu(_aclmenu);

	connect(_ui->layerlist, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(layerContextMenu(QPoint)));

	connect(_ui->addButton, SIGNAL(clicked()), this, SLOT(addLayer()));
	connect(_ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteOrMergeSelected()));
	connect(_ui->opacity, SIGNAL(valueChanged(int)), this, SLOT(opacityAdjusted()));
	connect(_ui->blendmode, SIGNAL(currentIndexChanged(int)), this, SLOT(blendModeChanged()));
	connect(_aclmenu, SIGNAL(layerAclChange(bool, QList<uint8_t>)), this, SLOT(changeLayerAcl(bool, QList<uint8_t>)));

	selectionChanged(QItemSelection());

	// The opacity update timer is used to limit the rate of layer
	// update messages sent over the network when the user drags or scrolls
	// on the opacity slider.
	_opacityUpdateTimer = new QTimer(this);
	_opacityUpdateTimer->setSingleShot(true);
	connect(_opacityUpdateTimer, SIGNAL(timeout()), this, SLOT(sendOpacityUpdate()));
}
コード例 #3
0
/**
 * Constructs the window.
 */
LibraryWindow::LibraryWindow(Place p, QWidget* parent, const char* name,
                             WFlags f)
    : QDockWindow(p, parent, name, f)
{
    modified_ = false;

    setCloseMode(Never);
    setMovingEnabled(TRUE);
    setResizeEnabled(TRUE);

    splitter_ = new QSplitter(Qt::Vertical, this);
    setWidget(splitter_);

    modelListView_ = new LibraryListView(splitter_);
    modelListView_->addColumn(tr("Module"));
    modelListView_->setDefaultRenameAction(QListView::Accept);

    descriptionTextBrowser_ = new QTextBrowser(splitter_);
    QPalette palette = QApplication::palette();
    descriptionTextBrowser_->setFrameStyle(QFrame::NoFrame);
    descriptionTextBrowser_->setPaper
            (palette.brush(QPalette::Normal, QColorGroup::Background));

    popupMenu_ = new QPopupMenu();
    popupMenu_->insertItem(tr("Rename"), this, SLOT(renameSelected()));
    popupMenu_->insertItem(tr("Change Type"),
                           this, SLOT(changeTypeOfSelected()));
    popupMenu_->insertSeparator();
    popupMenu_->insertItem(QPixmap(Util::findIcon("editdelete.png")),
                           tr("Remove"), this, SLOT(removeSelected()));

    connect(modelListView_, SIGNAL(selectionChanged(QListViewItem *)),
            this, SLOT(setDescription(QListViewItem *)));
    connect(this, SIGNAL(orientationChanged(Orientation)),
            this, SLOT(setOrientation(Orientation)));
    connect(modelListView_,
            SIGNAL(contextMenuRequested(QListViewItem *, const QPoint &, int)),
            this, SLOT(showPopup(QListViewItem *, const QPoint &, int)));
    connect(modelListView_, SIGNAL(selectionChanged(QListViewItem *)),
            this, SLOT(selectionChanged(QListViewItem *)));

    // load items
    initialize();
}