MagpieFileImportPopup::MagpieFileImportPopup()
	: Dialog(TApp::instance()->getMainWindow(), true, true, "MagPieFileImport"), m_levelField(0), m_fromField(0), m_toField(0), m_flipbook(0), m_levelPath()
{
	setWindowTitle(tr("Import Magpie File"));

	beginVLayout();

	setLabelWidth(45);

	addSeparator(tr("Frame Range"));

	QWidget *fromToWidget = new QWidget(this);
	fromToWidget->setFixedHeight(DVGui::WidgetHeight);
	fromToWidget->setFixedSize(210, DVGui::WidgetHeight);
	QHBoxLayout *fromToLayout = new QHBoxLayout(fromToWidget);
	fromToLayout->setMargin(0);
	fromToLayout->setSpacing(0);
	m_fromField = new DVGui::IntLineEdit(fromToWidget, 1, 1, 1);
	fromToLayout->addWidget(m_fromField, 0, Qt::AlignLeft);
	m_toField = new DVGui::IntLineEdit(fromToWidget, 1, 1, 1);
	QLabel *toLabel = new QLabel(tr("To:"));
	toLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
	toLabel->setFixedSize(20, m_toField->height());
	fromToLayout->addWidget(toLabel, 0, Qt::AlignRight);
	fromToLayout->addWidget(m_toField, 0, Qt::AlignLeft);
	fromToWidget->setLayout(fromToLayout);
	addWidget(tr("From:"), fromToWidget);

	addSeparator(tr("Animation Level"));

	m_levelField = new DVGui::FileField(this);
	m_levelField->setFileMode(QFileDialog::AnyFile);
	m_levelField->setFixedWidth(200);
	bool ret = connect(m_levelField, SIGNAL(pathChanged()), SLOT(onLevelPathChanged()));

	addWidget(tr("Level:"), m_levelField);

	QLabel *frameLabel = new QLabel(" Frame", this);
	frameLabel->setFixedHeight(DVGui::WidgetHeight);
	addWidget(tr("Phoneme"), frameLabel);
	int i;
	for (i = 0; i < 9; i++) {
		IntLineEdit *field = new IntLineEdit(this, 1, 1);
		QLabel *label = new QLabel("", this);
		label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
		label->setFixedSize(getLabelWidth(), field->height());
		m_actFields.append(QPair<QLabel *, IntLineEdit *>(label, field));
		addWidgets(label, field);
	}

	endVLayout();

	QFrame *frame = new QFrame(this);
	frame->setFrameStyle(QFrame::StyledPanel);
	frame->setObjectName("LipSynkViewer");
	frame->setStyleSheet("#LipSynkViewer { border: 1px solid rgb(150,150,150); }");
	QVBoxLayout *frameLayout = new QVBoxLayout(frame);
	frameLayout->setMargin(0);
	frameLayout->setSpacing(0);
	UINT buttonMask = FlipConsole::cFullConsole & (~(FlipConsole::eRate | FlipConsole::eSound | FlipConsole::eSaveImg | FlipConsole::eHisto | FlipConsole::eCompare | FlipConsole::eCustomize | FlipConsole::eSave | FlipConsole::eBegin | FlipConsole::eEnd | FlipConsole::eFirst | FlipConsole::eNext | FlipConsole::ePause | FlipConsole::ePlay | FlipConsole::ePrev | FlipConsole::eRate | FlipConsole::eWhiteBg | FlipConsole::eCheckBg | FlipConsole::eBlackBg | FlipConsole::eNext | FlipConsole::eLast | FlipConsole::eLoop | FlipConsole::eGRed | FlipConsole::eGGreen | FlipConsole::eGBlue | FlipConsole::eRed | FlipConsole::eGreen | FlipConsole::eBlue | FlipConsole::eMatte | FlipConsole::eDefineSubCamera | FlipConsole::eDefineLoadBox | FlipConsole::eUseLoadBox | FlipConsole::eFilledRaster));
	m_flipbook = new FlipBook(this, tr("Import Magpie File"), buttonMask);
	m_flipbook->setFixedHeight(250);
	frameLayout->addWidget(m_flipbook);
	frame->setLayout(frameLayout);
	addWidget(frame);

	QPushButton *okBtn = new QPushButton(tr("Import"), this);
	okBtn->setDefault(true);
	QPushButton *cancelBtn = new QPushButton(tr("Cancel"), this);
	ret = ret && connect(okBtn, SIGNAL(clicked()), this, SLOT(onOkPressed()));
	ret = ret && connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
	assert(ret);

	addButtonBarWidget(okBtn, cancelBtn);
}
Beispiel #2
0
MenuBarPopup::MenuBarPopup(Room* room)
	: Dialog(TApp::instance()->getMainWindow(), true, false, "CustomizeMenuBar")
{
	setWindowTitle(tr("Customize Menu Bar of Room \"%1\"").arg(room->getName()));
	
	/*- get menubar setting file path -*/
	std::string mbFileName = room->getPath().getName() + "_menubar.xml";
	TFilePath mbPath = ToonzFolder::getMyModuleDir() + mbFileName;
	
	m_commandListTree = new CommandListTree(this);
	m_menuBarTree = new MenuBarTree(mbPath, this);

	QPushButton *okBtn = new QPushButton(tr("OK"), this);
	QPushButton *cancelBtn = new QPushButton(tr("Cancel"), this);

	okBtn->setFocusPolicy(Qt::NoFocus);
	cancelBtn->setFocusPolicy(Qt::NoFocus);

	QLabel* menuBarLabel = new QLabel(tr("%1 Menu Bar").arg(room->getName()), this);
	QLabel* menuItemListLabel = new QLabel(tr("Menu Items"), this);
		
	QFont f("Arial", 15, QFont::Bold);
	menuBarLabel->setFont(f);
	menuItemListLabel->setFont(f);

	QLabel* noticeLabel = new QLabel(tr("N.B. If you put unique title to submenu, it may not be translated to another language.\nN.B. Duplicated commands will be ignored. Only the last one will appear in the menu bar."),this);
	QFont nf("Arial", 9, QFont::Normal);
	nf.setItalic(true);
	noticeLabel->setFont(nf);

	//--- layout
	QVBoxLayout* mainLay = new QVBoxLayout();
	m_topLayout->setMargin(0);
	m_topLayout->setSpacing(0);
	{
		QGridLayout* mainUILay = new QGridLayout();
		mainUILay->setMargin(5);
		mainUILay->setHorizontalSpacing(8);
		mainUILay->setVerticalSpacing(5);
		{
			mainUILay->addWidget(menuBarLabel, 0, 0);
			mainUILay->addWidget(menuItemListLabel, 0, 1);
			mainUILay->addWidget(m_menuBarTree, 1, 0);
			mainUILay->addWidget(m_commandListTree, 1, 1);

			mainUILay->addWidget(noticeLabel, 2, 0, 1, 2);
		}
		mainUILay->setRowStretch(0, 0);
		mainUILay->setRowStretch(1, 1);
		mainUILay->setRowStretch(2, 0);
		mainUILay->setColumnStretch(0, 1);
		mainUILay->setColumnStretch(1, 1);

		m_topLayout->addLayout(mainUILay, 1);
	}
		
	m_buttonLayout->setMargin(0);
	m_buttonLayout->setSpacing(30);
	{
		m_buttonLayout->addStretch(1);
		m_buttonLayout->addWidget(okBtn, 0);
		m_buttonLayout->addWidget(cancelBtn, 0);
		m_buttonLayout->addStretch(1);
	}

	//--- signal/slot connections

	bool ret = connect(okBtn, SIGNAL(clicked()), this, SLOT(onOkPressed()));
	ret = ret && connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
	assert(ret);
}