From 41c8fa412ad3216f5c4808873bb455e3492d44d5 Mon Sep 17 00:00:00 2001 From: pospelov <pospelov@fz-juelich.de> Date: Wed, 13 Feb 2013 12:09:57 +0100 Subject: [PATCH] First gui prototype --- BASuite/appcore/fancytabwidget.cpp | 149 ++++ BASuite/appcore/fancytabwidget.h | 47 ++ BASuite/appcore/imode.cpp | 18 + BASuite/appcore/imode.h | 36 + BASuite/appcore/main.cpp | 11 + BASuite/appcore/mainwindow.cpp | 51 ++ BASuite/appcore/mainwindow.h | 32 + BASuite/appcore/welcomemode.cpp | 18 + BASuite/appcore/welcomemode.h | 17 + BASuite/basuite.pro | 53 ++ .../experimentmanager/experimentmanager.cpp | 45 ++ BASuite/experimentmanager/experimentmanager.h | 12 + BASuite/fitmanager/fitmanager.cpp | 46 ++ BASuite/fitmanager/fitmanager.h | 14 + BASuite/images/mode_exp.png | Bin 0 -> 2169 bytes BASuite/images/mode_fit.png | Bin 0 -> 1619 bytes BASuite/images/mode_sample.png | Bin 0 -> 869 bytes BASuite/images/mode_simul.png | Bin 0 -> 2728 bytes BASuite/images/mode_welcome.png | Bin 0 -> 2458 bytes BASuite/samplemanager/samplemanager.cpp | 42 + BASuite/samplemanager/samplemanager.h | 12 + .../simulationmanager/simulationmanager.cpp | 42 + BASuite/simulationmanager/simulationmanager.h | 14 + BASuite/utils/fancytab.cpp | 75 ++ BASuite/utils/fancytab.h | 95 +++ BASuite/utils/fancytabbar.cpp | 742 ++++++++++++++++++ BASuite/utils/fancytabbar.h | 201 +++++ BASuite/utils/stylehelper.cpp | 647 +++++++++++++++ BASuite/utils/stylehelper.h | 128 +++ BASuite/welcomemanager/welcomemanager.cpp | 30 + BASuite/welcomemanager/welcomemanager.h | 13 + 31 files changed, 2590 insertions(+) create mode 100644 BASuite/appcore/fancytabwidget.cpp create mode 100644 BASuite/appcore/fancytabwidget.h create mode 100644 BASuite/appcore/imode.cpp create mode 100644 BASuite/appcore/imode.h create mode 100644 BASuite/appcore/main.cpp create mode 100644 BASuite/appcore/mainwindow.cpp create mode 100644 BASuite/appcore/mainwindow.h create mode 100644 BASuite/appcore/welcomemode.cpp create mode 100644 BASuite/appcore/welcomemode.h create mode 100644 BASuite/basuite.pro create mode 100644 BASuite/experimentmanager/experimentmanager.cpp create mode 100644 BASuite/experimentmanager/experimentmanager.h create mode 100644 BASuite/fitmanager/fitmanager.cpp create mode 100644 BASuite/fitmanager/fitmanager.h create mode 100644 BASuite/images/mode_exp.png create mode 100644 BASuite/images/mode_fit.png create mode 100644 BASuite/images/mode_sample.png create mode 100644 BASuite/images/mode_simul.png create mode 100644 BASuite/images/mode_welcome.png create mode 100644 BASuite/samplemanager/samplemanager.cpp create mode 100644 BASuite/samplemanager/samplemanager.h create mode 100644 BASuite/simulationmanager/simulationmanager.cpp create mode 100644 BASuite/simulationmanager/simulationmanager.h create mode 100644 BASuite/utils/fancytab.cpp create mode 100644 BASuite/utils/fancytab.h create mode 100644 BASuite/utils/fancytabbar.cpp create mode 100644 BASuite/utils/fancytabbar.h create mode 100644 BASuite/utils/stylehelper.cpp create mode 100644 BASuite/utils/stylehelper.h create mode 100644 BASuite/welcomemanager/welcomemanager.cpp create mode 100644 BASuite/welcomemanager/welcomemanager.h diff --git a/BASuite/appcore/fancytabwidget.cpp b/BASuite/appcore/fancytabwidget.cpp new file mode 100644 index 00000000000..ec3f93a0cf6 --- /dev/null +++ b/BASuite/appcore/fancytabwidget.cpp @@ -0,0 +1,149 @@ +#include "fancytabwidget.h" +#include "fancytabbar.h" +//#include "styledbar.h" +#include "stylehelper.h" + +#include <QColorDialog> +#include <QHBoxLayout> +#include <QVBoxLayout> +#include <QMouseEvent> +#include <QStackedLayout> +#include <QStatusBar> +#include <QPainter> +#include <QStackedWidget> + + +class FancyColorButton : public QWidget +{ +public: + FancyColorButton(QWidget *parent) + : m_parent(parent) + { + setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); + } + + void mousePressEvent(QMouseEvent *ev) + { + if (ev->modifiers() & Qt::ShiftModifier) { + QColor color = QColorDialog::getColor(StyleHelper::requestedBaseColor(), m_parent); + if (color.isValid()) + StyleHelper::setBaseColor(color); + } + } +private: + QWidget *m_parent; +}; + + +FancyTabWidget::FancyTabWidget(QWidget *parent) + : QWidget(parent) + , m_tabBar(0) +{ + +// m_tabBar = new FancyTabBar(this); + m_tabBar = new FancyTabBar2(this); + + m_selectionWidget = new QWidget(this); + QVBoxLayout *selectionLayout = new QVBoxLayout; + selectionLayout->setSpacing(0); + selectionLayout->setMargin(0); + +// StyledBar *bar = new StyledBar(this); +// QHBoxLayout *layout = new QHBoxLayout(bar); +// layout->setMargin(0); +// layout->setSpacing(10); + //layout->addWidget(new FancyColorButton(this)); + +// selectionLayout->addWidget(bar); + selectionLayout->addWidget(m_tabBar); + m_selectionWidget->setLayout(selectionLayout); + m_selectionWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); + + m_cornerWidgetContainer = new QWidget(this); + m_cornerWidgetContainer->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); + m_cornerWidgetContainer->setAutoFillBackground(true); //true + + QVBoxLayout *cornerWidgetLayout = new QVBoxLayout; + cornerWidgetLayout->setSpacing(0); + cornerWidgetLayout->setMargin(0); + cornerWidgetLayout->addStretch(); + m_cornerWidgetContainer->setLayout(cornerWidgetLayout); + + selectionLayout->addWidget(m_cornerWidgetContainer, 0); + +// m_modesStack = new QStackedLayout; + m_statusBar = new QStatusBar; + m_statusBar->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed); + m_statusBar->showMessage("Hello world"); + //m_statusBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); + + QVBoxLayout *vlayout = new QVBoxLayout; + vlayout->setMargin(0); + vlayout->setSpacing(0); +// vlayout->addLayout(m_modesStack); +// vlayout->addWidget(m_statusBar); + + + m_stackedWidgets = new QStackedWidget; +// m_stackedWidgets->addWidget(new ConfigurationPage); +// m_stackedWidgets->addWidget(new UpdatePage); +// m_stackedWidgets->addWidget(new QueryPage); + + vlayout->addWidget(m_stackedWidgets, 1); + vlayout->addWidget(m_statusBar); + + QHBoxLayout *mainLayout = new QHBoxLayout; + mainLayout->setMargin(0); + mainLayout->setSpacing(1); + mainLayout->addWidget(m_selectionWidget); + mainLayout->addLayout(vlayout); + setLayout(mainLayout); + + connect(m_tabBar, SIGNAL(currentChanged(int)), this, SLOT(showWidget(int))); + +} + + +FancyTabWidget::~FancyTabWidget() +{ + delete m_tabBar; +} + + +void FancyTabWidget::insertTab(int index, QWidget *tab, const QIcon &icon, const QString &label) +{ + m_stackedWidgets->addWidget(tab); + m_tabBar->insertTab(index, icon, label); + m_tabBar->setTabEnabled(index, true); +} + +//void FancyTabWidget::removeTab(int index) +//{ +// m_modesStack->removeWidget(m_modesStack->widget(index)); +// m_tabBar->removeTab(index); +//} + + +void FancyTabWidget::paintEvent(QPaintEvent *event) +{ + Q_UNUSED(event) + QPainter painter(this); + + QRect rect = m_selectionWidget->rect().adjusted(0, 0, 1, 0); + rect = style()->visualRect(layoutDirection(), geometry(), rect); + StyleHelper::verticalGradient(&painter, rect, rect); + painter.setPen(StyleHelper::borderColor()); + painter.drawLine(rect.topRight(), rect.bottomRight()); + + QColor light = StyleHelper::sidebarHighlight(); + painter.setPen(light); + painter.drawLine(rect.bottomLeft(), rect.bottomRight()); +} + + +void FancyTabWidget::showWidget(int index) +{ + emit currentAboutToShow(index); + m_stackedWidgets->setCurrentIndex(index); + emit currentChanged(index); +} diff --git a/BASuite/appcore/fancytabwidget.h b/BASuite/appcore/fancytabwidget.h new file mode 100644 index 00000000000..2c85c2aa6c5 --- /dev/null +++ b/BASuite/appcore/fancytabwidget.h @@ -0,0 +1,47 @@ +#ifndef FANCYTABWIDGET_H +#define FANCYTABWIDGET_H + +#include <QWidget> + +class FancyTabBar; +class FancyTabBar2; +class QStackedLayout; +class QStatusBar; +class QStackedWidget; +class QIcon; + + +class FancyTabWidget : public QWidget +{ + Q_OBJECT + +public: + FancyTabWidget(QWidget *parent = 0); + ~FancyTabWidget(); + + void paintEvent(QPaintEvent *event); + + void insertTab(int index, QWidget *tab, const QIcon &icon, const QString &label); +// void removeTab(int index); + +signals: + void currentAboutToShow(int index); + void currentChanged(int index); + +public slots: + +private slots: + void showWidget(int index); + +private: + + FancyTabBar2 *m_tabBar; +// FancyTabBar *m_tabBar; + QWidget *m_cornerWidgetContainer; + QWidget *m_selectionWidget; + QStatusBar *m_statusBar; + QStackedWidget *m_stackedWidgets; + +}; + +#endif // FANCYTABWIDGET_H diff --git a/BASuite/appcore/imode.cpp b/BASuite/appcore/imode.cpp new file mode 100644 index 00000000000..da21e3f36dd --- /dev/null +++ b/BASuite/appcore/imode.cpp @@ -0,0 +1,18 @@ +#include "imode.h" + +IMode::IMode(QObject *parent) : m_isEnabled(true) +{ + (void)parent; +} + +void IMode::setEnabled(bool enabled) +{ + if (m_isEnabled == enabled) return; + m_isEnabled = enabled; + emit enabledStateChanged(m_isEnabled); +} + +bool IMode::isEnabled() const +{ + return m_isEnabled; +} diff --git a/BASuite/appcore/imode.h b/BASuite/appcore/imode.h new file mode 100644 index 00000000000..04ec8e2fc8f --- /dev/null +++ b/BASuite/appcore/imode.h @@ -0,0 +1,36 @@ +#ifndef IMODE_H +#define IMODE_H + +#include <QObject> +#include <QIcon> + +class IMode : public QObject +{ + Q_OBJECT + +public: + IMode(QObject *parent = 0); + + QString displayName() const { return m_displayName; } + QIcon icon() const { return m_icon; } + + int id() const { return m_id; } + bool isEnabled() const; + + void setEnabled(bool enabled); + void setDisplayName(const QString &displayName) { m_displayName = displayName; } + void setIcon(const QIcon &icon) { m_icon = icon; } + void setId(int id) { m_id = id; } + +signals: + void enabledStateChanged(bool enabled); + +private: + QString m_displayName; + QIcon m_icon; + int m_id; + bool m_isEnabled; +}; + + +#endif // IMODE_H diff --git a/BASuite/appcore/main.cpp b/BASuite/appcore/main.cpp new file mode 100644 index 00000000000..9e2d83c83ca --- /dev/null +++ b/BASuite/appcore/main.cpp @@ -0,0 +1,11 @@ +#include "mainwindow.h" +#include <QApplication> + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + + return a.exec(); +} diff --git a/BASuite/appcore/mainwindow.cpp b/BASuite/appcore/mainwindow.cpp new file mode 100644 index 00000000000..768faaef3c6 --- /dev/null +++ b/BASuite/appcore/mainwindow.cpp @@ -0,0 +1,51 @@ +#include "mainwindow.h" +#include "fancytabwidget.h" +//#include "manhattanstyle.h" +#include "welcomemanager.h" +#include "samplemanager.h" +#include "experimentmanager.h" +#include "simulationmanager.h" +#include "fitmanager.h" + +#include <QApplication> +#include <iostream> + +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) +// : FancyMainWindow(parent) + , m_tabWidget(0) + , m_welcomeManager(0) + , m_sampleManager(0) + , m_expManager(0) + , m_simulManager(0) + , m_fitManager(0) +{ +// QString baseName = QApplication::style()->objectName(); +// qApp->setStyle(new ManhattanStyle(baseName)); +// std::cout << "XXX " << baseName.toStdString().c_str() << std::endl; + + setDockNestingEnabled(true); + + setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); + setCorner(Qt::BottomRightCorner, Qt::BottomDockWidgetArea); + + m_tabWidget = new FancyTabWidget(this); + m_welcomeManager = new WelcomeManager(); + m_sampleManager = new SampleManager(); + m_expManager = new ExperimentManager(); + m_simulManager = new SimulationManager(); + m_fitManager = new FitManager(); + + m_tabWidget->insertTab(0, m_welcomeManager, QIcon("./images/mode_welcome.png"), "Welcome"); + m_tabWidget->insertTab(1, m_sampleManager, QIcon("./images/mode_sample.png"), "Sample"); + m_tabWidget->insertTab(2, m_expManager, QIcon("./images/mode_exp.png"), "Experiment"); + m_tabWidget->insertTab(3, m_simulManager, QIcon("./images/mode_simul.png"), "Simulation"); + m_tabWidget->insertTab(4, m_fitManager, QIcon("./images/mode_fit.png"), "Fit"); + + setCentralWidget(m_tabWidget); + +} + +MainWindow::~MainWindow() +{ + +} diff --git a/BASuite/appcore/mainwindow.h b/BASuite/appcore/mainwindow.h new file mode 100644 index 00000000000..66d86fa2cce --- /dev/null +++ b/BASuite/appcore/mainwindow.h @@ -0,0 +1,32 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QMainWindow> +//#include "fancymainwindow.h" + +class FancyTabWidget; +class WelcomeManager; +class SampleManager; +class ExperimentManager; +class SimulationManager; +class FitManager; + +class MainWindow : public QMainWindow +//class MainWindow : public FancyMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private: + FancyTabWidget *m_tabWidget; + WelcomeManager *m_welcomeManager; + SampleManager *m_sampleManager; + ExperimentManager *m_expManager; + SimulationManager *m_simulManager; + FitManager * m_fitManager; +}; + +#endif // MAINWINDOW_H diff --git a/BASuite/appcore/welcomemode.cpp b/BASuite/appcore/welcomemode.cpp new file mode 100644 index 00000000000..cbdab350bf9 --- /dev/null +++ b/BASuite/appcore/welcomemode.cpp @@ -0,0 +1,18 @@ +#include "welcomemode.h" +#include "welcomemanager.h" + +WelcomeMode::WelcomeMode() +{ + m_welcomeManager = new WelcomeManager(); + setObjectName(QLatin1String("WelcomeMode")); + setDisplayName(tr("Welcome")); + setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Edit.png"))); + +} + + +WelcomeMode::~WelcomeMode() +{ + // Make sure the editor manager does not get deleted + m_welcomeManager->setParent(0); +} diff --git a/BASuite/appcore/welcomemode.h b/BASuite/appcore/welcomemode.h new file mode 100644 index 00000000000..00604a704c8 --- /dev/null +++ b/BASuite/appcore/welcomemode.h @@ -0,0 +1,17 @@ +#ifndef WELCOMEMODE_H +#define WELCOMEMODE_H + +#include "imode.h" +class WelcomeManager; + +class WelcomeMode : public IMode +{ +public: + WelcomeMode(); + ~WelcomeMode(); + +private: + WelcomeManager *m_welcomeManager; +}; + +#endif // WELCOMEMODE_H diff --git a/BASuite/basuite.pro b/BASuite/basuite.pro new file mode 100644 index 00000000000..c68191e7451 --- /dev/null +++ b/BASuite/basuite.pro @@ -0,0 +1,53 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2013-02-11T18:32:10 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = basuite +TEMPLATE = app + +SOURCES += \ + appcore/fancytabwidget.cpp \ + appcore/imode.cpp \ + appcore/main.cpp \ + appcore/mainwindow.cpp \ + appcore/welcomemode.cpp \ + experimentmanager/experimentmanager.cpp \ + fitmanager/fitmanager.cpp \ + samplemanager/samplemanager.cpp \ + simulationmanager/simulationmanager.cpp \ +# utils/fancymainwindow.cpp \ + utils/fancytab.cpp \ + utils/fancytabbar.cpp \ +# utils/manhattanstyle.cpp \ +# utils/styleanimator.cpp \ +# utils/styledbar.cpp \ + utils/stylehelper.cpp \ + welcomemanager/welcomemanager.cpp + +HEADERS += \ + appcore/fancytabwidget.h \ + appcore/imode.h \ + appcore/mainwindow.h \ + appcore/welcomemode.h \ + experimentmanager/experimentmanager.h \ + fitmanager/fitmanager.h \ + samplemanager/samplemanager.h \ + simulationmanager/simulationmanager.h \ +# utils/fancymainwindow.h \ + utils/fancytab.h \ + utils/fancytabbar.h \ +# utils/manhattanstyle.h \ +# utils/styleanimator.h \ +# utils/styledbar.h \ + utils/stylehelper.h \ + welcomemanager/welcomemanager.h + +INCLUDEPATH += $$PWD/utils $$PWD/appcore $$PWD/welcomemanager $$PWD/samplemanager $$PWD/experimentmanager $$PWD/simulationmanager $$PWD/fitmanager + +#FORMS += mainwindow.ui diff --git a/BASuite/experimentmanager/experimentmanager.cpp b/BASuite/experimentmanager/experimentmanager.cpp new file mode 100644 index 00000000000..b03305e0a4c --- /dev/null +++ b/BASuite/experimentmanager/experimentmanager.cpp @@ -0,0 +1,45 @@ +#include "experimentmanager.h" +#include <QtWidgets> + +ExperimentManager::ExperimentManager(QWidget *parent) + : QWidget(parent) +{ + QGroupBox *packagesGroup = new QGroupBox(tr("Look for packages")); + + QLabel *nameLabel = new QLabel(tr("Name:")); + QLineEdit *nameEdit = new QLineEdit; + + QLabel *dateLabel = new QLabel(tr("Released after:")); + QDateTimeEdit *dateEdit = new QDateTimeEdit(QDate::currentDate()); + + QCheckBox *releasesCheckBox = new QCheckBox(tr("Releases")); + QCheckBox *upgradesCheckBox = new QCheckBox(tr("Upgrades")); + + QSpinBox *hitsSpinBox = new QSpinBox; + hitsSpinBox->setPrefix(tr("Return up to ")); + hitsSpinBox->setSuffix(tr(" results")); + hitsSpinBox->setSpecialValueText(tr("Return only the first result")); + hitsSpinBox->setMinimum(1); + hitsSpinBox->setMaximum(100); + hitsSpinBox->setSingleStep(10); + + QPushButton *startQueryButton = new QPushButton(tr("Start query")); + + QGridLayout *packagesLayout = new QGridLayout; + packagesLayout->addWidget(nameLabel, 0, 0); + packagesLayout->addWidget(nameEdit, 0, 1); + packagesLayout->addWidget(dateLabel, 1, 0); + packagesLayout->addWidget(dateEdit, 1, 1); + packagesLayout->addWidget(releasesCheckBox, 2, 0); + packagesLayout->addWidget(upgradesCheckBox, 3, 0); + packagesLayout->addWidget(hitsSpinBox, 4, 0, 1, 2); + packagesGroup->setLayout(packagesLayout); + + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addWidget(packagesGroup); + mainLayout->addSpacing(12); + mainLayout->addWidget(startQueryButton); + mainLayout->addStretch(1); + setLayout(mainLayout); +} + diff --git a/BASuite/experimentmanager/experimentmanager.h b/BASuite/experimentmanager/experimentmanager.h new file mode 100644 index 00000000000..b49f575b149 --- /dev/null +++ b/BASuite/experimentmanager/experimentmanager.h @@ -0,0 +1,12 @@ +#ifndef EXPMANAGER_H +#define EXPMANAGER_H + +#include <QWidget> + +class ExperimentManager : public QWidget +{ +public: + ExperimentManager(QWidget *parent = 0); +}; + +#endif // EXPMANAGER_H diff --git a/BASuite/fitmanager/fitmanager.cpp b/BASuite/fitmanager/fitmanager.cpp new file mode 100644 index 00000000000..58683aa9227 --- /dev/null +++ b/BASuite/fitmanager/fitmanager.cpp @@ -0,0 +1,46 @@ +#include "fitmanager.h" +#include <QtWidgets> + + +FitManager::FitManager(QWidget *parent) + : QWidget(parent) +{ + QGroupBox *packagesGroup = new QGroupBox(tr("Look for packages")); + + QLabel *nameLabel = new QLabel(tr("Name:")); + QLineEdit *nameEdit = new QLineEdit; + + QLabel *dateLabel = new QLabel(tr("Released after:")); + QDateTimeEdit *dateEdit = new QDateTimeEdit(QDate::currentDate()); + + QCheckBox *releasesCheckBox = new QCheckBox(tr("Releases")); + QCheckBox *upgradesCheckBox = new QCheckBox(tr("Upgrades")); + + QSpinBox *hitsSpinBox = new QSpinBox; + hitsSpinBox->setPrefix(tr("Return up to ")); + hitsSpinBox->setSuffix(tr(" results")); + hitsSpinBox->setSpecialValueText(tr("Return only the first result")); + hitsSpinBox->setMinimum(1); + hitsSpinBox->setMaximum(100); + hitsSpinBox->setSingleStep(10); + + QPushButton *startQueryButton = new QPushButton(tr("Start query")); + + QGridLayout *packagesLayout = new QGridLayout; + packagesLayout->addWidget(nameLabel, 0, 0); + packagesLayout->addWidget(nameEdit, 0, 1); + packagesLayout->addWidget(dateLabel, 1, 0); + packagesLayout->addWidget(dateEdit, 1, 1); + packagesLayout->addWidget(releasesCheckBox, 2, 0); + packagesLayout->addWidget(upgradesCheckBox, 3, 0); + packagesLayout->addWidget(hitsSpinBox, 4, 0, 1, 2); + packagesGroup->setLayout(packagesLayout); + + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addWidget(packagesGroup); + mainLayout->addSpacing(12); + mainLayout->addWidget(startQueryButton); + mainLayout->addStretch(1); + setLayout(mainLayout); +} + diff --git a/BASuite/fitmanager/fitmanager.h b/BASuite/fitmanager/fitmanager.h new file mode 100644 index 00000000000..608f2024de0 --- /dev/null +++ b/BASuite/fitmanager/fitmanager.h @@ -0,0 +1,14 @@ +#ifndef FITMANAGER_H +#define FITMANAGER_H + +#include <QWidget> + + +class FitManager : public QWidget +{ +public: + FitManager(QWidget *parent = 0); +}; + + +#endif // FITMANAGER_H diff --git a/BASuite/images/mode_exp.png b/BASuite/images/mode_exp.png new file mode 100644 index 0000000000000000000000000000000000000000..994520b8b53e344f4424c3c32f6872fccaa5427b GIT binary patch literal 2169 zcmeAS@N?(olHy`uVBq!ia0y~yU@!n-4mJh`hH$2z?F<YIjKx9jP7LeL$-HD>VBjq9 zh%9Dc5IGFOjG_g;P7DkT>?NMQuI#rM1z6bCI(!2Z7#JAXlDyqr82*Fcg1yTpGcd6K z^mK6yskn7F%DZ32Rp_75=H2PX_;bQ;eN4{bf0p>>X6x;L3=SSK7DddR*JWD-I6jK# zFN|Hg<qyNRE%hl|cdM)D>HJ{isJ?fDE$6_F-K({lPjr-|J-^b!R{q-{z}PTyW_)Ux zi`x_NnM)7m|22x<5`D1jnyb#g>k<#vY_0!zPyUXho51TW=d5aZ7D%#M&6YgCKTl~< z{ks(bhR-q?=I10kyqvlIeEbQ+)Q10h?+-D5zHYF>`*=>jbOiUG{8Tpnv+>6laPH{r z@?81jk%^qmJ#ia%qr`U~7U~|}+nlTSJf=o);dM^^qB~)ITTT5KIla0XgU_9);4}N? zctr8i>sx|zmdO8<`DUKmFtyQ>_u;Ae&zJ3#IZ%;hd;3`PCANp{JQoW63SMVLC>>PL zV0j<aZ7=)oAnP6DJkk7wV`dG`No>Kf%t{aH>V6(-uP*#$`QY+YJ0H1n;Ti^Qo3zQw z?`F?Fbh7@<v76#N|MYjT3f|>V4BOW&Tz|i}Sf6SB`m0$||M{{GC2ux&Uu-+=c;}17 zSD$_^xYp<*-u(V`?Toi^2RCS1rR}-d&%Af_idi;?7b^UFyyocBhjKErcDAirCSj(w zUhvp;c4LcOudVv!3mNWJ-zoc@Q}Iob;eV3kw3_{2Ma35DtVo<NE9F^a<w|}RqqxG~ z>8ooswexr0O?nZ!svzEYU)aLL8ilt<jTe1+xpmfWr`MnIw2jI*w*C!0Q^Uph@2aGE zSkm<gXX*|yc<laD@bZL6x5UNfYc7pdXEnU<Ix(At-b+#DSQ#fJF!f~O<oU`kmy{kc zn=4SeF7uc{0?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SMprZjt7g z7V~IF;ll+VY`T*Kg`QfSdvK4L&%ifEo26-!_|bqJ-}{XcmL=G-^yVL^7hC?-hC%rI zXX8!t#pmhoS@8Sk<M-k=^RG4X+nhgje*fcwhoukhs4h)(WDS4Xzb|*=54I1ij|(HN z+<Wv;IQdzl_WgB-clzDpTmQBE;f;9*J}d7Ix^v=$*lF_$yGI==0{I(`*wmNozh88E zQ_ax_C+cpols|sjSSMS#=UTqy$KAfqDvlm5zT>uM{`U-}d*L=kwgKjf{4W;nTD9Zc z+l?uVd&18%JiMopIm<J0h0bZ24UKAR!=lx7bw%4xo(b-o?^mcRCUv`E+oh*+d;hj7 zwuN-AJQO)|+NV_>o(pHLRQt*xsG&VW)8tXEbI{%gmAAj;yzJz?@A=u(j$8HVCdFkT zi{>OA%<R6PEVh2@G<7G>Ag+6_tSjX@;#I|FX!U-uNZRu}*Wq~7&GXSqY$ha0A4{9( z@26t%^moYxOT+9f)Akz9WdB!N*Y&x9HD!N%-S&;j+#-iQZ<-%IZ@-7~ap#$Tk9_vd zuSlD1bgVPvr*b}{cfM3jp=80M&`Ikb^50KBcAD8fZYRt0IcFwp{uP`4ZyRG)enPj5 zLV3iWjom+QOE;WqmD7J#x!h)ck-liwni$g=x2G2sh@8J9Y0clE@qTj3gI$f!TCIv| zTYvPVB~;vfA0GHhgZJ^N&m!+4Gg{s=HherCB_#NG-tWpUzrV7W%(|&k|2{Bq&5yqI z&mR<-&wQWzvvu)aZq|cGFIDSD#9q&FkT*FdrSRALgSi*~6&)9*XYYSaOtX!&+~2on zZHkn@<E%u#pr^G<^|hz0Z*%71G%qcUoVP@_C{*Wu`w!N6NiTC>Gxl<AKK1Dh->-1y t^F@tIZ%%97lqh-I(aq$?-q`&Ni#KcZF8{Xk69WSSgQu&X%Q~loCIDKv9#sGU literal 0 HcmV?d00001 diff --git a/BASuite/images/mode_fit.png b/BASuite/images/mode_fit.png new file mode 100644 index 0000000000000000000000000000000000000000..e095ab64d8e186d5ecbdf13e166f00e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ite/images/mode_sample.png b/BASuite/images/mode_sample.png new file mode 100644 index 0000000000000000000000000000000000000000..fd388db826174d63dcafa57b5db5724b0b62ae12 GIT binary patch literal 869 zcmeAS@N?(olHy`uVBq!ia0y~yU@!n-4mJh`hH$2z?F<YIEX7WqAsieW95oy%9SjT% zoCO|{#S9F**Fl)kNn>^e0|SF(iEBhjaDG}zd16s2LwR|*US?i)adKios$PCk`s{Z$ zQVa|X!XQN<nI$=?4E_ZrnaPPc3NA&NWvO=QyLcEFm=1foIEG|2zP%QkeK|ma{lotp zy;-%b8_z3uaQw1;*1CJ9W7O#-;!1U!*M9X2Kd#oZH9Kv);r4Y;DnBZnJZV{}*|b68 zB(v)Cr!N)x)&EqOg^2q0sh93QaNjN3;qFDTfbuP@S7hU?UhL&(3v_8*RrUH`K=}$S z!_yxwA3tAvK<mNn>z*6_C*FTuwp$>ugDXTtiRtPO%|!vd^OYVw>CiGc*?E2QMvqO? z=REGaJm=BRZ*f*~z56Pjr`t0z<T0wNFW<3m=dr^zoM~*E8)iD5`8Y@7jL7-U&9<A0 zPxNS>Jb5hppLa;1T=R@Mrd=GXcS{#5FKg(&S@Yw~%g+uj|6clYFqB%&O|-h1QN3{1 z;*YF<;(NaRsy+XGH)khTs4vIa3ga`GZqbdGm?nn4eqD6xykzh3dt16L9=*!+{dsxk zNhYzzh$TkG5fVN(?@S0kl-_u`#bx%HM>kS0TQ*Awx^}$FKifNlY1!tRAD(uH>n`q> z?G0b?k#)xVzp?rf2Iey^p1i1XqguLR-~HBOoj1=<&}zFe#V54%M~QXN+9g{j1?`sB zec8nCp8WpNo~DbZT{~{aZ@;<FY`Nx2Az>}ewMu-m{nWjGepQ<Nvv2zpe>DS7C!I#Q zcV~JfTDNWA&VKsoCc~b##2f5UZm;`~i6<EDGEbPMW?Ut+=jPq7f6n?kh_2#XdVwqG z>Z_>YJ<qJK+AQT;`TARoQz#4j<B8&a=TAw_jc?nrYoC$+t1YK2gJxP*a=EPOyIQhg zr=HpIoPFJ;R+sPW+U&;CD|e=MOV2f!*KA+B<!w=6kUI6^`{Kt5>Cd-5&;Qk+D8jjt zbG62E6SYvCy_aNWU!QWqKK0sD<Ga=pvQ^zbx14zK@}y>(xN(cU{$26YTeq66+|+l) zW_eQShN)+~ESK)&yL$P=osPha?Ck6fQEQ{z<gKOF2Oy=c{fsK23%)MbZeGv8z`)?? L>gTe~DWM4fkI0k< literal 0 HcmV?d00001 diff --git a/BASuite/images/mode_simul.png b/BASuite/images/mode_simul.png new file mode 100644 index 0000000000000000000000000000000000000000..2d9abbdd56f1d44ec0f1992ab3252c2849f4c929 GIT binary patch literal 2728 zcmeAS@N?(olHy`uVBq!ia0y~yU@!n-4mJh`hH$2z?F<YIY)RhkE)4%caKYZ?lNlHo zI14-?iy0WC*Ml%)oYX`a1_lQ95>H=O_Uk<I44T%zHKGg{7`RM5T^vIyZoQ4HE)e}H z`tMt5{6n@T&jtq(4*l+kHzzEVZUk*yTiYO;8dd5b8+d$M#_QxYep`*pmi;+uAsRi? zPjqW)h}Y5#?LL8Sk+pk#D?Jo#nAB8S?%cU^r~3QX>Mw8dzt5UGZR6XL30n^D{Q2&t z?e5us_kI5HHm&J%*}Z?(m(Phz31TbkejvPLS>}IhCL6Uj(Nk}h*Wb8ioPD->`5&i~ z@mIq?)m{7a#i!3P<ClGk-0Xj|;%|gM`hJDSaJec^&ANb3(>xXL?fEkA>|*xa45_E< z>T6zbpOwv!N=-WXCrW3}GBHi>b5ke1-}mI*v!B!N>`eT?#Zk4_IK8{H{-w*kZ5Qv| z?hh;#;@6ev?OZ&mRNzmj=F#Bb_Yw0Yw}=Yt<9#>vK^4!w^HcRJ&GPnb<NLgBk3;*1 zX&wjf?ftRs`Z7K*#yi?gyIn2T@jo**aC4Gy&%b!=2)FQ#_s0rXtiQI*`(gg<O)swQ zR@aYN%&*1h64zO<XM)9NR*A}{uEHNX{z@ksX206d^W+{E$G)mdXZ5f0E#jK8WkYLC zftiC{pVP^MJ(;FE-tH<~;q{13^XR$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Z=*Cn=Fh0k@;}KsP4C8qjaz<J^Dpbz^Y!c0 z)xYXZExUJQZqAQ+)R&dzRbkYbut3o=Xr_r;tPS^}rw1H<YZSyqx>-u3Cp`IE@H51F z)$^SSp$VIM_TDa6n18ySq0@D*{GJ``=?Bl0SnW+ZzU=J%x9{E<u@nm|SeD45H}6~J zi<|}jw`%+j^i^o;>0S_}WFwZkudC|skBiJ(yxxeNN%s%_)4o@C|Hi^;KHMivW9qtJ zT5MC?$-n;nk;SHq-R<hWFSc)g_Tj};N0;|jF^#S_zyD2`z3!uA3)_#j=DD+HT`b+B z{Nnu4pSJq@8#m{qnH1<S8SzdxJiFz}rd2beX4EDvcU+OXRsM@jxMcWDe;(h(Z-3Oi zxwC<B-r0K>N*?$9xp#H$50Nu}mQQ-2<|=%lCn1xyC2M|x?p1AX%|(f3B^^DDYxCD0 z-8gM8AFEtrp6>hGzpeQ;6)Q39Qf%gW@rscxqsu_y>k6T%;#XI(+}h3e@b1*r0k7WP zb{D@BloNZuX~x{yTp1!pPK;le*YWZcYPd8TUpewy`r4zz&w3pl>pVlNSKRm&CTM8g zF1jEfgi(v_#o{n2&W5EvTSRwl$oy&iBG>vJvv2&GnI}t+9zH9SzM<HJneAYU+}^Mi z_GJuT(tY=Af9hMa;g@Q``TGv)cjK~dU+O!-HjyD%Nr2IpcTF~f`yacUn2k(xb#>QG zspvUZxv3<_nEB=c;RMy-6?-2rl^j?oE5CdDzUJ7~@r}_MG7V`uTHAB)^_^f_+HkB; ze3PK?vB!t+zE3<qtMtXs70wP_>6)*<i}&w|mHG1j$!F8z+Wn`CYJc;2sNdfof4PUX zN~t=$=g))x?%!uvmZwghbw;eJDE6-ImjJ8$=WqXC|Hrqk{*I1RbNWRF1_lOCS3j3^ HP6<r_{`Vj* literal 0 HcmV?d00001 diff --git a/BASuite/images/mode_welcome.png b/BASuite/images/mode_welcome.png new file mode 100644 index 0000000000000000000000000000000000000000..a14a2e6d4a41a639a5ddbbabdd5776e78c6ff306 GIT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q)II>#O(YTdM0Gsn7T^U);&~fVCy3eC@HLEDQ&a@wc;l z*vrx^yD8<VJg181g4M6pk{sSJ-MV$}u=xD{+{FhspSNqC6RQ3E`Ti+Fj{3{qxl7J? zD0TVDQIpbxf@QL?23szy7drEo(IWkbj4`)>VVjta>fSkd!tLCX<aE<_i7)J}*wPa+ gf8CtE*Yym{-hwB$naS*9U|?YIboFyt=akR{03XYQ#Q*>R literal 0 HcmV?d00001 diff --git a/BASuite/samplemanager/samplemanager.cpp b/BASuite/samplemanager/samplemanager.cpp new file mode 100644 index 00000000000..800eb9a5232 --- /dev/null +++ b/BASuite/samplemanager/samplemanager.cpp @@ -0,0 +1,42 @@ +#include "samplemanager.h" +#include <QtWidgets> + + +SampleManager::SampleManager(QWidget *parent) + : QWidget(parent) +{ + QGroupBox *updateGroup = new QGroupBox(tr("Package selection")); + QCheckBox *systemCheckBox = new QCheckBox(tr("Update system")); + QCheckBox *appsCheckBox = new QCheckBox(tr("Update applications")); + QCheckBox *docsCheckBox = new QCheckBox(tr("Update documentation")); + + QGroupBox *packageGroup = new QGroupBox(tr("Existing packages")); + + QListWidget *packageList = new QListWidget; + QListWidgetItem *qtItem = new QListWidgetItem(packageList); + qtItem->setText(tr("Qt")); + QListWidgetItem *qsaItem = new QListWidgetItem(packageList); + qsaItem->setText(tr("QSA")); + QListWidgetItem *teamBuilderItem = new QListWidgetItem(packageList); + teamBuilderItem->setText(tr("Teambuilder")); + + QPushButton *startUpdateButton = new QPushButton(tr("Start update")); + + QVBoxLayout *updateLayout = new QVBoxLayout; + updateLayout->addWidget(systemCheckBox); + updateLayout->addWidget(appsCheckBox); + updateLayout->addWidget(docsCheckBox); + updateGroup->setLayout(updateLayout); + + QVBoxLayout *packageLayout = new QVBoxLayout; + packageLayout->addWidget(packageList); + packageGroup->setLayout(packageLayout); + + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addWidget(updateGroup); + mainLayout->addWidget(packageGroup); + mainLayout->addSpacing(12); + mainLayout->addWidget(startUpdateButton); + mainLayout->addStretch(1); + setLayout(mainLayout); +} diff --git a/BASuite/samplemanager/samplemanager.h b/BASuite/samplemanager/samplemanager.h new file mode 100644 index 00000000000..3199dab5a64 --- /dev/null +++ b/BASuite/samplemanager/samplemanager.h @@ -0,0 +1,12 @@ +#ifndef SAMPLEMANAGER_H +#define SAMPLEMANAGER_H + +#include <QWidget> + +class SampleManager : public QWidget +{ +public: + SampleManager(QWidget *parent = 0); +}; + +#endif // SAMPLEMANAGER_H diff --git a/BASuite/simulationmanager/simulationmanager.cpp b/BASuite/simulationmanager/simulationmanager.cpp new file mode 100644 index 00000000000..0d94dc8ddb3 --- /dev/null +++ b/BASuite/simulationmanager/simulationmanager.cpp @@ -0,0 +1,42 @@ +#include "simulationmanager.h" +#include <QtWidgets> + + +SimulationManager::SimulationManager(QWidget *parent) + : QWidget(parent) +{ + QGroupBox *updateGroup = new QGroupBox(tr("Package selection")); + QCheckBox *systemCheckBox = new QCheckBox(tr("Update system")); + QCheckBox *appsCheckBox = new QCheckBox(tr("Update applications")); + QCheckBox *docsCheckBox = new QCheckBox(tr("Update documentation")); + + QGroupBox *packageGroup = new QGroupBox(tr("Existing packages")); + + QListWidget *packageList = new QListWidget; + QListWidgetItem *qtItem = new QListWidgetItem(packageList); + qtItem->setText(tr("Qt")); + QListWidgetItem *qsaItem = new QListWidgetItem(packageList); + qsaItem->setText(tr("QSA")); + QListWidgetItem *teamBuilderItem = new QListWidgetItem(packageList); + teamBuilderItem->setText(tr("Teambuilder")); + + QPushButton *startUpdateButton = new QPushButton(tr("Start update")); + + QVBoxLayout *updateLayout = new QVBoxLayout; + updateLayout->addWidget(systemCheckBox); + updateLayout->addWidget(appsCheckBox); + updateLayout->addWidget(docsCheckBox); + updateGroup->setLayout(updateLayout); + + QVBoxLayout *packageLayout = new QVBoxLayout; + packageLayout->addWidget(packageList); + packageGroup->setLayout(packageLayout); + + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addWidget(updateGroup); + mainLayout->addWidget(packageGroup); + mainLayout->addSpacing(12); + mainLayout->addWidget(startUpdateButton); + mainLayout->addStretch(1); + setLayout(mainLayout); +} diff --git a/BASuite/simulationmanager/simulationmanager.h b/BASuite/simulationmanager/simulationmanager.h new file mode 100644 index 00000000000..aa9ae6d12cf --- /dev/null +++ b/BASuite/simulationmanager/simulationmanager.h @@ -0,0 +1,14 @@ +#ifndef SIMULATIONMANAGER_H +#define SIMULATIONMANAGER_H + +#include <QWidget> + + +class SimulationManager : public QWidget +{ +public: + SimulationManager(QWidget *parent = 0); +}; + + +#endif // SIMULATIONMANAGER_H diff --git a/BASuite/utils/fancytab.cpp b/BASuite/utils/fancytab.cpp new file mode 100644 index 00000000000..211d84ed4bb --- /dev/null +++ b/BASuite/utils/fancytab.cpp @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "fancytab.h" + +//void FancyTab::fadeIn() +//{ +// mAnimator.stop(); +// mAnimator.setDuration(80); +// mAnimator.setEndValue(40); +// mAnimator.start(); +//} + +//void FancyTab::fadeOut() +//{ +// mAnimator.stop(); +// mAnimator.setDuration(160); +// mAnimator.setEndValue(0); +// mAnimator.start(); +//} + +//void FancyTab::setFader(float value) +//{ +// mFader = value; +// mTabBar->update(); +//} + + +void FancyTab::fadeIn() +{ + animator.stop(); + animator.setDuration(80); + animator.setEndValue(40); + animator.start(); +} + +void FancyTab::fadeOut() +{ + animator.stop(); + animator.setDuration(160); + animator.setEndValue(0); + animator.start(); +} + +void FancyTab::setFader(float value) +{ + m_fader = value; + tabbar->update(); +} diff --git a/BASuite/utils/fancytab.h b/BASuite/utils/fancytab.h new file mode 100644 index 00000000000..b1275ad5bf5 --- /dev/null +++ b/BASuite/utils/fancytab.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef FANCYTAB_H +#define FANCYTAB_H + +#include <QIcon> +#include <QWidget> + +#include <QPropertyAnimation> + +//class FancyTab : public QObject +//{ +// Q_OBJECT + +// Q_PROPERTY(float fader READ fader WRITE setFader) +//public: +// FancyTab(QWidget *tabbar) : enabled(false), mTabBar(tabbar), mFader(0) +// { +// mAnimator.setPropertyName("fader"); +// mAnimator.setTargetObject(this); +// } + +// float fader() { return mFader; } +// void setFader(float value); + +// void fadeIn(); +// void fadeOut(); + +// QIcon icon; +// QString text; +// QString toolTip; +// bool enabled; + +//private: +// QPropertyAnimation mAnimator; +// QWidget *mTabBar; +// float mFader; +//}; + +class FancyTab : public QObject +{ + Q_OBJECT + + Q_PROPERTY(float fader READ fader WRITE setFader) +public: + FancyTab(QWidget *tabbar) : enabled(false), tabbar(tabbar), m_fader(0) { + animator.setPropertyName("fader"); + animator.setTargetObject(this); + } + float fader() { return m_fader; } + void setFader(float value); + + void fadeIn(); + void fadeOut(); + + QIcon icon; + QString text; + QString toolTip; + bool enabled; + +private: + QPropertyAnimation animator; + QWidget *tabbar; + float m_fader; +}; + + +#endif // FANCYTAB_H diff --git a/BASuite/utils/fancytabbar.cpp b/BASuite/utils/fancytabbar.cpp new file mode 100644 index 00000000000..db87f80d031 --- /dev/null +++ b/BASuite/utils/fancytabbar.cpp @@ -0,0 +1,742 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "fancytabbar.h" +#include "stylehelper.h" + +#include <QMouseEvent> +//#include <QWindowsStyle> +#include <QPainter> +#include <QColor> +#include <QStackedLayout> +#include <QToolTip> +#include <QStyleFactory> + +const int FancyTabBar::m_rounding = 22; +const int FancyTabBar::m_textPadding = 4; + +FancyTabBar::FancyTabBar(QWidget *parent) + : QWidget(parent) +{ + m_hoverIndex = -1; + m_currentIndex = -1; + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); + setStyle(QStyleFactory::create(QLatin1String("windows"))); + setMinimumWidth(qMax(2 * m_rounding, 40)); + setAttribute(Qt::WA_Hover, true); + setFocusPolicy(Qt::NoFocus); + setMouseTracking(true); // Needed for hover events + m_triggerTimer.setSingleShot(true); + + // We use a zerotimer to keep the sidebar responsive + connect(&m_triggerTimer, SIGNAL(timeout()), this, SLOT(emitCurrentIndex())); +} + +FancyTabBar::~FancyTabBar() +{ + delete style(); +} + +QSize FancyTabBar::tabSizeHint(bool minimum) const +{ + QFont boldFont(font()); +// boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize()); + boldFont.setPointSizeF(StyleHelper::sidebarFontSize()); + boldFont.setBold(true); + QFontMetrics fm(boldFont); + int spacing = 8; + int width = 60 + spacing + 2; + int maxLabelwidth = 0; + for (int tab=0 ; tab<count() ;++tab) { + int width = fm.width(tabText(tab)); + if (width > maxLabelwidth) + maxLabelwidth = width; + } +// int iconHeight = minimum ? 0 : 32; + int iconHeight = minimum ? 0 : 48; + return QSize(qMax(width, maxLabelwidth + 4), iconHeight + spacing + fm.height()); +} + +void FancyTabBar::paintEvent(QPaintEvent *event) +{ + Q_UNUSED(event) + QPainter p(this); + + for (int i = 0; i < count(); ++i) + if (i != currentIndex()) + paintTab(&p, i); + + // paint active tab last, since it overlaps the neighbors + if (currentIndex() != -1) + paintTab(&p, currentIndex()); +} + +// Handle hover events for mouse fade ins +void FancyTabBar::mouseMoveEvent(QMouseEvent *e) +{ + int newHover = -1; + for (int i = 0; i < count(); ++i) { + QRect area = tabRect(i); + if (area.contains(e->pos())) { + newHover = i; + break; + } + } + if (newHover == m_hoverIndex) + return; + + if (validIndex(m_hoverIndex)) + m_tabs[m_hoverIndex]->fadeOut(); + + m_hoverIndex = newHover; + + if (validIndex(m_hoverIndex)) { + m_tabs[m_hoverIndex]->fadeIn(); + m_hoverRect = tabRect(m_hoverIndex); + } +} + +bool FancyTabBar::event(QEvent *event) +{ + if (event->type() == QEvent::ToolTip) { + if (validIndex(m_hoverIndex)) { + QString tt = tabToolTip(m_hoverIndex); + if (!tt.isEmpty()) { + QToolTip::showText(static_cast<QHelpEvent*>(event)->globalPos(), tt, this); + return true; + } + } + } + return QWidget::event(event); +} + +// Resets hover animation on mouse enter +void FancyTabBar::enterEvent(QEvent *e) +{ + Q_UNUSED(e) + m_hoverRect = QRect(); + m_hoverIndex = -1; +} + +// Resets hover animation on mouse enter +void FancyTabBar::leaveEvent(QEvent *e) +{ + Q_UNUSED(e) + m_hoverIndex = -1; + m_hoverRect = QRect(); + for (int i = 0 ; i < m_tabs.count() ; ++i) { + m_tabs[i]->fadeOut(); + } +} + +QSize FancyTabBar::sizeHint() const +{ + QSize sh = tabSizeHint(); + return QSize(sh.width(), sh.height() * m_tabs.count()); +} + +QSize FancyTabBar::minimumSizeHint() const +{ + QSize sh = tabSizeHint(true); + return QSize(sh.width(), sh.height() * m_tabs.count()); +} + +QRect FancyTabBar::tabRect(int index) const +{ + QSize sh = tabSizeHint(); + + if (sh.height() * m_tabs.count() > height()) + sh.setHeight(height() / m_tabs.count()); + + return QRect(0, index * sh.height(), sh.width(), sh.height()); + +} + +// This keeps the sidebar responsive since +// we get a repaint before loading the +// mode itself +void FancyTabBar::emitCurrentIndex() +{ + emit currentChanged(m_currentIndex); +} + +void FancyTabBar::mousePressEvent(QMouseEvent *e) +{ + e->accept(); + for (int index = 0; index < m_tabs.count(); ++index) { + if (tabRect(index).contains(e->pos())) { + + if (isTabEnabled(index)) { + m_currentIndex = index; + update(); + m_triggerTimer.start(0); + } + break; + } + } +} + +void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const +{ + if (!validIndex(tabIndex)) { + qWarning("invalid index"); + return; + } + painter->save(); + + QRect rect = tabRect(tabIndex); + bool selected = (tabIndex == m_currentIndex); + bool enabled = isTabEnabled(tabIndex); + + if (selected) { + //background + painter->save(); + QLinearGradient grad(rect.topLeft(), rect.topRight()); + grad.setColorAt(0, QColor(255, 255, 255, 140)); + grad.setColorAt(1, QColor(255, 255, 255, 210)); + painter->fillRect(rect.adjusted(0, 0, 0, -1), grad); + painter->restore(); + + //shadows + painter->setPen(QColor(0, 0, 0, 110)); + painter->drawLine(rect.topLeft() + QPoint(1,-1), rect.topRight() - QPoint(0,1)); + painter->drawLine(rect.bottomLeft(), rect.bottomRight()); + painter->setPen(QColor(0, 0, 0, 40)); + painter->drawLine(rect.topLeft(), rect.bottomLeft()); + + //highlights + painter->setPen(QColor(255, 255, 255, 50)); + painter->drawLine(rect.topLeft() + QPoint(0, -2), rect.topRight() - QPoint(0,2)); + painter->drawLine(rect.bottomLeft() + QPoint(0, 1), rect.bottomRight() + QPoint(0,1)); + painter->setPen(QColor(255, 255, 255, 40)); + painter->drawLine(rect.topLeft() + QPoint(0, 0), rect.topRight()); + painter->drawLine(rect.topRight() + QPoint(0, 1), rect.bottomRight() - QPoint(0, 1)); + painter->drawLine(rect.bottomLeft() + QPoint(0,-1), rect.bottomRight()-QPoint(0,1)); + } + + QString tabText(this->tabText(tabIndex)); + QRect tabTextRect(tabRect(tabIndex)); + QRect tabIconRect(tabTextRect); + tabTextRect.translate(0, -2); + QFont boldFont(painter->font()); +// boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize()); + boldFont.setPointSizeF(StyleHelper::sidebarFontSize()); + boldFont.setBold(true); + painter->setFont(boldFont); + painter->setPen(selected ? QColor(255, 255, 255, 160) : QColor(0, 0, 0, 110)); + int textFlags = Qt::AlignCenter | Qt::AlignBottom | Qt::TextWordWrap; + if (enabled) { + painter->drawText(tabTextRect, textFlags, tabText); + painter->setPen(selected ? QColor(60, 60, 60) : StyleHelper::panelTextColor()); + } else { + painter->setPen(selected ? StyleHelper::panelTextColor() : QColor(255, 255, 255, 120)); + } +#ifndef Q_OS_MAC + if (!selected && enabled) { + painter->save(); + int fader = int(m_tabs[tabIndex]->fader()); + QLinearGradient grad(rect.topLeft(), rect.topRight()); + grad.setColorAt(0, Qt::transparent); + grad.setColorAt(0.5, QColor(255, 255, 255, fader)); + grad.setColorAt(1, Qt::transparent); + painter->fillRect(rect, grad); + painter->setPen(QPen(grad, 1.0)); + painter->drawLine(rect.topLeft(), rect.topRight()); + painter->drawLine(rect.bottomLeft(), rect.bottomRight()); + painter->restore(); + } +#endif + + if (!enabled) + painter->setOpacity(0.7); + + int textHeight = painter->fontMetrics().boundingRect(QRect(0, 0, width(), height()), Qt::TextWordWrap, tabText).height(); + tabIconRect.adjust(0, 4, 0, -textHeight); + StyleHelper::drawIconWithShadow(tabIcon(tabIndex), tabIconRect, painter, enabled ? QIcon::Normal : QIcon::Disabled); + + painter->translate(0, -1); + painter->drawText(tabTextRect, textFlags, tabText); + painter->restore(); +} + +void FancyTabBar::setCurrentIndex(int index) { + if (isTabEnabled(index)) { + m_currentIndex = index; + update(); + emit currentChanged(m_currentIndex); + } +} + +void FancyTabBar::setTabEnabled(int index, bool enable) +{ + Q_ASSERT(index < m_tabs.size()); + Q_ASSERT(index >= 0); + + if (index < m_tabs.size() && index >= 0) { + m_tabs[index]->enabled = enable; + update(tabRect(index)); + } +} + +bool FancyTabBar::isTabEnabled(int index) const +{ + Q_ASSERT(index < m_tabs.size()); + Q_ASSERT(index >= 0); + + if (index < m_tabs.size() && index >= 0) + return m_tabs[index]->enabled; + + return false; +} + + + +// ---------------------------------------------------------------------------- +// Another implementation of FancyTabBar which can be places in different corners +// ---------------------------------------------------------------------------- + +const int FancyTabBar2::m_rounding = 22; +const int FancyTabBar2::m_textPadding = 4; + + +FancyTabBar2::FancyTabBar2(QWidget *parent, TabBarPosition position ) + : QWidget(parent), mPosition(position) +{ + mHoverIndex = -1; + mCurrentIndex = -1; + + if(mPosition == Above || mPosition == Below) + { + setMinimumHeight(qMax(2 * m_rounding, 40)); + setMaximumHeight(tabSizeHint(false).height()); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + } + else + { + setMinimumWidth(qMax(2 * m_rounding, 40)); + setMaximumWidth(tabSizeHint(false).width()); + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); + } + +// setStyle(new QWindowsStyle); + setStyle(QStyleFactory::create(QLatin1String("windows"))); + + setAttribute(Qt::WA_Hover, true); + setFocusPolicy(Qt::NoFocus); + setMouseTracking(true); // Needed for hover events + mTimerTriggerChangedSignal.setSingleShot(true); + + // We use a zerotimer to keep the sidebar responsive + connect(&mTimerTriggerChangedSignal, SIGNAL(timeout()), this, SLOT(emitCurrentIndex())); +} + +FancyTabBar2::~FancyTabBar2() +{ + delete style(); +} + +QSize FancyTabBar2::tabSizeHint(bool minimum) const +{ + QFont boldFont(font()); + boldFont.setPointSizeF(StyleHelper::sidebarFontSize()); + boldFont.setBold(true); + QFontMetrics fm(boldFont); + int spacing = 8; + int width = 60 + spacing + 2; + int maxLabelwidth = 0; + for (int tab=0 ; tab<count() ;++tab) { + int width = fm.width(tabText(tab)); + if (width > maxLabelwidth) + maxLabelwidth = width; + } + //int iconHeight = minimum ? 0 : 32; + int iconHeight = minimum ? 0 : 48; + + return QSize(qMax(width, maxLabelwidth + 4), iconHeight + spacing + fm.height()); +} + +QPoint FancyTabBar2::getCorner(const QRect& rect, const Corner corner) const +{ + if(mPosition == Above) + { + if(corner == OutsideBeginning) return rect.topLeft(); + if(corner == OutsideEnd) return rect.topRight(); + if(corner == InsideBeginning) return rect.bottomLeft(); + if(corner == InsideEnd) return rect.bottomRight(); + } + else if(mPosition == Below) + { + if(corner == OutsideBeginning) return rect.bottomLeft(); + if(corner == OutsideEnd) return rect.bottomRight(); + if(corner == InsideBeginning) return rect.topLeft(); + if(corner == InsideEnd) return rect.topRight(); + } + else if(mPosition == Left) + { + if(corner == OutsideBeginning) return rect.topLeft(); + if(corner == OutsideEnd) return rect.bottomLeft(); + if(corner == InsideBeginning) return rect.topRight(); + if(corner == InsideEnd) return rect.bottomRight(); + } + else if(mPosition == Right) + { + if(corner == OutsideBeginning) return rect.topRight(); + if(corner == OutsideEnd) return rect.bottomRight(); + if(corner == InsideBeginning) return rect.topLeft(); + if(corner == InsideEnd) return rect.bottomLeft(); + } + + Q_ASSERT("that's impossible!"); + return QPoint(); +} + +QRect FancyTabBar2::adjustRect(const QRect& rect, const qint8 offsetOutside, const qint8 offsetInside, const qint8 offsetBeginning, const qint8 offsetEnd) const +{ + if(mPosition == Above) return rect.adjusted(-offsetBeginning, -offsetOutside, offsetEnd, offsetInside); + else if(mPosition == Below) return rect.adjusted(-offsetBeginning, -offsetInside, -offsetBeginning, offsetOutside); + else if(mPosition == Left) return rect.adjusted(-offsetOutside, -offsetBeginning, offsetInside, offsetEnd); + else if(mPosition == Right) return rect.adjusted(-offsetInside, -offsetBeginning, offsetOutside, offsetEnd); + + Q_ASSERT("that's impossible!"); + return QRect(); +} + +// Same with a point: + means towards Outside/End, - means towards Inside/Beginning +QPoint FancyTabBar2::adjustPoint(const QPoint& point, const qint8 offsetInsideOutside, const qint8 offsetBeginningEnd) const +{ + if(mPosition == Above) return point + QPoint(offsetBeginningEnd, -offsetInsideOutside); + else if(mPosition == Below) return point + QPoint(offsetBeginningEnd, offsetInsideOutside); + else if(mPosition == Left) return point + QPoint(-offsetInsideOutside, offsetBeginningEnd); + else if(mPosition == Right) return point + QPoint(offsetInsideOutside, offsetBeginningEnd); + + Q_ASSERT("that's impossible!"); + return QPoint(); +} + +void FancyTabBar2::paintEvent(QPaintEvent *event) +{ + Q_UNUSED(event) + QPainter painter(this); + + // paint background + QRect rectangle = adjustRect(rect(), 0, -1, 0, 0); + QLinearGradient lg; + + lg.setStart(getCorner(rectangle, OutsideBeginning)); + lg.setFinalStop(getCorner(rectangle, InsideBeginning)); + lg.setColorAt(0.0, QColor(64, 64, 64, 255)); + lg.setColorAt(1.0, QColor(130, 130, 130, 255)); + painter.fillRect(rectangle, lg); + + // draw dark widget bordert on inner inside (e.g. bottom if the widget position is top) + painter.setPen(StyleHelper::borderColor()); + painter.drawLine(adjustPoint(getCorner(rectangle, InsideBeginning), -1, 0), adjustPoint(getCorner(rectangle, InsideEnd), -1, 0)); + + // draw bright widget border on outer inside (e.g. bottom if the widget position is top) + painter.setPen(StyleHelper::sidebarHighlight()); + painter.drawLine(getCorner(rectangle, InsideBeginning), getCorner(rectangle, InsideEnd)); + + // paint inactive tabs + for (int i = 0; i < count(); ++i) + if (i != currentIndex()) + paintTab(&painter, i); + + // paint active tab last, since it overlaps the neighbors + if (currentIndex() != -1) + paintTab(&painter, currentIndex()); +} + +// Handle hover events for mouse fade ins +void FancyTabBar2::mouseMoveEvent(QMouseEvent *e) +{ + int newHover = -1; + for (int i = 0; i < count(); ++i) + { + QRect area = tabRect(i); + if (area.contains(e->pos())) { + newHover = i; + break; + } + } + if (newHover == mHoverIndex) + return; + + if (validIndex(mHoverIndex)) + mAttachedTabs[mHoverIndex]->fadeOut(); + + mHoverIndex = newHover; + + if (validIndex(mHoverIndex)) { + mAttachedTabs[mHoverIndex]->fadeIn(); + mHoverRect = tabRect(mHoverIndex); + } +} + +bool FancyTabBar2::event(QEvent *event) +{ + if (event->type() == QEvent::ToolTip) { + if (validIndex(mHoverIndex)) { + QString tt = tabToolTip(mHoverIndex); + if (!tt.isEmpty()) { + QToolTip::showText(static_cast<QHelpEvent*>(event)->globalPos(), tt, this); + return true; + } + } + } + return QWidget::event(event); +} + +// Resets hover animation on mouse enter +void FancyTabBar2::enterEvent(QEvent *e) +{ + Q_UNUSED(e) + mHoverRect = QRect(); + mHoverIndex = -1; +} + +// Resets hover animation on mouse leave +void FancyTabBar2::leaveEvent(QEvent *e) +{ + Q_UNUSED(e) + mHoverIndex = -1; + mHoverRect = QRect(); + for (int i = 0 ; i < mAttachedTabs.count() ; ++i) { + mAttachedTabs[i]->fadeOut(); + } +} + +QSize FancyTabBar2::sizeHint() const +{ + QSize sh = tabSizeHint(); +// return QSize(sh.width(), sh.height() * mAttachedTabs.count()); + + if(mPosition == Above || mPosition == Below) + return QSize(sh.width() * mAttachedTabs.count(), sh.height()); + else + return QSize(sh.width(), sh.height() * mAttachedTabs.count()); +} + +QSize FancyTabBar2::minimumSizeHint() const +{ + QSize sh = tabSizeHint(true); +// return QSize(sh.width(), sh.height() * mAttachedTabs.count()); + + if(mPosition == Above || mPosition == Below) + return QSize(sh.width() * mAttachedTabs.count(), sh.height()); + else + return QSize(sh.width(), sh.height() * mAttachedTabs.count()); +} + +QRect FancyTabBar2::tabRect(int index) const +{ + QSize sh = tabSizeHint(); + + if(mPosition == Above || mPosition == Below) + { + if (sh.width() * mAttachedTabs.count() > width()) + sh.setWidth(width() / mAttachedTabs.count()); + + return QRect(index * sh.width(), 0, sh.width(), sh.height()); + } + else + { + if (sh.height() * mAttachedTabs.count() > height()) + sh.setHeight(height() / mAttachedTabs.count()); + + return QRect(0, index * sh.height(), sh.width(), sh.height()); + } + +} + +// This keeps the sidebar responsive since +// we get a repaint before loading the +// mode itself +void FancyTabBar2::emitCurrentIndex() +{ + emit currentChanged(mCurrentIndex); +} + +void FancyTabBar2::mousePressEvent(QMouseEvent *e) +{ + e->accept(); + for (int index = 0; index < mAttachedTabs.count(); ++index) + { + if (tabRect(index).contains(e->pos())) + { + if (isTabEnabled(index)) + { + mCurrentIndex = index; + update(); + mTimerTriggerChangedSignal.start(0); + } + break; + } + } +} + +void FancyTabBar2::paintTab(QPainter *painter, int tabIndex) const +{ + if (!validIndex(tabIndex)) + { + qWarning("invalid index"); + return; + } + painter->save(); + + QRect rect = tabRect(tabIndex); + bool selected = (tabIndex == mCurrentIndex); + bool enabled = isTabEnabled(tabIndex); + + if(selected) + { + // background + painter->save(); + QLinearGradient grad(getCorner(rect, OutsideBeginning), getCorner(rect, InsideBeginning)); + grad.setColorAt(0, QColor(255, 255, 255, 140)); + grad.setColorAt(1, QColor(255, 255, 255, 210)); + painter->fillRect(adjustRect(rect, 0, 0, 0, -1), grad); + painter->restore(); + + // shadows (the black lines immediately before/after (active && selected)-backgrounds) + painter->setPen(QColor(0, 0, 0, 110)); + painter->drawLine(adjustPoint(getCorner(rect, OutsideBeginning), 0, -1), adjustPoint(getCorner(rect, InsideBeginning), 0, -1)); + painter->drawLine(getCorner(rect, OutsideEnd), getCorner(rect, InsideEnd)); + + // thin shadow on the outside of active tab + painter->setPen(QColor(0, 0, 0, 40)); + painter->drawLine(getCorner(rect, OutsideBeginning), getCorner(rect, OutsideEnd)); + + // highlights + painter->setPen(QColor(255, 255, 255, 50)); + painter->drawLine(adjustPoint(getCorner(rect, OutsideBeginning), 0, -2), adjustPoint(getCorner(rect, InsideBeginning), 0, -2)); + painter->drawLine(adjustPoint(getCorner(rect, OutsideEnd), 0, 1), adjustPoint(getCorner(rect, InsideEnd), 0, 1)); + + painter->setPen(QColor(255, 255, 255, 40)); + // thin white line towards beginning + painter->drawLine(adjustPoint(getCorner(rect, OutsideBeginning), 0, 0), adjustPoint(getCorner(rect, InsideBeginning), 0, 0)); + // thin white line on inside border + painter->drawLine(adjustPoint(getCorner(rect, InsideBeginning), 0, 1), adjustPoint(getCorner(rect, InsideEnd), 0, -1)); + // thin white line towards end + painter->drawLine(adjustPoint(getCorner(rect, OutsideEnd), 0, -1), adjustPoint(getCorner(rect, InsideEnd), 0, -1)); + } + + QString tabText(this->tabText(tabIndex)); + QRect tabTextRect(rect); + const bool drawIcon = rect.height() > 36; + QRect tabIconRect(tabTextRect); + tabTextRect.translate(0, drawIcon ? -2 : 1); + QFont boldFont(painter->font()); + boldFont.setPointSizeF(StyleHelper::sidebarFontSize()); + boldFont.setBold(true); + painter->setFont(boldFont); + painter->setPen(selected ? QColor(255, 255, 255, 160) : QColor(0, 0, 0, 110)); + const int textFlags = Qt::AlignCenter | (drawIcon ? Qt::AlignBottom : Qt::AlignVCenter) | Qt::TextWordWrap; + if (enabled) { + painter->drawText(tabTextRect, textFlags, tabText); + painter->setPen(selected ? QColor(60, 60, 60) : StyleHelper::panelTextColor()); + } else { + painter->setPen(selected ? StyleHelper::panelTextColor() : QColor(255, 255, 255, 120)); + } + +#if defined(Q_OS_MAC) + bool isMac=true; +#else + bool isMac = false; +#endif + + // hover + if(!isMac && !selected && enabled) + { + painter->save(); + int fader = int(mAttachedTabs[tabIndex]->fader()); + QLinearGradient grad(getCorner(rect, OutsideBeginning), getCorner(rect, InsideBeginning)); + + grad.setColorAt(0, Qt::transparent); + grad.setColorAt(0.5, QColor(255, 255, 255, fader)); + grad.setColorAt(1, Qt::transparent); + painter->fillRect(rect, grad); + painter->setPen(QPen(grad, 1.0)); + + if(mPosition == Above || mPosition == Below) + { + painter->drawLine(rect.topLeft(), rect.bottomLeft()); + painter->drawLine(rect.topRight(), rect.bottomRight()); + } + else + { + painter->drawLine(rect.topLeft(), rect.topRight()); + painter->drawLine(rect.bottomLeft(), rect.bottomRight()); + } + + painter->restore(); + } + + if (!enabled) + painter->setOpacity(0.7); + + if (drawIcon) { + int textHeight = painter->fontMetrics().boundingRect(QRect(0, 0, width(), height()), Qt::TextWordWrap, tabText).height(); + tabIconRect.adjust(0, 4, 0, -textHeight); + StyleHelper::drawIconWithShadow(tabIcon(tabIndex), tabIconRect, painter, enabled ? QIcon::Normal : QIcon::Disabled); + } + + painter->translate(0, -1); + painter->drawText(tabTextRect, textFlags, tabText); + painter->restore(); +} + +void FancyTabBar2::setCurrentIndex(int index) { + if (isTabEnabled(index)) { + mCurrentIndex = index; + update(); + emit currentChanged(mCurrentIndex); + } +} + +void FancyTabBar2::setTabEnabled(int index, bool enable) +{ + Q_ASSERT(index < mAttachedTabs.size()); + Q_ASSERT(index >= 0); + + if (index < mAttachedTabs.size() && index >= 0) { + mAttachedTabs[index]->enabled = enable; + update(tabRect(index)); + } +} + +bool FancyTabBar2::isTabEnabled(int index) const +{ + Q_ASSERT(index < mAttachedTabs.size()); + Q_ASSERT(index >= 0); + + if (index < mAttachedTabs.size() && index >= 0) + return mAttachedTabs[index]->enabled; + + return false; +} diff --git a/BASuite/utils/fancytabbar.h b/BASuite/utils/fancytabbar.h new file mode 100644 index 00000000000..6f0fd865b2b --- /dev/null +++ b/BASuite/utils/fancytabbar.h @@ -0,0 +1,201 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef FANCYTABBAR_H +#define FANCYTABBAR_H + +#include <QIcon> +#include <QWidget> + +#include <QTimer> +#include <QPropertyAnimation> + +class QPainter; + +#include "fancytab.h" + + + +class FancyTabBar : public QWidget +{ + Q_OBJECT + +public: + FancyTabBar(QWidget *parent = 0); + ~FancyTabBar(); + + bool event(QEvent *event); + + void paintEvent(QPaintEvent *event); + void paintTab(QPainter *painter, int tabIndex) const; + void mousePressEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void enterEvent(QEvent *); + void leaveEvent(QEvent *); + bool validIndex(int index) const { return index >= 0 && index < m_tabs.count(); } + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + void setTabEnabled(int index, bool enable); + bool isTabEnabled(int index) const; + + void insertTab(int index, const QIcon &icon, const QString &label) { + FancyTab *tab = new FancyTab(this); + tab->icon = icon; + tab->text = label; + m_tabs.insert(index, tab); + } + void setEnabled(int index, bool enabled); + void removeTab(int index) { + FancyTab *tab = m_tabs.takeAt(index); + delete tab; + } + void setCurrentIndex(int index); + int currentIndex() const { return m_currentIndex; } + + void setTabToolTip(int index, QString toolTip) { m_tabs[index]->toolTip = toolTip; } + QString tabToolTip(int index) const { return m_tabs.at(index)->toolTip; } + + QIcon tabIcon(int index) const { return m_tabs.at(index)->icon; } + QString tabText(int index) const { return m_tabs.at(index)->text; } + int count() const {return m_tabs.count(); } + QRect tabRect(int index) const; + +signals: + void currentChanged(int); + +public slots: + void emitCurrentIndex(); + +private: + static const int m_rounding; + static const int m_textPadding; + QRect m_hoverRect; + int m_hoverIndex; + int m_currentIndex; + QList<FancyTab*> m_tabs; + QTimer m_triggerTimer; + QSize tabSizeHint(bool minimum = false) const; + +}; + + + +class FancyTabBar2 : public QWidget +{ + Q_OBJECT + +public: +// enum struct TabBarPosition { Above, Below, Left, Right }; +// struct TabBarPosition { +// enum keys {Above, Below, Left, Right }; +// }; + enum TabBarPosition { Above, Below, Left, Right }; + + FancyTabBar2(QWidget *parent = 0, TabBarPosition position=Left ); + ~FancyTabBar2(); + + + bool event(QEvent *event); + + void paintEvent(QPaintEvent *event); + void paintTab(QPainter *painter, int tabIndex) const; + void mousePressEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void enterEvent(QEvent *); + void leaveEvent(QEvent *); + bool validIndex(int index) const { return index >= 0 && index < mAttachedTabs.count(); } + + void setOrientation(const TabBarPosition p) {mPosition = p;} + QSize sizeHint() const; + QSize minimumSizeHint() const; + + void setTabEnabled(int index, bool enable); + bool isTabEnabled(int index) const; + + void insertTab(int index, const QIcon &icon, const QString &label) { + FancyTab *tab = new FancyTab(this); + tab->icon = icon; + tab->text = label; + mAttachedTabs.insert(index, tab); + } + + void removeTab(int index) { + FancyTab *tab = mAttachedTabs.takeAt(index); + delete tab; + } + void setCurrentIndex(int index); + int currentIndex() const { return mCurrentIndex; } + + void setTabToolTip(int index, QString toolTip) { mAttachedTabs[index]->toolTip = toolTip; } + QString tabToolTip(int index) const { return mAttachedTabs.at(index)->toolTip; } + + QIcon tabIcon(int index) const { return mAttachedTabs.at(index)->icon; } + QString tabText(int index) const { return mAttachedTabs.at(index)->text; } + int count() const {return mAttachedTabs.count(); } + QRect tabRect(int index) const; + +signals: + void currentChanged(int); + +public slots: + void emitCurrentIndex(); + +private: + //enum struct Corner { OutsideBeginning, OutsideEnd, InsideBeginning, InsideEnd }; + enum Corner { OutsideBeginning, OutsideEnd, InsideBeginning, InsideEnd }; + QPoint getCorner(const QRect& rect, const Corner corner) const; + + // You can pass this method a QRect and tell it to move its edges to the outside (+) + // or inside (-) of the rect. For example, with a TabBar at the Above, + // + // adjustRect(QRect(0,0,10,10), 1, 2, 3, -4) // thats a 10 by 10 QRect, starting at 0/0 + // + // gives + // + // QRect(-3, -1, 9, 13) // 9 by 13 rect, starting at -3/-1. + QRect adjustRect(const QRect& rect, const qint8 offsetOutside, const qint8 offsetInside, const qint8 offsetStart, const qint8 offsetEnd) const; + + // Same with a point. + means towards Outside/End, - means towards Inside/Beginning + QPoint adjustPoint(const QPoint& point, const qint8 offsetInsideOutside, const qint8 offsetBeginningEnd) const; + + TabBarPosition mPosition; + static const int m_rounding; + static const int m_textPadding; + QRect mHoverRect; + int mHoverIndex; + int mCurrentIndex; + QList<FancyTab*> mAttachedTabs; + QTimer mTimerTriggerChangedSignal; + QSize tabSizeHint(bool minimum = false) const; + +}; + +#endif // FANCYTABWIDGET_H diff --git a/BASuite/utils/stylehelper.cpp b/BASuite/utils/stylehelper.cpp new file mode 100644 index 00000000000..1a2a563e4b9 --- /dev/null +++ b/BASuite/utils/stylehelper.cpp @@ -0,0 +1,647 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + + + +#include "stylehelper.h" + +#include <QPixmapCache> +#include <QWidget> +#include <QRect> +#include <QPainter> +#include <QApplication> +#include <QPalette> +#include <QStyleOption> +#include <QObject> + +// Clamps float color values within (0, 255) +static int clamp(float x) +{ + const int val = x > 255 ? 255 : static_cast<int>(x); + return val < 0 ? 0 : val; +} + +// Clamps float color values within (0, 255) +/* +static int range(float x, int min, int max) +{ + int val = x > max ? max : x; + return val < min ? min : val; +} +*/ + +QColor StyleHelper::mergedColors(const QColor &colorA, const QColor &colorB, int factor) +{ + const int maxFactor = 100; + QColor tmp = colorA; + tmp.setRed((tmp.red() * factor) / maxFactor + (colorB.red() * (maxFactor - factor)) / maxFactor); + tmp.setGreen((tmp.green() * factor) / maxFactor + (colorB.green() * (maxFactor - factor)) / maxFactor); + tmp.setBlue((tmp.blue() * factor) / maxFactor + (colorB.blue() * (maxFactor - factor)) / maxFactor); + return tmp; +} + +qreal StyleHelper::sidebarFontSize() +{ +#if defined(Q_OS_MAC) + return 10; +#else + return 7.5; +#endif +} + +QPalette StyleHelper::sidebarFontPalette(const QPalette &original) +{ + QPalette palette = original; + palette.setColor(QPalette::Active, QPalette::Text, panelTextColor()); + palette.setColor(QPalette::Active, QPalette::WindowText, panelTextColor()); + palette.setColor(QPalette::Inactive, QPalette::Text, panelTextColor().darker()); + palette.setColor(QPalette::Inactive, QPalette::WindowText, panelTextColor().darker()); + return palette; +} + +QColor StyleHelper::panelTextColor(bool lightColored) +{ + //qApp->palette().highlightedText().color(); + if (!lightColored) + return Qt::white; + else + return Qt::black; +} + +// Invalid by default, setBaseColor needs to be called at least once +QColor StyleHelper::m_baseColor; +QColor StyleHelper::m_requestedBaseColor; + +QColor StyleHelper::baseColor(bool lightColored) +{ + if (!lightColored) + return m_baseColor; + else + return m_baseColor.lighter(230); +} + +QColor StyleHelper::highlightColor(bool lightColored) +{ + QColor result = baseColor(lightColored); + if (!lightColored) + result.setHsv(result.hue(), + clamp(result.saturation()), + clamp(result.value() * 1.16)); + else + result.setHsv(result.hue(), + clamp(result.saturation()), + clamp(result.value() * 1.06)); + return result; +} + +QColor StyleHelper::shadowColor(bool lightColored) +{ + QColor result = baseColor(lightColored); + result.setHsv(result.hue(), + clamp(result.saturation() * 1.1), + clamp(result.value() * 0.70)); + return result; +} + +QColor StyleHelper::borderColor(bool lightColored) +{ + QColor result = baseColor(lightColored); + result.setHsv(result.hue(), + result.saturation(), + result.value() / 2); + return result; +} + +// We try to ensure that the actual color used are within +// reasonalbe bounds while generating the actual baseColor +// from the users request. +void StyleHelper::setBaseColor(const QColor &newcolor) +{ + m_requestedBaseColor = newcolor; + + QColor color; + color.setHsv(newcolor.hue(), + newcolor.saturation() * 0.7, + 64 + newcolor.value() / 3); + + if (color.isValid() && color != m_baseColor) { + m_baseColor = color; + foreach (QWidget *w, QApplication::topLevelWidgets()) + w->update(); + } +} + +static void verticalGradientHelper(QPainter *p, const QRect &spanRect, const QRect &rect, bool lightColored) +{ + QColor highlight = StyleHelper::highlightColor(lightColored); + QColor shadow = StyleHelper::shadowColor(lightColored); + QLinearGradient grad(spanRect.topRight(), spanRect.topLeft()); + grad.setColorAt(0, highlight.lighter(117)); + grad.setColorAt(1, shadow.darker(109)); + p->fillRect(rect, grad); + + QColor light(255, 255, 255, 80); + p->setPen(light); + p->drawLine(rect.topRight() - QPoint(1, 0), rect.bottomRight() - QPoint(1, 0)); + QColor dark(0, 0, 0, 90); + p->setPen(dark); + p->drawLine(rect.topLeft(), rect.bottomLeft()); +} + +void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored) +{ + if (StyleHelper::usePixmapCache()) { + QString key; + QColor keyColor = baseColor(lightColored); + key.sprintf("mh_vertical %d %d %d %d %d", + spanRect.width(), spanRect.height(), clipRect.width(), + clipRect.height(), keyColor.rgb());; + + QPixmap pixmap; + if (!QPixmapCache::find(key, pixmap)) { + pixmap = QPixmap(clipRect.size()); + QPainter p(&pixmap); + QRect rect(0, 0, clipRect.width(), clipRect.height()); + verticalGradientHelper(&p, spanRect, rect, lightColored); + p.end(); + QPixmapCache::insert(key, pixmap); + } + + painter->drawPixmap(clipRect.topLeft(), pixmap); + } else { + verticalGradientHelper(painter, spanRect, clipRect, lightColored); + } +} + +static void horizontalGradientHelper(QPainter *p, const QRect &spanRect, const +QRect &rect, bool lightColored) +{ + if (lightColored) { + QLinearGradient shadowGradient(rect.topLeft(), rect.bottomLeft()); + shadowGradient.setColorAt(0, 0xf0f0f0); + shadowGradient.setColorAt(1, 0xcfcfcf); + p->fillRect(rect, shadowGradient); + return; + } + + QColor base = StyleHelper::baseColor(lightColored); + QColor highlight = StyleHelper::highlightColor(lightColored); + QColor shadow = StyleHelper::shadowColor(lightColored); + QLinearGradient grad(rect.topLeft(), rect.bottomLeft()); + grad.setColorAt(0, highlight.lighter(120)); + if (rect.height() == StyleHelper::navigationWidgetHeight()) { + grad.setColorAt(0.4, highlight); + grad.setColorAt(0.401, base); + } + grad.setColorAt(1, shadow); + p->fillRect(rect, grad); + + QLinearGradient shadowGradient(spanRect.topLeft(), spanRect.topRight()); + shadowGradient.setColorAt(0, QColor(0, 0, 0, 30)); + QColor lighterHighlight; + lighterHighlight = highlight.lighter(130); + lighterHighlight.setAlpha(100); + shadowGradient.setColorAt(0.7, lighterHighlight); + shadowGradient.setColorAt(1, QColor(0, 0, 0, 40)); + p->fillRect(rect, shadowGradient); +} + +void StyleHelper::horizontalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored) +{ + if (StyleHelper::usePixmapCache()) { + QString key; + QColor keyColor = baseColor(lightColored); + key.sprintf("mh_horizontal %d %d %d %d %d %d", + spanRect.width(), spanRect.height(), clipRect.width(), + clipRect.height(), keyColor.rgb(), spanRect.x()); + + QPixmap pixmap; + if (!QPixmapCache::find(key, pixmap)) { + pixmap = QPixmap(clipRect.size()); + QPainter p(&pixmap); + QRect rect = QRect(0, 0, clipRect.width(), clipRect.height()); + horizontalGradientHelper(&p, spanRect, rect, lightColored); + p.end(); + QPixmapCache::insert(key, pixmap); + } + + painter->drawPixmap(clipRect.topLeft(), pixmap); + + } else { + horizontalGradientHelper(painter, spanRect, clipRect, lightColored); + } +} + +static void menuGradientHelper(QPainter *p, const QRect &spanRect, const QRect &rect) +{ + QLinearGradient grad(spanRect.topLeft(), spanRect.bottomLeft()); + QColor menuColor = StyleHelper::mergedColors(StyleHelper::baseColor(), QColor(244, 244, 244), 25); + grad.setColorAt(0, menuColor.lighter(112)); + grad.setColorAt(1, menuColor); + p->fillRect(rect, grad); +} + +void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter, const QStyleOption *option) +{ + // From windowsstyle but modified to enable AA + if (option->rect.width() <= 1 || option->rect.height() <= 1) + return; + + QRect r = option->rect; + int size = qMin(r.height(), r.width()); + QPixmap pixmap; + QString pixmapName; + pixmapName.sprintf("arrow-%s-%d-%d-%d-%lld", + "$qt_ia", + uint(option->state), element, + size, option->palette.cacheKey()); + if (!QPixmapCache::find(pixmapName, pixmap)) { + int border = size/5; + int sqsize = 2*(size/2); + QImage image(sqsize, sqsize, QImage::Format_ARGB32); + image.fill(Qt::transparent); + QPainter imagePainter(&image); + imagePainter.setRenderHint(QPainter::Antialiasing, true); + imagePainter.translate(0.5, 0.5); + QPolygon a; + switch (element) { + case QStyle::PE_IndicatorArrowUp: + a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize - border, sqsize/2); + break; + case QStyle::PE_IndicatorArrowDown: + a.setPoints(3, border, sqsize/2, sqsize/2, sqsize - border, sqsize - border, sqsize/2); + break; + case QStyle::PE_IndicatorArrowRight: + a.setPoints(3, sqsize - border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border); + break; + case QStyle::PE_IndicatorArrowLeft: + a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border); + break; + default: + break; + } + + int bsx = 0; + int bsy = 0; + + if (option->state & QStyle::State_Sunken) { + bsx = qApp->style()->pixelMetric(QStyle::PM_ButtonShiftHorizontal); + bsy = qApp->style()->pixelMetric(QStyle::PM_ButtonShiftVertical); + } + + QRect bounds = a.boundingRect(); + int sx = sqsize / 2 - bounds.center().x() - 1; + int sy = sqsize / 2 - bounds.center().y() - 1; + imagePainter.translate(sx + bsx, sy + bsy); + + if (!(option->state & QStyle::State_Enabled)) { + QColor foreGround(150, 150, 150, 150); + imagePainter.setBrush(option->palette.mid().color()); + imagePainter.setPen(option->palette.mid().color()); + } else { + QColor shadow(0, 0, 0, 100); + imagePainter.translate(0, 1); + imagePainter.setPen(shadow); + imagePainter.setBrush(shadow); + QColor foreGround(255, 255, 255, 210); + imagePainter.drawPolygon(a); + imagePainter.translate(0, -1); + imagePainter.setPen(foreGround); + imagePainter.setBrush(foreGround); + } + imagePainter.drawPolygon(a); + imagePainter.end(); + pixmap = QPixmap::fromImage(image); + QPixmapCache::insert(pixmapName, pixmap); + } + int xOffset = r.x() + (r.width() - size)/2; + int yOffset = r.y() + (r.height() - size)/2; + painter->drawPixmap(xOffset, yOffset, pixmap); +} + +void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect) +{ + if (StyleHelper::usePixmapCache()) { + QString key; + key.sprintf("mh_menu %d %d %d %d %d", + spanRect.width(), spanRect.height(), clipRect.width(), + clipRect.height(), StyleHelper::baseColor().rgb()); + + QPixmap pixmap; + if (!QPixmapCache::find(key, pixmap)) { + pixmap = QPixmap(clipRect.size()); + QPainter p(&pixmap); + QRect rect = QRect(0, 0, clipRect.width(), clipRect.height()); + menuGradientHelper(&p, spanRect, rect); + p.end(); + QPixmapCache::insert(key, pixmap); + } + + painter->drawPixmap(clipRect.topLeft(), pixmap); + } else { + menuGradientHelper(painter, spanRect, clipRect); + } +} + +// Draws a cached pixmap with shadow +void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect, + QPainter *p, QIcon::Mode iconMode, int radius, const QColor &color, const QPoint &offset) +{ + QPixmap cache; + QString pixmapName = QString::fromLatin1("icon %0 %1 %2").arg(icon.cacheKey()).arg(iconMode).arg(rect.height()); + + if (!QPixmapCache::find(pixmapName, cache)) { + QPixmap px = icon.pixmap(rect.size()); + cache = QPixmap(px.size() + QSize(radius * 2, radius * 2)); + cache.fill(Qt::transparent); + + QPainter cachePainter(&cache); + if (iconMode == QIcon::Disabled) { + QImage im = px.toImage().convertToFormat(QImage::Format_ARGB32); + for (int y=0; y<im.height(); ++y) { + QRgb *scanLine = (QRgb*)im.scanLine(y); + for (int x=0; x<im.width(); ++x) { + QRgb pixel = *scanLine; + char intensity = qGray(pixel); + *scanLine = qRgba(intensity, intensity, intensity, qAlpha(pixel)); + ++scanLine; + } + } + px = QPixmap::fromImage(im); + } + + // Draw shadow + QImage tmp(px.size() + QSize(radius * 2, radius * 2 + 1), QImage::Format_ARGB32_Premultiplied); + tmp.fill(Qt::transparent); + + QPainter tmpPainter(&tmp); + tmpPainter.setCompositionMode(QPainter::CompositionMode_Source); + tmpPainter.drawPixmap(QPoint(radius, radius), px); + tmpPainter.end(); + + // blur the alpha channel + QImage blurred(tmp.size(), QImage::Format_ARGB32_Premultiplied); + blurred.fill(Qt::transparent); + QPainter blurPainter(&blurred); + qt_blurImage(&blurPainter, tmp, radius, false, true); + blurPainter.end(); + + tmp = blurred; + + // blacken the image... + tmpPainter.begin(&tmp); + tmpPainter.setCompositionMode(QPainter::CompositionMode_SourceIn); + tmpPainter.fillRect(tmp.rect(), color); + tmpPainter.end(); + + tmpPainter.begin(&tmp); + tmpPainter.setCompositionMode(QPainter::CompositionMode_SourceIn); + tmpPainter.fillRect(tmp.rect(), color); + tmpPainter.end(); + + // draw the blurred drop shadow... + cachePainter.drawImage(QRect(0, 0, cache.rect().width(), cache.rect().height()), tmp); + + // Draw the actual pixmap... + cachePainter.drawPixmap(QPoint(radius, radius) + offset, px); + QPixmapCache::insert(pixmapName, cache); + } + + QRect targetRect = cache.rect(); + targetRect.moveCenter(rect.center()); + p->drawPixmap(targetRect.topLeft() - offset, cache); +} + +// Draws a CSS-like border image where the defined borders are not stretched +void StyleHelper::drawCornerImage(const QImage &img, QPainter *painter, QRect rect, + int left, int top, int right, int bottom) +{ + QSize size = img.size(); + if (top > 0) { //top + painter->drawImage(QRect(rect.left() + left, rect.top(), rect.width() -right - left, top), img, + QRect(left, 0, size.width() -right - left, top)); + if (left > 0) //top-left + painter->drawImage(QRect(rect.left(), rect.top(), left, top), img, + QRect(0, 0, left, top)); + if (right > 0) //top-right + painter->drawImage(QRect(rect.left() + rect.width() - right, rect.top(), right, top), img, + QRect(size.width() - right, 0, right, top)); + } + //left + if (left > 0) + painter->drawImage(QRect(rect.left(), rect.top()+top, left, rect.height() - top - bottom), img, + QRect(0, top, left, size.height() - bottom - top)); + //center + painter->drawImage(QRect(rect.left() + left, rect.top()+top, rect.width() -right - left, + rect.height() - bottom - top), img, + QRect(left, top, size.width() -right -left, + size.height() - bottom - top)); + if (right > 0) //right + painter->drawImage(QRect(rect.left() +rect.width() - right, rect.top()+top, right, rect.height() - top - bottom), img, + QRect(size.width() - right, top, right, size.height() - bottom - top)); + if (bottom > 0) { //bottom + painter->drawImage(QRect(rect.left() +left, rect.top() + rect.height() - bottom, + rect.width() - right - left, bottom), img, + QRect(left, size.height() - bottom, + size.width() - right - left, bottom)); + if (left > 0) //bottom-left + painter->drawImage(QRect(rect.left(), rect.top() + rect.height() - bottom, left, bottom), img, + QRect(0, size.height() - bottom, left, bottom)); + if (right > 0) //bottom-right + painter->drawImage(QRect(rect.left() + rect.width() - right, rect.top() + rect.height() - bottom, right, bottom), img, + QRect(size.width() - right, size.height() - bottom, right, bottom)); + } +} + +// Tints an image with tintColor, while preserving alpha and lightness +void StyleHelper::tintImage(QImage &img, const QColor &tintColor) +{ + QPainter p(&img); + p.setCompositionMode(QPainter::CompositionMode_Screen); + + for (int x = 0; x < img.width(); ++x) { + for (int y = 0; y < img.height(); ++y) { + QRgb rgbColor = img.pixel(x, y); + int alpha = qAlpha(rgbColor); + QColor c = QColor(rgbColor); + + if (alpha > 0) { + c.toHsl(); + qreal l = c.lightnessF(); + QColor newColor = QColor::fromHslF(tintColor.hslHueF(), tintColor.hslSaturationF(), l); + newColor.setAlpha(alpha); + img.setPixel(x, y, newColor.rgba()); + } + } + } +} + + + + + + +//#include "stylehelper.h" + +//#include <QPixmapCache> +//#include <QWidget> +//#include <QRect> +//#include <QPainter> +//#include <QApplication> +//#include <QPalette> +//#include <QStyleOption> +//#include <QObject> + +//qreal StyleHelper::sidebarFontSize() +//{ +//#if defined(Q_OS_MAC) +// return 10; +//#else +// return 7.5; +//#endif +//} + +//QColor StyleHelper::panelTextColor(bool lightColored) +//{ +// //qApp->palette().highlightedText().color(); +// if (!lightColored) +// return Qt::white; +// else +// return Qt::black; +//} + +//// Invalid by default, setBaseColor needs to be called at least once +//QColor StyleHelper::m_baseColor; +//QColor StyleHelper::m_requestedBaseColor; + +//QColor StyleHelper::baseColor(bool lightColored) +//{ +// if (!lightColored) +// return m_baseColor; +// else +// return m_baseColor.lighter(230); +//} + +//QColor StyleHelper::borderColor(bool lightColored) +//{ +// QColor result = baseColor(lightColored); +// result.setHsv(result.hue(), +// result.saturation(), +// result.value() / 2); +// return result; +//} + +//// We try to ensure that the actual color used are within +//// reasonalbe bounds while generating the actual baseColor +//// from the users request. +//void StyleHelper::setBaseColor(const QColor &newcolor) +//{ +// m_requestedBaseColor = newcolor; + +// QColor color; +// color.setHsv(newcolor.hue(), +// newcolor.saturation() * 0.7, +// 64 + newcolor.value() / 3); + +// if (color.isValid() && color != m_baseColor) { +// m_baseColor = color; +// foreach (QWidget *w, QApplication::topLevelWidgets()) +// w->update(); +// } +//} + + +//// Draws a cached pixmap with shadow +//void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect, +// QPainter *p, QIcon::Mode iconMode, int radius, const QColor &color, const QPoint &offset) +//{ +// QPixmap cache; +// QString pixmapName = QString::fromLatin1("icon %0 %1 %2").arg(icon.cacheKey()).arg(iconMode).arg(rect.height()); + +// if (!QPixmapCache::find(pixmapName, cache)) { +// QPixmap px = icon.pixmap(rect.size()); +// cache = QPixmap(px.size() + QSize(radius * 2, radius * 2)); +// cache.fill(Qt::transparent); + +// QPainter cachePainter(&cache); +// if (iconMode == QIcon::Disabled) { +// QImage im = px.toImage().convertToFormat(QImage::Format_ARGB32); +// for (int y=0; y<im.height(); ++y) { +// QRgb *scanLine = (QRgb*)im.scanLine(y); +// for (int x=0; x<im.width(); ++x) { +// QRgb pixel = *scanLine; +// char intensity = qGray(pixel); +// *scanLine = qRgba(intensity, intensity, intensity, qAlpha(pixel)); +// ++scanLine; +// } +// } +// px = QPixmap::fromImage(im); +// } + +// // Draw shadow +// QImage tmp(px.size() + QSize(radius * 2, radius * 2 + 1), QImage::Format_ARGB32_Premultiplied); +// tmp.fill(Qt::transparent); + +// QPainter tmpPainter(&tmp); +// tmpPainter.setCompositionMode(QPainter::CompositionMode_Source); +// tmpPainter.drawPixmap(QPoint(radius, radius), px); +// tmpPainter.end(); + +// // blur the alpha channel +// QImage blurred(tmp.size(), QImage::Format_ARGB32_Premultiplied); +// blurred.fill(Qt::transparent); +// QPainter blurPainter(&blurred); +// qt_blurImage(&blurPainter, tmp, radius, false, true); +// blurPainter.end(); + +// tmp = blurred; + +// // blacken the image... +// tmpPainter.begin(&tmp); +// tmpPainter.setCompositionMode(QPainter::CompositionMode_SourceIn); +// tmpPainter.fillRect(tmp.rect(), color); +// tmpPainter.end(); + +// tmpPainter.begin(&tmp); +// tmpPainter.setCompositionMode(QPainter::CompositionMode_SourceIn); +// tmpPainter.fillRect(tmp.rect(), color); +// tmpPainter.end(); + +// // draw the blurred drop shadow... +// cachePainter.drawImage(QRect(0, 0, cache.rect().width(), cache.rect().height()), tmp); + +// // Draw the actual pixmap... +// cachePainter.drawPixmap(QPoint(radius, radius) + offset, px); +// QPixmapCache::insert(pixmapName, cache); +// } + +// QRect targetRect = cache.rect(); +// targetRect.moveCenter(rect.center()); +// p->drawPixmap(targetRect.topLeft() - offset, cache); +//} diff --git a/BASuite/utils/stylehelper.h b/BASuite/utils/stylehelper.h new file mode 100644 index 00000000000..7db6f8a1ea8 --- /dev/null +++ b/BASuite/utils/stylehelper.h @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef STYLEHELPER_H +#define STYLEHELPER_H + + +#include <QColor> +#include <QStyle> + +class QPalette; +class QPainter; +class QRect; +void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed = 0); + +class StyleHelper +{ +public: + static const unsigned int DEFAULT_BASE_COLOR = 0x666666; + + // Height of the project explorer navigation bar + static int navigationWidgetHeight() { return 24; } + static qreal sidebarFontSize(); + static QPalette sidebarFontPalette(const QPalette &original); + + // This is our color table, all colors derive from baseColor + static QColor requestedBaseColor() { return m_requestedBaseColor; } + static QColor baseColor(bool lightColored = false); + static QColor panelTextColor(bool lightColored = false); + static QColor highlightColor(bool lightColored = false); + static QColor shadowColor(bool lightColored = false); + static QColor borderColor(bool lightColored = false); + static QColor buttonTextColor() { return QColor(0x4c4c4c); } + static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50); + + static QColor sidebarHighlight() { return QColor(255, 255, 255, 40); } + static QColor sidebarShadow() { return QColor(0, 0, 0, 40); } + + // Sets the base color and makes sure all top level widgets are updated + static void setBaseColor(const QColor &color); + + // Draws a shaded anti-aliased arrow + static void drawArrow(QStyle::PrimitiveElement element, QPainter *painter, const QStyleOption *option); + + // Gradients used for panels + static void horizontalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored = false); + static void verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored = false); + static void menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect); + static bool usePixmapCache() { return true; } + + static void drawIconWithShadow(const QIcon &icon, const QRect &rect, QPainter *p, QIcon::Mode iconMode, + int radius = 3, const QColor &color = QColor(0, 0, 0, 130), + const QPoint &offset = QPoint(1, -2)); + static void drawCornerImage(const QImage &img, QPainter *painter, QRect rect, + int left = 0, int top = 0, int right = 0, int bottom = 0); + + static void tintImage(QImage &img, const QColor &tintColor); + +private: + static QColor m_baseColor; + static QColor m_requestedBaseColor; +}; + + + + + +//#include <QColor> +//#include <QStyle> + +//class QPalette; +//class QPainter; +//class QRect; + +//// Note, this is exported but in a private header as qtopengl depends on it. +//// We should consider adding this as a public helper function. +//void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed = 0); + +//// Helper class holding all custom color values +//class StyleHelper +//{ +//public: +// static const unsigned int DEFAULT_BASE_COLOR = 0x666666; + +// static qreal sidebarFontSize(); +// // This is our color table, all colors derive from baseColor +// static QColor baseColor(bool lightColored = false); +// static QColor panelTextColor(bool lightColored = false); +// static QColor borderColor(bool lightColored = false); +// static QColor sidebarHighlight() { return QColor(255, 255, 255, 40); } + +// // Sets the base color and makes sure all top level widgets are updated +// static void setBaseColor(const QColor &color); +// static void drawIconWithShadow(const QIcon &icon, const QRect &rect, QPainter *p, QIcon::Mode iconMode, int radius = 3, const QColor &color = QColor(0, 0, 0, 130), const QPoint &offset = QPoint(1, -2)); + +// static QColor requestedBaseColor() { return m_requestedBaseColor; } +//private: +// static QColor m_baseColor; +// static QColor m_requestedBaseColor; +//}; + +#endif // STYLEHELPER_H diff --git a/BASuite/welcomemanager/welcomemanager.cpp b/BASuite/welcomemanager/welcomemanager.cpp new file mode 100644 index 00000000000..f7c7315f927 --- /dev/null +++ b/BASuite/welcomemanager/welcomemanager.cpp @@ -0,0 +1,30 @@ +#include "welcomemanager.h" +#include <QtWidgets> + +WelcomeManager::WelcomeManager(QWidget *parent) + : QWidget(parent) +{ + QGroupBox *configGroup = new QGroupBox(tr("Server configuration")); + + QLabel *serverLabel = new QLabel(tr("Server:")); + QComboBox *serverCombo = new QComboBox; + serverCombo->addItem(tr("Qt (Australia)")); + serverCombo->addItem(tr("Qt (Germany)")); + serverCombo->addItem(tr("Qt (Norway)")); + serverCombo->addItem(tr("Qt (People's Republic of China)")); + serverCombo->addItem(tr("Qt (USA)")); + + QHBoxLayout *serverLayout = new QHBoxLayout; + serverLayout->addWidget(serverLabel); + serverLayout->addWidget(serverCombo); + + QVBoxLayout *configLayout = new QVBoxLayout; + configLayout->addLayout(serverLayout); + configGroup->setLayout(configLayout); + + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addWidget(configGroup); + mainLayout->addStretch(1); + setLayout(mainLayout); +} + diff --git a/BASuite/welcomemanager/welcomemanager.h b/BASuite/welcomemanager/welcomemanager.h new file mode 100644 index 00000000000..1bf340e2be3 --- /dev/null +++ b/BASuite/welcomemanager/welcomemanager.h @@ -0,0 +1,13 @@ +#ifndef WELCOMEMANAGER_H +#define WELCOMEMANAGER_H + +#include <QWidget> + +class WelcomeManager : public QWidget +{ +public: + WelcomeManager(QWidget *parent = 0); + +}; + +#endif // WELCOMEMANAGER_H -- GitLab