示例#1
0
void BitcoinGUI::createToolBars()
{
    QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
    toolbar->setObjectName("toolbar");
    addToolBar(Qt::LeftToolBarArea,toolbar);
    toolbar->setOrientation(Qt::Vertical);
    toolbar->setFixedWidth(205);
    toolbar->setMovable( false );
    toolbar->setToolButtonStyle(Qt::ToolButtonTextOnly);

    QLabel* header = new QLabel();
    header->setMinimumSize(156,156);
    header->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    header->setPixmap(QPixmap(":/images/header"));
    header->setMaximumSize(156,156);
    header->setContentsMargins(26,26,0,0);
    header->setScaledContents(true);
    toolbar->addWidget(header);

	QLabel *l = new QLabel(this);
    l->setPixmap(QPixmap(":/images/spacer"));
    toolbar->addWidget(l);
    toolbar->addAction(overviewAction);
    toolbar->addAction(sendCoinsAction);
    toolbar->addAction(receiveCoinsAction);
    toolbar->addAction(historyAction);
    toolbar->addAction(addressBookAction);
    toolbar->setStyleSheet("#toolbar {background: transparent; text-align: center; color: black;padding-right: 30px;} QToolBar QToolButton:hover {background-color: transparent;} QToolBar QToolButton:selected {background-color: transparent;} QToolBar QToolButton:checked {background-color: transparent;} QToolBar QToolButton:pressed {background-color: transparent;} QToolBar QToolButton {font-family:Steps; font-size:15px; font-weight: bold; min-width:125px;max-width:125px; min-height:25px;max-height:25px; color: white; text-align: left; }");

}
CleanupSettings::CleanupSettings(QWidget *parent)
	: QWidget(parent), m_attached(false)
{
	QVBoxLayout *vLayout = new QVBoxLayout(this);
	vLayout->setMargin(1); // NOTE: This works to show the 1-pix black border,
						   // because this is a QWidget (not QFrame) heir...
	setLayout(vLayout);

	//   Tabs Container
	// Used to deal with styled background and other stuff

	TabBarContainter *tabBarContainer = new TabBarContainter(this);
	QHBoxLayout *hLayout = new QHBoxLayout(tabBarContainer);

	hLayout->setMargin(0);
	hLayout->setAlignment(Qt::AlignLeft);
	hLayout->addSpacing(6);

	vLayout->addWidget(tabBarContainer);

	//  Tabs Bar

	DVGui::TabBar *tabBar = new DVGui::TabBar(this);
	hLayout->addWidget(tabBar);

	tabBar->addSimpleTab(tr("Cleanup"));
	tabBar->addSimpleTab(tr("Processing"));
	tabBar->addSimpleTab(tr("Camera"));
	tabBar->setDrawBase(false);

	//  Splitter

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

	//  Stacked Widget

	QStackedWidget *stackedWidget = new QStackedWidget(split);
	stackedWidget->setMinimumWidth(300);
	//stackedWidget->setMinimumHeight(250);

	split->addWidget(stackedWidget);
	split->setStretchFactor(0, 1);

	//  Cleanup Tab

	QScrollArea *scrollArea = new QScrollArea(stackedWidget);
	stackedWidget->addWidget(scrollArea);

	scrollArea->setWidgetResizable(true);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	m_cleanupTab = new CleanupTab;
	scrollArea->setWidget(m_cleanupTab);

	//  Processing Tab

	scrollArea = new QScrollArea(stackedWidget);
	stackedWidget->addWidget(scrollArea);

	scrollArea->setWidgetResizable(true);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	m_processingTab = new ProcessingTab;
	scrollArea->setWidget(m_processingTab);

	//  Camera Tab

	scrollArea = new QScrollArea(stackedWidget);
	stackedWidget->addWidget(scrollArea);

	scrollArea->setWidgetResizable(true);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	m_cameraTab = new CameraTab;
	scrollArea->setWidget(m_cameraTab);

	m_cameraTab->setCameraPresetListFile(ToonzFolder::getReslistPath(true));

	//  Swatch

	m_swatch = new CleanupSwatch(split, 200, 150);
	split->addWidget(m_swatch);

	//  ToolBar

	QWidget *toolBarWidget = new QWidget(this);
	vLayout->addWidget(toolBarWidget);

	toolBarWidget->setFixedHeight(22);

	QHBoxLayout *toolBarLayout = new QHBoxLayout(toolBarWidget);
	toolBarWidget->setLayout(toolBarLayout);

	toolBarLayout->setMargin(0);
	toolBarLayout->setSpacing(0);

	QToolBar *leftToolBar = new QToolBar(toolBarWidget);
	toolBarLayout->addWidget(leftToolBar, 0, Qt::AlignLeft);

	leftToolBar->setFixedWidth(110);

	m_swatchAct = new QAction(createQIconOnOffPNG("preview", true), tr("Toggle Swatch Preview"), this);
	m_swatchAct->setCheckable(true);
	leftToolBar->addAction(m_swatchAct);
	leftToolBar->addSeparator();

	m_opacityAct = new QAction(createQIconOnOffPNG("opacitycheck", true), tr("Toggle Opacity Check"), this);
	m_opacityAct->setCheckable(true);
	leftToolBar->addAction(m_opacityAct);

	QToolBar *spacingToolBar1 = new QToolBar(toolBarWidget);
	toolBarLayout->addWidget(spacingToolBar1, 1);

	spacingToolBar1->setMinimumHeight(22);

	QToolBar *rightToolBar = new QToolBar(toolBarWidget);
	toolBarLayout->addWidget(rightToolBar, 0, Qt::AlignRight);

	rightToolBar->setFixedWidth(110);

	QAction *saveAct = new QAction(createQIconOnOffPNG("save", false), tr("Save Settings"), this);
	rightToolBar->addAction(saveAct);
	QAction *loadAct = new QAction(createQIconOnOffPNG("load", false), tr("Load Settings"), this);
	rightToolBar->addAction(loadAct);
	rightToolBar->addSeparator();
	QAction *resetAct = new QAction(createQIconOnOffPNG("resetsize", false), tr("Reset Settings"), this);
	rightToolBar->addAction(resetAct);

	//  Model-related stuff
	CleanupSettingsModel *model = CleanupSettingsModel::instance();
	m_backupParams.assign(model->getCurrentParameters(), false);

	//  Connections

	QAction *opacityCheckCmd = CommandManager::instance()->getAction(MI_OpacityCheck);
	assert(opacityCheckCmd);

	bool ret = true;
	ret = ret && connect(tabBar, SIGNAL(currentChanged(int)), stackedWidget, SLOT(setCurrentIndex(int)));
	ret = ret && connect(m_swatchAct, SIGNAL(toggled(bool)), SLOT(enableSwatch(bool)));
	ret = ret && connect(m_opacityAct, SIGNAL(triggered(bool)), opacityCheckCmd, SLOT(trigger()));
	ret = ret && connect(saveAct, SIGNAL(triggered()), model, SLOT(promptSave()));
	ret = ret && connect(loadAct, SIGNAL(triggered()), model, SLOT(promptLoad()));
	ret = ret && connect(resetAct, SIGNAL(triggered()), this, SLOT(onRestoreSceneSettings()));

	assert(ret);
}