void AudioBrowserScreen::init() { connect(buttons[EXIT], SIGNAL(clicked()), this, SLOT(lower())); connect(buttons[DOWN], SIGNAL(clicked()), listView, SLOT(scrollDown())); connect(buttons[UP], SIGNAL(clicked()), listView, SLOT(scrollUp())); connect(buttons[PGDOWN], SIGNAL(clicked()), listView,SLOT(scrollPageDown())); connect(buttons[PGUP], SIGNAL(clicked()), listView, SLOT(scrollPageUp())); connect(buttons[SELECT], SIGNAL(clicked()), this, SLOT(selectFolder())); connect(buttons[PLUS], SIGNAL(clicked()), this, SLOT(selectFolderPlus())); connect(buttons[BACK], SIGNAL(clicked()), this, SLOT(backFolder())); connect(buttons[BROWSE], SIGNAL(clicked()), this, SLOT(browseFolder())); connect(listView,SIGNAL(highlighted(int)),this,SLOT(highlight(int))); connect(listView,SIGNAL(selected(int)),this, SLOT(select(int))); setDir(rootDir); }
////////////////////////////////////////////////////////////////////// // Function Name: // Description: // Parameters: // Data IN/OUT: // Return: // Notes: ////////////////////////////////////////////////////////////////////// void CListFrame::scrollLineUp(const int lines) { //TRACE("[CListFrame]->scrollLineUp \r\n"); if( !(m_nMode & SCROLL)) return; if( m_nNrOfLines <= 1) return; if(m_nSelectedLine > 0) m_nSelectedLine--; // check if the cursor moves out of the window if(m_nSelectedLine < m_nCurrentLine ) { // yes, scroll to next page //TRACE("[CListFrame] m_nSelectedLine: %d, \r\n",m_nSelectedLine); scrollPageUp(1); } else { refreshLine(m_nSelectedLine+lines); refreshLine(m_nSelectedLine); } }
void QuizFrame::init() { Preferences& prefs = controller->getPreferences(); QFont largeFont = prefs.getLargeFont(); QFont mediumFont = prefs.getMediumFont(); QFont labelsFont = prefs.getLabelsFont(); QString firstLang( controller->getQuizFirstLanguage() ); QString testLang( controller->getQuizTestLanguage() ); topPanel = new QWidget(); topPanelLayout = new QHBoxLayout(); topPanel->setLayout( topPanelLayout ); topLeftPanel = new QWidget(); topLeftPanel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) ); topLeftPanelLayout = new QVBoxLayout(); topLeftPanelLayout->setContentsMargins( 0, 0, 0, 0 ); topLeftPanel->setLayout( topLeftPanelLayout ); topPanelLayout->addWidget( topLeftPanel, 1 ); firstLangPanel = new QWidget(); firstLangPanelLayout = new QBoxLayout( QBoxLayout::TopToBottom ); firstLangPanelLayout->setContentsMargins( 0, 0, 0, 0 ); firstLangPanel->setLayout( firstLangPanelLayout ); topLeftPanelLayout->addWidget( firstLangPanel ); testLangPanel = new QWidget(); testLangPanelLayout = new QBoxLayout( QBoxLayout::TopToBottom ); testLangPanelLayout->setContentsMargins( 0, 0, 0, 0 ); testLangPanel->setLayout( testLangPanelLayout ); topLeftPanelLayout->addWidget( testLangPanel ); controlPanel = new QWidget(); controlPanelLayout = new QVBoxLayout(); controlPanelLayout->setContentsMargins( 0, 0, 0, 0 ); controlPanel->setLayout( controlPanelLayout ); answerControlPanel = new QWidget(); answerControlPanelLayout = new QVBoxLayout(); answerControlPanelLayout->setContentsMargins( 0, 0, 0, 0 ); answerControlPanel->setLayout( answerControlPanelLayout ); controlPanelLayout->addWidget( answerControlPanel ); revealAllDataButton = new QPushButton( /*tr( "Reveal" )*/ ); revealAllDataButton->setIcon( QIcon( ZPIXMAP( eye_xpm ) ) ); revealAllDataButton->setIconSize( QSize( 32, 32 ) ); revealAllDataButton->setEnabled( false ); //revealAllDataButton->setToolTip( tr( "Reveal" ) ); connect( revealAllDataButton, SIGNAL( clicked() ), this, SLOT( reveal() ) ); rightAnswerButton = new QPushButton( /*tr( "RightAnswer" )*/ ); rightAnswerButton->setIcon( QIcon( ZPIXMAP( goodAns_xpm ) ) ); rightAnswerButton->setIconSize( QSize( 32, 32 ) ); rightAnswerButton->setEnabled( false ); //rightAnswerButton->setToolTip( tr( "RightAnswer" ) ); connect( rightAnswerButton, SIGNAL( clicked() ), this, SLOT( rightAnswer() ) ); wrongAnswerButton = new QPushButton( /*tr( "WrongAnswer" )*/ ); wrongAnswerButton->setIcon( QIcon( ZPIXMAP( badAns_xpm ) ) ); wrongAnswerButton->setIconSize( QSize( 32, 32 ) ); wrongAnswerButton->setEnabled( false ); //wrongAnswerButton->setToolTip( tr( "WrongAnswer" ) ); connect( wrongAnswerButton, SIGNAL( clicked() ), this, SLOT( wrongAnswer() ) ); answerControlPanelLayout->addWidget( revealAllDataButton ); answerControlPanelLayout->addWidget( rightAnswerButton ); answerControlPanelLayout->addWidget( wrongAnswerButton ); editionButton = new QPushButton( /*tr( "EditWord" )*/ ); editionButton->setIcon( QIcon( ZPIXMAP( editTerm_xpm ) ) ); editionButton->setIconSize( QSize( 32, 32 ) ); editionButton->setMinimumWidth( 100 ); editionButton->setEnabled( false ); //editionButton->setToolTip( tr( "EditWord" ) ); connect( editionButton, SIGNAL( clicked() ), this, SLOT( editCurrentTerm() ) ); controlPanelLayout->addWidget( answerControlPanel, 1 ); controlPanelLayout->addWidget( editionButton, 0 ); firstLangTermPanel = new QWidget(); firstLangTermPanelLayout = new QHBoxLayout(); firstLangTermPanel->setLayout( firstLangTermPanelLayout ); firstLangPanelLabel = new QLabel( QApplication::translate( "QObject", firstLang.toLatin1().data() ) ); firstLangPanelLayout->addWidget( firstLangPanelLabel ); firstLangPanelLayout->addWidget( firstLangTermPanel ); firstLangTermLabel = new QLabel( tr( "Word/Expr." ) ); firstLangTermStack = new QStackedWidget(); firstLangTermLineEdit = new ScrollableLineEdit(); firstLangTermLineEdit->setReadOnly( true ); firstLangTermButton = new QPushButton( tr( "???" ) ); //firstLangTermButton->setToolTip( tr( "Reveal" ) ); connect( firstLangTermButton, SIGNAL( clicked() ), this, SLOT( revealFirstLangTerm() ) ); firstLangTermStack->addWidget( firstLangTermLineEdit ); firstLangTermStack->addWidget( firstLangTermButton ); firstLangTermPanelLayout->addWidget( firstLangTermLabel, 0 ); firstLangTermPanelLayout->addWidget( firstLangTermStack, 1 ); testLangPanelLabel = new QLabel( QApplication::translate( "QObject", testLang.toLatin1().data() ) ); testLangPanelLayout->addWidget( testLangPanelLabel ); testLangTopPanel = new QWidget(); testLangPanelLayout->addWidget( testLangTopPanel ); testLangTopPanelLayout = new QHBoxLayout(); testLangTopPanel->setLayout( testLangTopPanelLayout ); testLangLabelsPanel = new QWidget(); testLangLabelsPanelLayout = new QVBoxLayout(); testLangLabelsPanelLayout->setContentsMargins( 0, 0, 0, 0 ); testLangLabelsPanel->setLayout( testLangLabelsPanelLayout ); testLangTermAltLabel = new QLabel( tr( "Alt./Phon." ) ); testLangLabelsPanelLayout->addWidget( testLangTermAltLabel ); testLangTermLabel = new QLabel( tr( "Word/Expr." ) ); testLangLabelsPanelLayout->addWidget( testLangTermLabel ); testLangFieldsPanel = new QWidget(); testLangFieldsPanelLayout = new QVBoxLayout(); testLangFieldsPanelLayout->setContentsMargins( 0, 0, 0, 0 ); testLangFieldsPanel->setLayout( testLangFieldsPanelLayout ); testLangTermAltStack = new QStackedWidget(); testLangFieldsPanelLayout->addWidget( testLangTermAltStack ); testLangTermAltLineEdit = new ScrollableLineEdit(); testLangTermAltLineEdit->setReadOnly( true ); testLangTermAltButton = new QPushButton( tr( "???" ) ); //testLangTermAltButton->setToolTip( tr( "Reveal" ) ); connect( testLangTermAltButton, SIGNAL( clicked() ), this, SLOT( revealAltTerm() ) ); testLangTermAltStack->addWidget( testLangTermAltLineEdit ); testLangTermAltStack->addWidget( testLangTermAltButton ); testLangTermStack = new QStackedWidget(); testLangFieldsPanelLayout->addWidget( testLangTermStack ); testLangTermLineEdit = new ScrollableLineEdit(); testLangTermLineEdit->setReadOnly( true ); testLangTermButton = new QPushButton( tr( "???" ) ); //testLangTermButton->setToolTip( tr( "Reveal" ) ); connect( testLangTermButton, SIGNAL( clicked() ), this, SLOT( revealTestLangTerm() ) ); testLangTermStack->addWidget( testLangTermLineEdit ); testLangTermStack->addWidget( testLangTermButton ); testLangTopPanelLayout->addWidget( testLangLabelsPanel ); testLangTopPanelLayout->addWidget( testLangFieldsPanel, 1 ); commentBox = new QWidget(); commentBoxLayout = new QVBoxLayout(); commentBoxLayout->setContentsMargins( 0, 0, 0, 0 ); commentBox->setLayout( commentBoxLayout ); commentLabelPanel = new QWidget(); commentLabelPanelLayout = new QHBoxLayout(); commentLabelPanelLayout->setContentsMargins( 0, 0, 0, 0 ); commentLabelPanel->setLayout( commentLabelPanelLayout ); commentBoxLayout->addWidget( commentLabelPanel ); commentLabel = new QLabel( tr( "Examples/Comments" ) ); maximizeCommentButton = new QPushButton(); maximizeCommentButton->setIcon( QIcon( ZPIXMAP( maximize_xpm ) ) ); maximizeCommentButton->setIconSize( QSize( 32, 32 ) ); maximizeCommentButton->setCheckable( true ); maximizeCommentButton->setMaximumHeight( commentLabel->sizeHint().height() > 24 ? commentLabel->sizeHint().height() : 24 ); maximizeCommentButton->setMaximumWidth( maximizeCommentButton->maximumHeight() ); //maximizeCommentButton->setToolTip( tr( "MaximizeComment" ) ); connect( maximizeCommentButton, SIGNAL( toggled( bool ) ), this, SLOT( toggleMaximizeComment( bool ) ) ); commentLabelPanelLayout->addWidget( commentLabel ); commentLabelPanelLayout->addStretch(); commentLabelPanelLayout->addWidget( maximizeCommentButton ); commentStack = new QStackedWidget(); commentBoxLayout->addWidget( commentStack ); commentMultiLineEdit = new ScrollableMultiLineEdit(); commentMultiLineEdit->setReadOnly( true ); commentButton = new QPushButton( tr( "???" ) ); //commentButton->setToolTip( tr( "Reveal" ) ); connect( commentButton, SIGNAL( clicked() ), this, SLOT( revealComment() ) ); commentStack->addWidget( commentMultiLineEdit ); commentStack->addWidget( commentButton ); imageBox = new QWidget(); imageBoxLayout = new QBoxLayout( QBoxLayout::TopToBottom ); imageBox->setLayout( imageBoxLayout ); imageBoxLabel = new QLabel( tr( "Image" ) ); imageBoxLayout->addWidget( imageBoxLabel ); imageStack = new QStackedWidget(); imageBoxLayout->addWidget( imageStack ); imageButton = new QPushButton( tr( "???" ) ); //imageButton->setToolTip( tr( "Reveal" ) ); connect( imageButton, SIGNAL( clicked() ), this, SLOT( revealImage() ) ); image = new QLabel(); imageStack->addWidget( image ); imageStack->addWidget( imageButton ); topPanelLayout->addWidget( imageBox ); scrollLeftAction = new QAction( this ); scrollLeftAction->setShortcut( QKeySequence( QKeySequence::MoveToPreviousChar ) ); connect( scrollLeftAction, SIGNAL( triggered() ), this, SLOT( scrollLeft() ) ); addAction( scrollLeftAction ); scrollRightAction = new QAction( this ); scrollRightAction->setShortcut( QKeySequence( QKeySequence::MoveToNextChar ) ); connect( scrollRightAction, SIGNAL( triggered() ), this, SLOT( scrollRight() ) ); addAction( scrollRightAction ); scrollUpAction = new QAction( this ); scrollUpAction->setShortcut( QKeySequence( QKeySequence::MoveToPreviousLine ) ); connect( scrollUpAction, SIGNAL( triggered() ), this, SLOT( scrollUp() ) ); addAction( scrollUpAction ); scrollDownAction = new QAction( this ); scrollDownAction->setShortcut( QKeySequence( QKeySequence::MoveToNextLine ) ); connect( scrollDownAction, SIGNAL( triggered() ), this, SLOT( scrollDown() ) ); addAction( scrollDownAction ); scrollPageUpAction = new QAction( this ); scrollPageUpAction->setShortcut( QKeySequence( QKeySequence::MoveToPreviousPage ) ); connect( scrollPageUpAction, SIGNAL( triggered() ), this, SLOT( scrollPageUp() ) ); addAction( scrollPageUpAction ); scrollPageDownAction = new QAction( this ); scrollPageDownAction->setShortcut( QKeySequence( QKeySequence::MoveToNextPage ) ); connect( scrollPageDownAction, SIGNAL( triggered() ), this, SLOT( scrollPageDown() ) ); addAction( scrollPageDownAction ); mainLayout = new QHBoxLayout( this ); body = new QWidget(); bodyLayout = new QVBoxLayout(); bodyLayout->setContentsMargins( 0, 0, 0, 0 ); body->setLayout( bodyLayout ); bodyLayout->addWidget( topPanel ); bodyLayout->addWidget( commentBox, 1 ); bodyWrapper = new QScrollArea(); bodyWrapper->setWidget( body ); mainLayout->addWidget( bodyWrapper, 1 ); mainLayout->addWidget( controlPanel ); setLayout( mainLayout ); mainLayout->activate(); updateFonts(); setButtonsHidden( prefs.areQuizButtonsHidden() ); }