Ejemplo n.º 1
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    this->setWindowFlags( Qt::FramelessWindowHint );

    tasks = new Tasks();
    tasks->construct();

    trayIcon = new TrayIcon( this );

    QVBoxLayout *layout = new QVBoxLayout( this );
    layout->addWidget( tasks->getTasksWidget() );

    QWidget *wid = new QWidget( this );
//    wid->setContentsMargins( -10, -10, -10, -10 );
    this->setStyleSheet( /*"border: 4px solid red;"*/
                         "border-radius: 6px;");
    setCentralWidget( wid );
    wid->setLayout( layout );
    wid->setStyleSheet( baseColor );

    tasks->addTask( "test", 7 );
    tasks->addTask( "test", 7 );
    tasks->addTask( "test", 7 );
    tasks->removeTask( 2 );
    tasks->addTask( "test", 7 );

    connect( trayIcon, SIGNAL( quitPressed() ), this, SLOT( close() ) );

}
Ejemplo n.º 2
0
PathDeformWidget::PathDeformWidget(QWidget *parent, bool smallScreen)
    : QWidget(parent)
{
    setWindowTitle(tr("Vector Deformation"));

    m_renderer = new PathDeformRenderer(this, smallScreen);
    m_renderer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    // Layouts
    QHBoxLayout *mainLayout = new QHBoxLayout(this);
    mainLayout->addWidget(m_renderer);

    m_controls = new PathDeformControls(0, m_renderer, smallScreen);
    m_controls->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);

    if (!smallScreen)
        mainLayout->addWidget(m_controls);

    m_renderer->loadSourceFile(":res/deform/pathdeform.cpp");
    m_renderer->loadDescription(":res/deform/pathdeform.html");
    m_renderer->setDescriptionEnabled(false);

    connect(m_renderer, SIGNAL(clicked()), this, SLOT(showControls()));
    connect(m_controls, SIGNAL(okPressed()), this, SLOT(hideControls()));
    connect(m_controls, SIGNAL(quitPressed()), QApplication::instance(), SLOT(quit()));
}
Ejemplo n.º 3
0
StartScreen::StartScreen(QWidget *parent) :
    QFrame(parent)
{
    qDebug() << "Building start screen...";
    setStyleSheet("StartScreen {background-image: url(:/backgrounds/start_new.png); background-color: black;}");

        QVBoxLayout *layout = new QVBoxLayout();
        setLayout(layout);

        ShinyButton *buttonPlay     = new ShinyButton("play","big");
        ShinyButton *buttonTraining = new ShinyButton("settings", "big");
        ShinyButton *buttonQuit     = new ShinyButton("quit","big");
        ShinyButton *buttonSimul     = new ShinyButton("simulator","big");

        connect(buttonPlay,     SIGNAL(clicked()), this, SIGNAL(playPressed()));
        connect(buttonTraining, SIGNAL(clicked()), this, SIGNAL(trainingPressed()));
        connect(buttonQuit,     SIGNAL(clicked()), this, SIGNAL(quitPressed()));
        connect(buttonSimul,     SIGNAL(clicked()), this, SIGNAL(simulPressed()));

        layout->setSpacing(0);
        layout->addSpacing(115);
        layout->addWidget(buttonPlay);
        layout->addSpacing(10);
        layout->addWidget(buttonTraining);
        layout->addSpacing(10);
//        layout->addWidget(buttonSimul);
        layout->addWidget(buttonQuit);
        layout->addSpacing(-10);

        SkateLabel *version = new SkateLabel("v 0.8.1","font-family: sans; font-size:14px; color: white;");
        layout->addWidget(version);
}
PathStrokeWidget::PathStrokeWidget(bool smallScreen)
{
    setWindowTitle(tr("Path Stroking"));

    // Widget construction and property setting
    m_renderer = new PathStrokeRenderer(this, smallScreen);

    m_controls = new PathStrokeControls(0, m_renderer, smallScreen);

    // Layouting
    QHBoxLayout *viewLayout = new QHBoxLayout(this);
    viewLayout->addWidget(m_renderer);

    if (!smallScreen)
        viewLayout->addWidget(m_controls);

    m_renderer->loadSourceFile(":res/pathstroke/pathstroke.cpp");
    m_renderer->loadDescription(":res/pathstroke/pathstroke.html");

    connect(m_renderer, SIGNAL(clicked()), this, SLOT(showControls()));
    connect(m_controls, SIGNAL(okPressed()), this, SLOT(hideControls()));
    connect(m_controls, SIGNAL(quitPressed()), QApplication::instance(), SLOT(quit()));
}
void PathStrokeControls::emitQuitSignal()
{
    emit quitPressed();
}
Ejemplo n.º 6
0
void PathDeformControls::emitQuitSignal()
{   emit quitPressed();  }
Ejemplo n.º 7
0
TiltNRoll::TiltNRoll(QWidget *parent)
        : QStackedWidget(parent), m_channel(0), m_embedded(true)
{
    // call TrickManager::instance for initialization
    TrickManager::instance();
    // call SoundPlayer::instance for initialization
    SoundPlayer::instance();

    // start screen (tab 0)
    StartScreen *s0 = new StartScreen();
    addWidget(s0);
    connect(s0, SIGNAL(playPressed()), this, SLOT(onPlay()));
    connect(s0, SIGNAL(trainingPressed()), this, SLOT(onTraining()));
    connect(s0, SIGNAL(quitPressed()), this, SLOT(onQuit()));
    connect(s0, SIGNAL(simulPressed()), this, SLOT(onSimul()));

    // play screen (tab 1)
    PlayScreen *s1 = new PlayScreen();
    connect(s1, SIGNAL(backPressed()), this, SLOT(onStart()));
    connect(s1, SIGNAL(singlePlayerPressed()), this, SLOT(onSingleplayer()));
    addWidget(s1);

    // training screen (tab 2)
    //SettingsScreen *s2 = new SettingsScreen();
    //TrainPage *s2 = new TrainPage;
    SettingsPage *s2 = new SettingsPage;
    connect(s2, SIGNAL(backPressed()), this, SLOT(onStart()));
    addWidget(s2);

    // DEBUG
    //addWidget(createGraph());

    // single player screen (tab 3)
    SingleplayerScreen *s3 = new SingleplayerScreen();
    connect(s3, SIGNAL(backPressed()), this, SLOT(onPlay()));
    connect(s3, SIGNAL(freestylePressed()), this, SLOT(onFreestyle()));
    connect(s3, SIGNAL(highscorePressed()), this, SLOT(onHighscore()));
    addWidget(s3);

    // freestyle screen (tab 4)
    freestyle_screen = new FreestyleScreen();
    connect(freestyle_screen, SIGNAL(showPauseScreen()), this, SLOT(onPause()));
    connect(s3, SIGNAL(freestylePressed()), freestyle_screen, SLOT(reset()));
    addWidget(freestyle_screen);

    // pause screen (tab 5)
    PauseScreen *s5 = new PauseScreen();
    qDebug("added!");
    connect(s5, SIGNAL(resumePressed()), this, SLOT(onFreestyle()));
    connect(s5, SIGNAL(endGamePressed()), this, SLOT(checkHighscore()));
    addWidget(s5);

    // enter name screen (tab 6)
    EnterNameScreen *s6 = new EnterNameScreen();
    qDebug("added!");
    connect(s6, SIGNAL(nameEntered(QString)), this, SLOT(addToHighscore(QString)));
    addWidget(s6);

    // highscore screen (tab 7)
    HighscoreScreen *s7 = new HighscoreScreen(&hs);
    connect(s7, SIGNAL(backPressed()), this, SLOT(onStart()));
    addWidget(s7);

    // TrickSimulator (tab 8)
    //TrickSimulator* sim = TrickSimulator::instance();
//    BTCapture* sim = BTCapture::instance();
//    connect(sim, SIGNAL(backPressed()), this, SLOT(onStart()));
//    addWidget(sim->widget());

    QSize s(640,360);
    resize(s);
    setMinimumSize(s);
    setMaximumSize(s);
   //setStyle(new QPlastiqueStyle());
    //qApp->setOverrideCursor(Qt::BlankCursor);
    setWindowState(Qt::WindowFullScreen);



    onStart();
}
Ejemplo n.º 8
0
void PathDeformControls::layoutForSmallScreen()
{
    QGroupBox* mainGroup = new QGroupBox(this);
    mainGroup->setTitle(tr("Controls"));

    QLabel *radiusLabel = new QLabel(mainGroup);
    radiusLabel->setText(tr("Lens Radius:"));
    QSlider *radiusSlider = new QSlider(Qt::Horizontal, mainGroup);
    radiusSlider->setRange(15, 150);
    radiusSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

    QLabel *deformLabel = new QLabel(mainGroup);
    deformLabel->setText(tr("Deformation:"));
    QSlider *deformSlider = new QSlider(Qt::Horizontal, mainGroup);
    deformSlider->setRange(-100, 100);
    deformSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

    QLabel *fontSizeLabel = new QLabel(mainGroup);
    fontSizeLabel->setText(tr("Font Size:"));
    QSlider *fontSizeSlider = new QSlider(Qt::Horizontal, mainGroup);
    fontSizeSlider->setRange(16, 200);
    fontSizeSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

    QPushButton *animateButton = new QPushButton(tr("Animated"), mainGroup);
    animateButton->setCheckable(true);

#ifdef QT_OPENGL_SUPPORT
    QPushButton *enableOpenGLButton = new QPushButton(mainGroup);
    enableOpenGLButton->setText(tr("Use OpenGL"));
    enableOpenGLButton->setCheckable(mainGroup);
    enableOpenGLButton->setChecked(m_renderer->usesOpenGL());
    if (!QGLFormat::hasOpenGL())
        enableOpenGLButton->hide();
#endif

    QPushButton *quitButton = new QPushButton(tr("Quit"), mainGroup);
    QPushButton *okButton = new QPushButton(tr("OK"), mainGroup);


    QGridLayout *mainGroupLayout = new QGridLayout(mainGroup);
    mainGroupLayout->setMargin(0);
    mainGroupLayout->addWidget(radiusLabel, 0, 0, Qt::AlignRight);
    mainGroupLayout->addWidget(radiusSlider, 0, 1);
    mainGroupLayout->addWidget(deformLabel, 1, 0, Qt::AlignRight);
    mainGroupLayout->addWidget(deformSlider, 1, 1);
    mainGroupLayout->addWidget(fontSizeLabel, 2, 0, Qt::AlignRight);
    mainGroupLayout->addWidget(fontSizeSlider, 2, 1);
    mainGroupLayout->addWidget(animateButton, 3,0, 1,2);
#ifdef QT_OPENGL_SUPPORT
    mainGroupLayout->addWidget(enableOpenGLButton, 4,0, 1,2);
#endif

    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->addWidget(mainGroup);
    mainLayout->addStretch(1);
    mainLayout->addWidget(okButton);
    mainLayout->addWidget(quitButton);

    connect(quitButton, SIGNAL(clicked()), this, SIGNAL(quitPressed()));
    connect(okButton, SIGNAL(clicked()), this, SIGNAL(okPressed()));
    connect(radiusSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setRadius(int)));
    connect(deformSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setIntensity(int)));
    connect(fontSizeSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setFontSize(int)));
    connect(animateButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setAnimated(bool)));
#ifdef QT_OPENGL_SUPPORT
    connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool)));
#endif


    animateButton->animateClick();
    deformSlider->setValue(80);
    fontSizeSlider->setValue(120);

    QRect screen_size = QApplication::desktop()->screenGeometry();
    radiusSlider->setValue(qMin(screen_size.width(), screen_size.height())/5);

    m_renderer->setText(tr("Qt"));
}