Пример #1
0
AS_NAMESPACE_START

EditorTabs::EditorTabs(QWidget *parent)
    : QTabWidget(parent), _finder(nullptr)
{
    _connections << connect(parent, SIGNAL(editCopy()), this, SLOT(onEditCopy()));
    _connections << connect(parent, SIGNAL(editCut()), this, SLOT(onEditCut()));
    _connections << connect(parent, SIGNAL(editFind()), this, SLOT(onEditFind()));
    _connections << connect(parent, SIGNAL(editGoto()), this, SLOT(onEditGoto()));
    _connections << connect(parent, SIGNAL(editPaste()), this, SLOT(onEditPaste()));
    _connections << connect(parent, SIGNAL(editRedo()), this, SLOT(onEditRedo()));
    _connections << connect(parent, SIGNAL(editReplace()), this, SLOT(onEditReplace()));
    _connections << connect(parent, SIGNAL(editUndo()), this, SLOT(onEditUndo()));
    _connections << connect(parent, SIGNAL(fileClose()), this, SLOT(onFileClose()));
    _connections << connect(parent, SIGNAL(fileCloseAll()), this, SLOT(onFileCloseAll()));
    _connections << connect(parent, SIGNAL(fileOpen(QString)), this, SLOT(onFileOpen(QString)));
    _connections << connect(parent, SIGNAL(fileSave()), this, SLOT(onFileSave()));
    _connections << connect(parent, SIGNAL(fileSaveAll()), this, SLOT(onFileSaveAll()));
    _connections << connect(this, &QTabWidget::tabCloseRequested, this, &EditorTabs::onTabCloseRequested);
    _connections << connect(tabBar(), &QTabBar::tabMoved, this, &EditorTabs::onTabMoved);
    _connections << connect(this, &EditorTabs::currentChanged, this, &EditorTabs::onCurrentChanged);
    _connections << connect(this, SIGNAL(fileChanged(QString)), parent, SLOT(onFileChanged(QString)));
    _connections << connect(this, SIGNAL(fileSaved(QString)), parent, SLOT(onFileSaved(QString)));
    setMovable(true);
    setTabsClosable(true);
}
Пример #2
0
void MyFracWindow::createActions()
{
	KAction* actionSave = KStdAction::save(this, SLOT(onFileSave()), actionCollection());
	actionSave->setText(i18n("&Save Image..."));
	KStdAction::quit(kapp, SLOT(quit()), actionCollection());

	KStdAction::copy(this, SLOT(onEditCopy()), actionCollection());
	new KAction(i18n("&Edit Gradient..."), "frgradedit", CTRL+Key_E,
		this, SLOT(onGradientEdit()), actionCollection(), "grad_edit");
	new KAction(i18n("&Invert Gradient"), "frgradinv", CTRL+Key_X,
		this, SLOT(onGradientInvert()), actionCollection(), "grad_inv");

	_actionMandelbrot = KStdAction::up(this, SLOT(setMandelbrotMode()), actionCollection());
	_actionMandelbrot->setText(i18n("&To Mandelbrot"));
	KStdAction::home(this, SLOT(onDefaultView()), actionCollection());
	_actionBack = KStdAction::back(this, SLOT(onViewBack()), actionCollection());
	_actionForward = KStdAction::forward(this, SLOT(onViewForward()), actionCollection());

	createStandardStatusBarAction();
	setStandardToolBarMenuEnabled(true);

	_actionParams = new KToggleAction(i18n("Show Parameters"), SmallIconSet("frparams"), 0,
		_dockParams, SLOT(changeHideShowState()), actionCollection(), "show_params");
	_actionDisplay = new KToggleAction(i18n("Show Display"), SmallIconSet("frdisplay"), 0,
		_dockDisplay, SLOT(changeHideShowState()), actionCollection(), "show_display");
	_actionPreview = new KToggleAction(i18n("Show Preview"), SmallIconSet("viewmag"), 0,
		_dockPreview, SLOT(changeHideShowState()), actionCollection(), "show_preview");
#if KDE_IS_VERSION(3,2,90)
	_actionParams->setCheckedState(i18n("Hide Parameters"));
	_actionDisplay->setCheckedState(i18n("Hide Display"));
	_actionPreview->setCheckedState(i18n("Hide Preview"));
#endif
	KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection());
	KStdAction::configureToolbars(this, SLOT(configureToolbars()), actionCollection());

	connect(dockManager, SIGNAL(change()), this, SLOT(updateShowActions()));
	updateShowActions();
}