OverwriteDialog::OverwriteDialog()
	: Dialog(TApp::instance()->getMainWindow(), true)
{
	setModal(true);
	setWindowTitle(tr("Warning!"));

	QButtonGroup *buttonGroup = new QButtonGroup(this);
	buttonGroup->setExclusive(true);
	bool ret = connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(onButtonClicked(int)));

	beginVLayout();

	m_label = new QLabel(this);
	addWidget(m_label);

	m_keep = new QRadioButton(tr("Keep existing file"), this);
	buttonGroup->addButton(m_keep);
	addWidget(m_keep);

	m_overwrite = new QRadioButton(tr("Overwrite the existing file with the new one"), this);
	buttonGroup->addButton(m_overwrite);
	addWidget(m_overwrite);

	m_rename = new QRadioButton(tr("Rename the new file adding the suffix"), this);
	buttonGroup->addButton(m_rename);

	m_suffix = new LineEdit("_1", this);
	m_suffix->setFixedWidth(25);
	m_suffix->setEnabled(false);

	QHBoxLayout *boxLayout = new QHBoxLayout();
	boxLayout->setMargin(0);
	boxLayout->setSpacing(0);
	boxLayout->addWidget(m_rename);
	boxLayout->addWidget(m_suffix);
	boxLayout->setAlignment(m_rename, Qt::AlignLeft);
	boxLayout->setAlignment(m_suffix, Qt::AlignLeft);
	addLayout(boxLayout);

	endVLayout();

	m_okBtn = new QPushButton(QString(tr("Apply")), this);
	ret = ret && connect(m_okBtn, SIGNAL(clicked()), this, SLOT(accept()));
	addButtonBarWidget(m_okBtn);

	m_okToAllBtn = new QPushButton(QString(tr("Apply to All")), this);
	ret = ret && connect(m_okToAllBtn, SIGNAL(clicked()), this, SLOT(applyToAll()));
	addButtonBarWidget(m_okToAllBtn);

	m_cancelBtn = new QPushButton(QString(tr("Cancel")), this);
	ret = ret && connect(m_cancelBtn, SIGNAL(clicked()), this, SLOT(cancel()));
	addButtonBarWidget(m_cancelBtn);

	assert(ret);

	reset();
	m_keep->setChecked(true);
}
Esempio n. 2
0
TimeStretchPopup::TimeStretchPopup()
    : Dialog(TApp::instance()->getMainWindow(), true, true, "TimeStretch")
    , m_currentStretchType(eRegion) {
  setModal(false);
  setWindowTitle(tr("Time Stretch"));

  beginVLayout();

  m_stretchType = new QComboBox(this);
  m_stretchType->setFixedHeight(DVGui::WidgetHeight);
  QStringList viewType;
  viewType << tr("Selected Cells") << tr("Selected Frame Range")
           << tr("Whole Xsheet");
  m_stretchType->addItems(viewType);
  connect(m_stretchType, SIGNAL(currentIndexChanged(int)),
          SLOT(setCurrentStretchType(int)));
  addWidget(tr("Stretch:"), m_stretchType);

  QHBoxLayout *rangeLayout = new QHBoxLayout(this);
  m_oldRange               = new QLabel("0", this);
  m_oldRange->setFixedSize(43, DVGui::WidgetHeight);
  rangeLayout->addWidget(m_oldRange);
  rangeLayout->addSpacing(10);
  m_newRangeFld = new DVGui::IntLineEdit(this);
  rangeLayout->addWidget(new QLabel(tr("New Range:")), 1, Qt::AlignRight);
  rangeLayout->addWidget(m_newRangeFld, 0, Qt::AlignRight);
  addLayout(tr("Old Range:"), rangeLayout);

  endVLayout();

  m_okBtn = new QPushButton(tr("Stretch"), this);
  m_okBtn->setDefault(true);
  m_cancelBtn = new QPushButton(tr("Cancel"), this);
  bool ret    = connect(m_okBtn, SIGNAL(clicked()), this, SLOT(stretch()));
  ret = ret && connect(m_cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
  assert(ret);

  addButtonBarWidget(m_okBtn, m_cancelBtn);
}
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);
}
AntialiasPopup::AntialiasPopup()
	: Dialog(TApp::instance()->getMainWindow(), true, false, "Antialias"), m_startRas(0)
{
	setWindowTitle(tr("Apply Antialias"));
	setLabelWidth(0);
	setModal(false);

	setTopMargin(0);
	setTopSpacing(0);

	beginVLayout();

	QSplitter *splitter = new QSplitter(Qt::Vertical);
	splitter->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	addWidget(splitter);

	endVLayout();

	//------------------------- Top Layout --------------------------

	QScrollArea *scrollArea = new QScrollArea(splitter);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setWidgetResizable(true);
	splitter->addWidget(scrollArea);
	splitter->setStretchFactor(0, 1);

	QFrame *topWidget = new QFrame(scrollArea);
	topWidget->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	scrollArea->setWidget(topWidget);

	QGridLayout *topLayout = new QGridLayout(this);
	topWidget->setLayout(topLayout);

	//------------------------- Parameters --------------------------

	//Brightness
	QLabel *brightnessLabel = new QLabel(tr("Threshold:"));
	topLayout->addWidget(brightnessLabel, 0, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_thresholdField = new DVGui::IntField(topWidget);
	m_thresholdField->setRange(0, 255);
	m_thresholdField->setValue(40);
	topLayout->addWidget(m_thresholdField, 0, 1);

	//Contrast
	QLabel *contrastLabel = new QLabel(tr("Softness:"));
	topLayout->addWidget(contrastLabel, 1, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_softnessField = new DVGui::IntField(topWidget);
	m_softnessField->setRange(0, 100);
	m_softnessField->setValue(70);
	topLayout->addWidget(m_softnessField, 1, 1);

	topLayout->setRowStretch(2, 1);

	//--------------------------- Swatch ----------------------------

	m_viewer = new Swatch(splitter);
	m_viewer->setMinimumHeight(150);
	m_viewer->setFocusPolicy(Qt::WheelFocus);
	splitter->addWidget(m_viewer);

	//--------------------------- Button ----------------------------

	m_okBtn = new QPushButton(QString(tr("Apply")), this);
	connect(m_okBtn, SIGNAL(clicked()), this, SLOT(apply()));

	addButtonBarWidget(m_okBtn);

	//------------------------ Connections --------------------------

	TApp *app = TApp::instance();

	bool ret = true;

	ret = ret && connect(m_thresholdField, SIGNAL(valueChanged(bool)), this, SLOT(onValuesChanged(bool)));
	ret = ret && connect(m_softnessField, SIGNAL(valueChanged(bool)), this, SLOT(onValuesChanged(bool)));

	assert(ret);

	m_viewer->resize(0, 350);
	resize(600, 500);
}
Esempio n. 5
0
MeshifyPopup::MeshifyPopup()
	: DVGui::Dialog(TApp::instance()->getMainWindow(), true, false, "MeshifyPopup"), m_r(-1), m_c(-1)
{
	setWindowTitle(tr("Create Mesh"));
	setLabelWidth(0);
	setModal(false);

	setTopMargin(0);
	setTopSpacing(0);

	beginVLayout();

	QSplitter *splitter = new QSplitter(Qt::Vertical);
	splitter->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	addWidget(splitter);

	endVLayout();

	//------------------------- Top Layout --------------------------

	QScrollArea *scrollArea = new QScrollArea(splitter);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setWidgetResizable(true);
	scrollArea->setMinimumWidth(450);
	splitter->addWidget(scrollArea);
	splitter->setStretchFactor(0, 1);

	QFrame *topWidget = new QFrame(scrollArea);
	scrollArea->setWidget(topWidget);

	QGridLayout *topLayout = new QGridLayout(topWidget); // Needed to justify at top
	topWidget->setLayout(topLayout);

	//------------------------- Parameters --------------------------

	int row = 0;

	QLabel *edgesLengthLabel = new QLabel(tr("Mesh Edges Length:"));
	topLayout->addWidget(edgesLengthLabel, row, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_edgesLength = new DVGui::MeasuredDoubleField;
	m_edgesLength->setMeasure("length.x");
	m_edgesLength->setRange(0.0, 1.0); // In inches (standard unit)
	m_edgesLength->setValue(0.2);

	topLayout->addWidget(m_edgesLength, row++, 1);

	QLabel *rasterizationDpiLabel = new QLabel(tr("Rasterization DPI:"));
	topLayout->addWidget(rasterizationDpiLabel, row, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_rasterizationDpi = new DVGui::DoubleLineEdit;
	m_rasterizationDpi->setRange(1.0, (std::numeric_limits<double>::max)());
	m_rasterizationDpi->setValue(300.0);

	topLayout->addWidget(m_rasterizationDpi, row++, 1);

	QLabel *shapeMarginLabel = new QLabel(tr("Mesh Margin (pixels):"));
	topLayout->addWidget(shapeMarginLabel, row, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_margin = new DVGui::IntLineEdit;
	m_margin->setRange(2, (std::numeric_limits<int>::max)());
	m_margin->setValue(5);

	topLayout->addWidget(m_margin, row++, 1);

	connect(m_edgesLength, SIGNAL(valueChanged(bool)), this, SLOT(onParamsChanged(bool)));
	connect(m_rasterizationDpi, SIGNAL(editingFinished()), this, SLOT(onParamsChanged()));
	connect(m_margin, SIGNAL(editingFinished()), this, SLOT(onParamsChanged()));

	topLayout->setRowStretch(row, 1);

	//------------------------- View Widget -------------------------

	// NOTE: It's IMPORTANT that parent widget is supplied. It's somewhat
	// used by QSplitter to decide the initial widget sizes...

	m_viewer = new Swatch(splitter);
	m_viewer->setMinimumHeight(150);
	m_viewer->setFocusPolicy(Qt::WheelFocus);

	splitter->addWidget(m_viewer);

	//--------------------------- Buttons ---------------------------

	m_okBtn = new QPushButton(tr("Apply"));
	addButtonBarWidget(m_okBtn);

	connect(m_okBtn, SIGNAL(clicked()), this, SLOT(apply()));

	// Finally, acquire current selection
	onCellSwitched();

	m_viewer->resize(0, 350);
	resize(600, 700);
}
AdjustLevelsPopup::AdjustLevelsPopup()
	: DVGui::Dialog(TApp::instance()->getMainWindow(), true, false, "AdjustLevels"), m_thresholdD(0.005) //0.5% of the image size
{
	int i, j;

	setWindowTitle(tr("Adjust Levels"));
	setLabelWidth(0);
	setModal(false);

	setTopMargin(0);
	setTopSpacing(0);

	beginVLayout();

	QSplitter *splitter = new QSplitter(Qt::Vertical);
	splitter->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	addWidget(splitter);

	endVLayout();

	//------------------------- Top Layout --------------------------

	QScrollArea *scrollArea = new QScrollArea(splitter);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setWidgetResizable(true);
	scrollArea->setMinimumWidth(450);
	splitter->addWidget(scrollArea);
	splitter->setStretchFactor(0, 1);

	QFrame *topWidget = new QFrame(scrollArea);
	scrollArea->setWidget(topWidget);

	QVBoxLayout *topVLayout = new QVBoxLayout(topWidget); //Needed to justify at top
	topWidget->setLayout(topVLayout);

	QHBoxLayout *topLayout = new QHBoxLayout(topWidget);
	topVLayout->addLayout(topLayout);
	topVLayout->addStretch(1);

	//------------------------- Histogram ---------------------------

	m_histogram = new Histogram(topWidget);
	topLayout->addWidget(m_histogram);

	//------------------------- Mark Bars ---------------------------

	MarksBar *histogramMarksBar, *colorBarMarksBar;
	QVBoxLayout *histogramViewLayout;

	for (i = 0; i < 5; ++i) {
		HistogramView *view = m_histogram->getHistograms()->getHistogramView(i);
		histogramViewLayout = static_cast<QVBoxLayout *>(view->layout());

		//Don't draw channel numbers
		view->channelBar()->setDrawNumbers(false);

		for (j = 0; j < 2; ++j) {
			EditableMarksBar *editableMarksBar = m_marksBar[j + (i << 1)] = new EditableMarksBar;
			MarksBar *marksBar = editableMarksBar->marksBar();

			//Set margins up to cover the histogram
			editableMarksBar->layout()->setContentsMargins(6, 0, 5, 0);
			connect(editableMarksBar, SIGNAL(paramsChanged()), this, SLOT(onParamsChanged()));

			histogramViewLayout->insertWidget(1 + (j << 1), editableMarksBar);
		}
	}

	//------------------------- View Widget -------------------------

	//NOTE: It's IMPORTANT that parent widget is supplied. It's somewhat
	//used by QSplitter to decide the initial widget sizes...

	m_viewer = new Swatch(splitter);
	m_viewer->setMinimumHeight(150);
	m_viewer->setFocusPolicy(Qt::WheelFocus);
	splitter->addWidget(m_viewer);

	//--------------------------- Buttons ---------------------------

	QVBoxLayout *buttonsLayout = new QVBoxLayout(topWidget);
	topLayout->addLayout(buttonsLayout);

	buttonsLayout->addSpacing(50);

	QPushButton *clampRange = new QPushButton(tr("Clamp"), topWidget);
	clampRange->setMinimumSize(65, 25);
	buttonsLayout->addWidget(clampRange);
	connect(clampRange, SIGNAL(clicked(bool)), this, SLOT(clampRange()));

	QPushButton *autoAdjust = new QPushButton(tr("Auto"), topWidget);
	autoAdjust->setMinimumSize(65, 25);
	buttonsLayout->addWidget(autoAdjust);
	connect(autoAdjust, SIGNAL(clicked(bool)), this, SLOT(autoAdjust()));

	QPushButton *resetBtn = new QPushButton(tr("Reset"), topWidget);
	resetBtn->setMinimumSize(65, 25);
	buttonsLayout->addWidget(resetBtn);
	connect(resetBtn, SIGNAL(clicked(bool)), this, SLOT(reset()));

	buttonsLayout->addStretch(1);

	m_okBtn = new QPushButton(tr("Apply"));
	addButtonBarWidget(m_okBtn);

	connect(m_okBtn, SIGNAL(clicked()), this, SLOT(apply()));

	//Finally, acquire current selection
	acquireRaster();

	m_viewer->resize(0, 350);
	resize(600, 700);
}
Esempio n. 7
0
BinarizePopup::BinarizePopup()
	: Dialog(TApp::instance()->getMainWindow(), true, false, "Binarize"), m_frameIndex(-1), m_progressBar(0), m_timerId(0)
{
	setWindowTitle(tr("Binarize"));
	setLabelWidth(0);
	setModal(false);

	setTopMargin(0);
	setTopSpacing(0);

	beginVLayout();

	QSplitter *splitter = new QSplitter(Qt::Vertical);
	splitter->setSizePolicy(
		QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	addWidget(splitter);

	endVLayout();

	QWidget *parametersArea = new QFrame();
	splitter->addWidget(parametersArea);

	QGridLayout *parametersLayout = new QGridLayout();

	// parametersArea->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));

	//QFrame* topWidget = new QFrame(scrollArea);
	//topWidget->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
	//scrollArea->setWidget(topWidget);

	// parametersLayout->setSizeConstraint(QLayout::SetFixedSize);

	//------------------------- Parameters --------------------------

	/*
  //Brightness
	QLabel* brightnessLabel = new QLabel(tr("Brightness:"));
	topLayout->addWidget(brightnessLabel, 0, 0, Qt::AlignRight | Qt::AlignVCenter);

  m_brightnessField = new DVGui::IntField(topWidget);
  m_brightnessField->setRange(-127, 127);
  m_brightnessField->setValue(0);
	topLayout->addWidget(m_brightnessField, 0, 1);

  //Contrast
	QLabel* contrastLabel = new QLabel(tr("Contrast:"));
	topLayout->addWidget(contrastLabel, 1, 0, Qt::AlignRight | Qt::AlignVCenter);

  m_contrastField = new DVGui::IntField(topWidget);
  m_contrastField->setRange(-127, 127);
  m_contrastField->setValue(0);
	topLayout->addWidget(m_contrastField, 1, 1);
*/

	m_alphaChk = new DVGui::CheckBox(tr("Alpha"));
	m_previewChk = new DVGui::CheckBox(tr("Preview"));
	parametersLayout->addWidget(m_alphaChk, 0, 0);
	parametersLayout->addWidget(m_previewChk, 0, 1);

	parametersArea->setLayout(parametersLayout);

	//--------------------------- Swatch ----------------------------

	m_viewer = new Swatch();
	m_viewer->setMinimumHeight(150);
	m_viewer->setFocusPolicy(Qt::WheelFocus);
	splitter->addWidget(m_viewer);

	splitter->setStretchFactor(0, 0);
	splitter->setStretchFactor(1, 1);

	//--------------------------- Button ----------------------------

	m_okBtn = new QPushButton(tr("Apply"), this);
	connect(m_okBtn, SIGNAL(clicked()), this, SLOT(apply()));

	addButtonBarWidget(m_okBtn);

	//------------------------ Connections --------------------------

	bool ret = true;

	//ret = ret && connect(m_brightnessField, SIGNAL(valueChanged(bool)), this, SLOT(onValuesChanged(bool)));
	//ret = ret && connect(m_contrastField,   SIGNAL(valueChanged(bool)), this, SLOT(onValuesChanged(bool)));
	ret = ret && connect(m_previewChk, SIGNAL(stateChanged(int)), this, SLOT(onPreviewCheckboxChanged(int)));

	ret = ret && connect(m_alphaChk, SIGNAL(stateChanged(int)), this, SLOT(onAlphaCheckboxChanged(int)));

	assert(ret);

	m_viewer->resize(0, 350);
	resize(600, 500);
}