2018-03-11 03:18:24 +00:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QButtonGroup>
|
|
|
|
#include <QGridLayout>
|
|
|
|
#include <QToolBar>
|
2018-03-11 16:02:15 +00:00
|
|
|
#include <QThread>
|
2018-03-13 06:39:36 +00:00
|
|
|
#include <QFileDialog>
|
2018-03-14 02:55:59 +00:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QDesktopWidget>
|
2018-03-11 16:02:15 +00:00
|
|
|
#include <assert.h>
|
|
|
|
#include "mainwindow.h"
|
2018-03-14 06:43:16 +00:00
|
|
|
#include "skeletonwidget.h"
|
|
|
|
#include "theme.h"
|
2018-03-10 06:57:14 +00:00
|
|
|
|
2018-03-14 06:43:16 +00:00
|
|
|
MainWindow::MainWindow()
|
2018-03-10 06:57:14 +00:00
|
|
|
{
|
2018-03-14 06:43:16 +00:00
|
|
|
m_partsPageButton = new QPushButton("Parts");
|
|
|
|
m_combinePageButton = new QPushButton("Combine");
|
2018-03-11 03:18:24 +00:00
|
|
|
|
2018-03-14 06:43:16 +00:00
|
|
|
QWidget *hrWidget = new QWidget;
|
|
|
|
hrWidget->setFixedHeight(2);
|
|
|
|
hrWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
|
|
hrWidget->setStyleSheet(QString("background-color: #fc6621;"));
|
|
|
|
hrWidget->setContentsMargins(0, 0, 0, 0);
|
2018-03-11 03:18:24 +00:00
|
|
|
|
2018-03-14 06:43:16 +00:00
|
|
|
QButtonGroup *pageButtonGroup = new QButtonGroup;
|
|
|
|
pageButtonGroup->addButton(m_partsPageButton);
|
|
|
|
pageButtonGroup->addButton(m_combinePageButton);
|
2018-03-11 03:18:24 +00:00
|
|
|
|
2018-03-14 06:43:16 +00:00
|
|
|
m_partsPageButton->setCheckable(true);
|
|
|
|
m_combinePageButton->setCheckable(true);
|
2018-03-11 03:18:24 +00:00
|
|
|
|
2018-03-14 06:43:16 +00:00
|
|
|
pageButtonGroup->setExclusive(true);
|
2018-03-11 03:18:24 +00:00
|
|
|
|
2018-03-14 06:43:16 +00:00
|
|
|
m_partsPageButton->setChecked(true);
|
|
|
|
updatePageButtons();
|
2018-03-11 03:18:24 +00:00
|
|
|
|
2018-03-14 06:43:16 +00:00
|
|
|
QHBoxLayout *topButtonsLayout = new QHBoxLayout;
|
|
|
|
topButtonsLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
topButtonsLayout->setSpacing(0);
|
|
|
|
topButtonsLayout->addStretch();
|
|
|
|
topButtonsLayout->addWidget(m_partsPageButton);
|
|
|
|
topButtonsLayout->addWidget(m_combinePageButton);
|
|
|
|
topButtonsLayout->addStretch();
|
2018-03-11 03:18:24 +00:00
|
|
|
|
2018-03-14 06:43:16 +00:00
|
|
|
QVBoxLayout *topLayout = new QVBoxLayout;
|
|
|
|
topLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
topLayout->setSpacing(0);
|
|
|
|
topLayout->addLayout(topButtonsLayout);
|
|
|
|
topLayout->addWidget(hrWidget);
|
2018-03-11 16:02:15 +00:00
|
|
|
|
2018-03-14 06:43:16 +00:00
|
|
|
SkeletonWidget *skeletonWidget = new SkeletonWidget(this);
|
2018-03-11 03:18:24 +00:00
|
|
|
|
|
|
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
|
|
|
mainLayout->addLayout(topLayout);
|
2018-03-14 06:43:16 +00:00
|
|
|
mainLayout->addWidget(skeletonWidget);
|
2018-03-11 03:18:24 +00:00
|
|
|
|
|
|
|
QWidget *centralWidget = new QWidget;
|
|
|
|
centralWidget->setLayout(mainLayout);
|
|
|
|
|
|
|
|
setCentralWidget(centralWidget);
|
|
|
|
setWindowTitle(tr("Dust 3D"));
|
2018-03-11 16:02:15 +00:00
|
|
|
|
2018-03-14 06:43:16 +00:00
|
|
|
bool connectResult = false;
|
2018-03-11 16:02:15 +00:00
|
|
|
|
2018-03-14 06:43:16 +00:00
|
|
|
connectResult = connect(m_partsPageButton, SIGNAL(clicked()), this, SLOT(updatePageButtons()));
|
2018-03-11 16:02:15 +00:00
|
|
|
assert(connectResult);
|
|
|
|
|
2018-03-14 06:43:16 +00:00
|
|
|
connectResult = connect(m_combinePageButton, SIGNAL(clicked()), this, SLOT(updatePageButtons()));
|
2018-03-11 16:02:15 +00:00
|
|
|
assert(connectResult);
|
2018-03-10 06:57:14 +00:00
|
|
|
}
|
|
|
|
|
2018-03-14 06:43:16 +00:00
|
|
|
void MainWindow::updatePageButtons()
|
2018-03-11 16:02:15 +00:00
|
|
|
{
|
2018-03-14 06:43:16 +00:00
|
|
|
m_partsPageButton->setStyleSheet(m_partsPageButton->isChecked() ? Theme::tabButtonSelectedStylesheet : Theme::tabButtonStylesheet);
|
|
|
|
m_combinePageButton->setStyleSheet(m_combinePageButton->isChecked() ? Theme::tabButtonSelectedStylesheet : Theme::tabButtonStylesheet);
|
2018-03-11 16:02:15 +00:00
|
|
|
}
|
|
|
|
|