void MainWindow2::makeTimeLineConnections() { connect(m_pTimeLine, SIGNAL(endplayClick()), editor, SLOT(endPlay())); connect(m_pTimeLine, SIGNAL(startplayClick()), editor, SLOT(startPlay())); connect(m_pTimeLine, SIGNAL(duplicateKeyClick()), editor, SLOT(duplicateKey())); connect(m_pTimeLine, SIGNAL(modification()), editor, SLOT(modification())); connect(m_pTimeLine, SIGNAL(addKeyClick()), editor, SLOT(addKey())); connect(m_pTimeLine, SIGNAL(removeKeyClick()), editor, SLOT(removeKey())); connect(m_pTimeLine, SIGNAL(newBitmapLayer()), editor, SLOT(newBitmapLayer())); connect(m_pTimeLine, SIGNAL(newVectorLayer()), editor, SLOT(newVectorLayer())); connect(m_pTimeLine, SIGNAL(newSoundLayer()), editor, SLOT(newSoundLayer())); connect(m_pTimeLine, SIGNAL(newCameraLayer()), editor, SLOT(newCameraLayer())); connect(m_pTimeLine, SIGNAL(deleteCurrentLayer()), editor, SLOT(deleteCurrentLayer())); connect(m_pTimeLine, SIGNAL(playClick()), editor, SLOT(play())); connect(m_pTimeLine, SIGNAL(loopClick(bool)), editor, SLOT(setLoop(bool))); connect(m_pTimeLine, SIGNAL(soundClick()), editor, SLOT(setSound())); connect(m_pTimeLine, SIGNAL(fpsClick(int)), editor, SLOT(changeFps(int))); connect(editor, SIGNAL(toggleLoop(bool)), m_pTimeLine, SIGNAL(toggleLoop(bool))); connect(m_pTimeLine, SIGNAL(loopClick(bool)), editor, SIGNAL(loopToggled(bool))); m_pTimeLine->setFocusPolicy(Qt::NoFocus); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); int x=(qApp->desktop()->width() - this->width())/2; int y=(qApp->desktop()->height() - this->height())/2; // this->setGeometry (x,y,this->width(),this->height()); this->move (x,y); exp.setPattern("[a-zA-Z]"); connect(ui->queryButton,SIGNAL(clicked()),this,SLOT(queryWordClick())); connect(ui->lineEdit,SIGNAL(returnPressed()),this,SLOT(queryWordClick())); connect(ui->backward,SIGNAL(Clicked()),this,SLOT(backwardClick())); connect(ui->frontward,SIGNAL(Clicked()),this,SLOT(frontwardClick())); //connect(qApp->clipboard(),SIGNAL(dataChanged()),this,SLOT(clipboardQuery())); //qDebug()<<qApp->clipboard()->supportsSelection()<<"supportsSelection"; //connect(DICT::shanbayNet,SIGNAL(signalAddwordFinished(bool)),this,SLOT(addWordFinshed(bool))); connect(ui->menuButton,SIGNAL(clicked()),this,SLOT(menuClick())); //QPixmap p(":/pic/logo.png"); //p.save("d:/app.ico"); //ui->pushButton->setIcon(p.copy(32,64,32,32)); //ui->pushButton->setIconSize(QSize(32,32)); //ui->playButton->setText(""); //ui->playButton->setIconSize(QSize(32,32)); //p.copy(32,6,48,48).save("d:/sound1.png"); // ui->playButton->setIcon(QIcon(":/pic/sound1.png")); //ui->playButton->setIcon(QIcon(":/pic/logo.png")); //ui->playButton->setStyleSheet("QPushButton:hover{border-image:url(:/pic/sound2.png)}"); // ui->playButton->setCursor(Qt::OpenHandCursor); dictView=new DictView(this); connect(dictView,SIGNAL(speakClick()),this,SLOT(playClick())); connect(dictView,SIGNAL(addwordClick()),this,SLOT(addWordClick())); connect(dictView,SIGNAL(queryWord(QString)),this,SLOT(query(QString))); connect(dictView,SIGNAL(speakWord(QString)),this,SLOT(speakWord(QString))); ui->centralwidget->setLayout(ui->mainLayout); ui->tab0verticalLayout->addWidget(dictView); ui->tab0->setLayout(ui->tab0verticalLayout); connect(ui->tabWidget,SIGNAL(currentChanged(int)),this,SLOT(tabCurrentChanged(int))); ui->tab1->setLayout(ui->tab1verticalLayout); connect(ui->addExampleButton,SIGNAL(clicked()),this,SLOT(addExampleClick())); connect(DICT::shanbayNet,SIGNAL(signalAddExampleFinished(const QString&)),this,SLOT(addExampleFinished(const QString&))); ui->tab2->setLayout(ui->tab2VerticalLayout); connect(ui->swapButton,SIGNAL(clicked()),this,SLOT(swapClick())); connect(ui->translateButton,SIGNAL(clicked()),this,SLOT(translateClick())); connect(&textTranslateNet,SIGNAL(translateFinshed(QString)),this,SLOT(translateFinshed(QString))); ui->tab3->setLayout(ui->tab3VerticalLayout); connect(ui->wikiWebView,SIGNAL(loadFinished(bool)),this,SLOT(wikiLoadFinshed(bool))); connect(ui->wikiWebView,SIGNAL(urlChanged(QUrl)),this,SLOT(wikiUrlChange(QUrl))); connect(ui->wikiWebView,SIGNAL(loadStarted()),ui->progressBar,SLOT(reset())); connect(ui->wikiWebView,SIGNAL(loadProgress(int)),ui->progressBar,SLOT(setValue(int))); ui->tab4->setLayout(ui->tab4VerticalLayout); ui->shanbayWebView->page()->networkAccessManager()->setCookieJar(DICT::shanbayNet->http->cookieJar()); }
TimeControls::TimeControls(QWidget* parent) : QToolBar(parent) { QSettings settings("Pencil","Pencil"); //QFrame* frame = new QFrame(); QSpinBox* fpsBox = new QSpinBox(); //fpsBox->setFixedWidth(50); fpsBox->setFont( QFont("Helvetica", 10) ); fpsBox->setFixedHeight(22); fpsBox->setValue(settings.value("fps").toInt()); fpsBox->setMinimum(1); fpsBox->setMaximum(50); fpsBox->setToolTip("Frames per second"); fpsBox->setFocusPolicy(Qt::NoFocus); QPushButton* playButton = new QPushButton(); loopButton = new QPushButton(); soundButton = new QPushButton(); QLabel* separator = new QLabel(); separator->setPixmap(QPixmap(":icons/controls/separator.png")); separator->setFixedSize(QSize(37,31)); QLabel* spacingLabel = new QLabel(""); spacingLabel->setIndent(6); QLabel* fpsLabel = new QLabel(tr("Fps: ")); fpsLabel->setIndent(6); QIcon playIcon(":icons/controls/play.png"); QIcon loopIcon(":icons/controls/loop.png"); QIcon soundIcon(":icons/controls/sound.png"); #ifdef Q_WS_MAC /*loopButton->setFixedSize( QSize(35,30) ); loopButton->setIconSize( QSize(35,30) ); loopIcon.addFile (":icons/controls/loopOn.png", QSize(35,20), QIcon::Normal, QIcon::On ); loopIcon.addFile (":icons/controls/loopOff.png", QSize(35,20), QIcon::Normal, QIcon::Off); loopIcon.addFile (":icons/controls/loopOn.png", QSize(35,20), QIcon::Disabled, QIcon::On ); loopIcon.addFile (":icons/controls/loopOff.png", QSize(35,20), QIcon::Disabled, QIcon::Off); loopIcon.addFile (":icons/controls/loopOn.png", QSize(35,20), QIcon::Active, QIcon::On ); loopIcon.addFile (":icons/controls/loopOff.png", QSize(35,20), QIcon::Active, QIcon::Off);*/ #endif playButton->setIcon(playIcon); loopButton->setIcon(loopIcon); soundButton->setIcon(soundIcon); playButton->setToolTip(tr("Play")); loopButton->setToolTip(tr("Loop")); soundButton->setToolTip(tr("Sound on/off")); loopButton->setCheckable(true); soundButton->setCheckable(true); soundButton->setChecked(true); addWidget(separator); addWidget(playButton); addWidget(loopButton); addWidget(soundButton); addWidget(fpsLabel); addWidget(fpsBox); /*QHBoxLayout* frameLayout = new QHBoxLayout(); frameLayout->setMargin(0); frameLayout->setSpacing(0); frameLayout->addWidget(separator); frameLayout->addWidget(playButton); frameLayout->addWidget(loopButton); frameLayout->addWidget(soundButton); frameLayout->addWidget(fpsLabel); frameLayout->addWidget(fpsBox); frameLayout->addWidget(spacingLabel); setLayout(frameLayout); setFixedSize(300,32);*/ //QHBoxLayout* layout = new QHBoxLayout(); //layout->setAlignment(Qt::AlignRight); //layout->addWidget(frame); //layout->setMargin(0); //layout->setSizeConstraint(QLayout::SetNoConstraint); //setLayout(frameLayout); connect(playButton, SIGNAL(clicked()), this, SIGNAL(playClick())); connect(loopButton, SIGNAL(clicked()), this, SIGNAL(loopClick())); connect(soundButton, SIGNAL(clicked()), this, SIGNAL(soundClick())); connect(fpsBox,SIGNAL(valueChanged(int)), this, SIGNAL(fpsClick(int))); //updateButtons(false); }
int menuWiimote(WPADData *wd, u32 wpaddown) { checkSelected(wd); // button A selects an option if(wpaddown & WPAD_BUTTON_A) { switch(curmenunum) { case MAIN_MENU : switch(msel) { case 0: //play menu playClick(); killMainMenu(); initPlayMenu(); break; case 1 : //hi score playClick(); killMainMenu(); initHighscoreMenu(); break; case 2 : //optionsmenu playClick(); killMainMenu(); initOptionMenu(); break; case 3 : //sound menu playClick(); killMainMenu(); initSoundMenu(); break; case 4 : //exit playClick(); killMainMenu(); return EXIT; } break; case PLAY_MENU : switch(msel) { case 0 : playClick(); killPlayMenu(); return ONE_PLAYER_GAME; break; case 1 : playClick(); killPlayMenu(); return TWO_PLAYER_COOP; break; case 2 : playClick(); killPlayMenu(); return TWO_PLAYER_VERSUS; break; case 3 : playClick(); killPlayMenu(); initMainMenu(); break; } break; case OPTIONS_MENU : switch(msel) { case 0 : // change tileset playClick(); killMenu(); initTilesetMenu(); break; case 1 : // change layout playClick(); killMenu(); initLayoutMenu(); break; case 2 : // hover hint playWrong(); break; case 3 : // language selection playClick(); killMenu(); initLangMenu(); break; case 4 : // rumble on/off if(opt_rumble) opt_rumble=false; else opt_rumble=true; playClick(); break; case 5 : // widescreen on/off if(opt_widescreen) opt_widescreen=false; else opt_widescreen=true; GRRLIB_Widescreen(opt_widescreen); playClick(); break; case 6 : // back playClick(); killMenu(); initMainMenu(); break; } break; case SOUND_MENU : switch(msel) { case 2 : playClick(); killSoundMenu(); initMainMenu(); break; } break; case LANG_MENU : if(msel>-1) { int tmp_lang=msel + (curpage==0?0:9); if(tmp_lang>NORWEGIAN) return NOTHING; opt_lang=tmp_lang; setLanguage(); playClick(); killLangMenu(); initOptionMenu(); } if(btnover) { curpage++; curpage = curpage % 2; playClick(); } break; case LAYOUT_MENU : if(msel>-1) { playClick(); int tmp_sel = msel + (curpage==0?0:6); opt_layout=tmp_sel; killLayoutMenu(); initOptionMenu(); } if(btnover) { curpage++; curpage = curpage % 2; playClick(); } break; case TILESET_MENU : { if(msel>-1) { playClick(); opt_tileset=msel; killTilesetMenu(); initOptionMenu(); } } break; case HIGHSCORE_MENU: { playClick(); killHighscoreMenu(); initMainMenu(); } break; } } if (curmenunum==SOUND_MENU && wd->btns_h & WPAD_BUTTON_A) { switch(msel) { case 0 : xmusic=wd->ir.x; opt_music = (int) (((double)xmusic-soundhs[0][0])/soundhs[0][2]*64); return MUSIC_BAR + opt_music; break; case 1 : xsound=wd->ir.x; opt_sound = (int) (((double)xsound-soundhs[1][0])/soundhs[1][2]*255); playWrong(); break; } } // button B acts the same as back if(wpaddown & WPAD_BUTTON_B) { switch(curmenunum) { case MAIN_MENU : break; case PLAY_MENU : playClick(); killPlayMenu(); initMainMenu(); break; case OPTIONS_MENU : playClick(); killMenu(); initMainMenu(); break; case SOUND_MENU : playClick(); killSoundMenu(); initMainMenu(); break; case LANG_MENU : playClick(); killLangMenu(); initOptionMenu(); break; case LAYOUT_MENU : playClick(); killLayoutMenu(); initOptionMenu(); break; case TILESET_MENU : { playClick(); killTilesetMenu(); initOptionMenu(); } break; case HIGHSCORE_MENU: { playClick(); killHighscoreMenu(); initMainMenu(); } break; } } if(wpaddown & WPAD_BUTTON_PLUS) { if((curmenunum==LANG_MENU || curmenunum==LAYOUT_MENU) && curpage==0) curpage++; } if(wpaddown & WPAD_BUTTON_MINUS) { if((curmenunum==LANG_MENU || curmenunum==LAYOUT_MENU) && curpage==1) curpage--; } return NOTHING; }