Skip to content
Snippets Groups Projects
Commit 41c8fa41 authored by pospelov's avatar pospelov
Browse files

First gui prototype

parent d38f29d2
No related branches found
No related tags found
No related merge requests found
#ifndef SAMPLEMANAGER_H
#define SAMPLEMANAGER_H
#include <QWidget>
class SampleManager : public QWidget
{
public:
SampleManager(QWidget *parent = 0);
};
#endif // SAMPLEMANAGER_H
#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);
}
#ifndef SIMULATIONMANAGER_H
#define SIMULATIONMANAGER_H
#include <QWidget>
class SimulationManager : public QWidget
{
public:
SimulationManager(QWidget *parent = 0);
};
#endif // SIMULATIONMANAGER_H
/****************************************************************************
**
** 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();
}
/****************************************************************************
**
** 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
This diff is collapsed.
/****************************************************************************
**
** 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
This diff is collapsed.
/****************************************************************************
**
** 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
#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);
}
#ifndef WELCOMEMANAGER_H
#define WELCOMEMANAGER_H
#include <QWidget>
class WelcomeManager : public QWidget
{
public:
WelcomeManager(QWidget *parent = 0);
};
#endif // WELCOMEMANAGER_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment