Пример #1
0
void SDLFontGL::initGL(unsigned int x, unsigned int y, unsigned int w, unsigned int h) {
	clearGL();
	checkGLError();

	m_openglActive = true;

	m_charShader.program = loadProgram(char_vertex_shader, char_fragment_shader);
	if (m_charShader.program) {
		glUseProgram(m_charShader.program);
		checkGLError();

		m_charShader.aDim = glGetUniformLocation(m_charShader.program, "dim");
		m_charShader.aPos = glGetAttribLocation(m_charShader.program, "pos");
		m_charShader.aCells = glGetUniformLocation(m_charShader.program, "cells");
		m_charShader.aGlyphs = glGetUniformLocation(m_charShader.program, "glyphs");
		m_charShader.aColors = glGetUniformLocation(m_charShader.program, "colors");
		m_charShader.aGlyphsize = glGetUniformLocation(m_charShader.program, "glyphsize");
		m_charShader.aCellsize = glGetUniformLocation(m_charShader.program, "cellsize");
		m_charShader.aColorsize = glGetUniformLocation(m_charShader.program, "colorsize");
		m_charShader.aBlink = glGetUniformLocation(m_charShader.program, "blink");
		checkGLError();

		glVertexAttribPointer(m_charShader.aPos, 2, GL_FLOAT, GL_FALSE, 0, vertices);
		checkGLError();

		glUniform1i(m_charShader.aCells, 0);
		checkGLError();

		glUniform1i(m_charShader.aGlyphs, 1);
		checkGLError();

		glUniform1i(m_charShader.aColors, 2);
		checkGLError();
	}

	m_cursorShader.program = loadProgram(cursor_vertex_shader, cursor_fragment_shader);
	if (m_cursorShader.program) {
		glUseProgram(m_cursorShader.program);
		checkGLError();

		m_cursorShader.aDim = glGetUniformLocation(m_cursorShader.program, "dim");
		m_cursorShader.aPos = glGetAttribLocation(m_cursorShader.program, "pos");
		m_cursorShader.aCursorpos = glGetUniformLocation(m_cursorShader.program, "cursorpos");
		m_cursorShader.aCursorcolor = glGetUniformLocation(m_cursorShader.program, "cursorcolor");
		m_cursorShader.aCursorstyle = glGetUniformLocation(m_cursorShader.program, "cursorstyle");
		checkGLError();

		glVertexAttribPointer(m_cursorShader.aPos, 2, GL_FLOAT, GL_FALSE, 0, vertices);
		checkGLError();
	}

	m_dimX = x; m_dimY = y; m_dimW = w; m_dimH = h;

	updateFonts();
	updateDimensions();
	updateColors();
	updateCursor();

	checkGLError();
}
Пример #2
0
void AbstractTableView::Initialize()
{
    // Required to be called by each constructor because
    // of VTable changes
    //
    // Init all other updates once
    updateColors();
    updateFonts();
    updateShortcuts();
}
Пример #3
0
Editor::Editor(QWidget *parent) : QPlainTextEdit(parent)
{
    propDialog = ((MainWindow *) parent)->propDialog;

    ctrlPressed = false;
    isSpin = false;
    expectAutoComplete = false;
    canUndo = false;
    canRedo = false;
    canCopy = false;

    lineNumberArea = new LineNumberArea(this);
    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth()));
    connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
    updateLineNumberAreaWidth();

    highlighter = 0;
    setHighlights();
    setMouseTracking(true);
    setCenterOnScroll(true);
    setWordWrapMode(QTextOption::NoWrap);

    currentTheme = &Singleton<ColorScheme>::Instance();
    updateColors();
    updateFonts();
    saveContent();

    connect(this,SIGNAL(cursorPositionChanged()),this,SLOT(updateBackgroundColors()));
    connect(propDialog,SIGNAL(updateColors()),this,SLOT(updateColors()));
    connect(propDialog,SIGNAL(updateFonts()),this,SLOT(updateFonts()));
    connect(propDialog->getTabSpaceLedit(),SIGNAL(textChanged(QString)), this, SLOT(tabSpacesChanged()));

    connect(this,SIGNAL(undoAvailable(bool)), this, SLOT(setUndo(bool)));
    connect(this,SIGNAL(redoAvailable(bool)), this, SLOT(setRedo(bool)));
    connect(this,SIGNAL(copyAvailable(bool)), this, SLOT(setCopy(bool)));

    // this must be a pointer otherwise we can't control the position.
    cbAuto = new QComboBox(this);
    cbAuto->hide();
}
Пример #4
0
void Appearance::resetValues()
      {
      *config = MusEGlobal::config;  // init with global config values
      styleSheetPath->setText(config->styleSheetFile);
      updateFonts();

      QPalette pal;
      
      palette0->setStyleSheet(QString("background-color: ") + config->palette[0].name());
      palette1->setStyleSheet(QString("background-color: ") + config->palette[1].name());
      palette2->setStyleSheet(QString("background-color: ") + config->palette[2].name());
      palette3->setStyleSheet(QString("background-color: ") + config->palette[3].name());
      palette4->setStyleSheet(QString("background-color: ") + config->palette[4].name());
      palette5->setStyleSheet(QString("background-color: ") + config->palette[5].name());
      palette6->setStyleSheet(QString("background-color: ") + config->palette[6].name());
      palette7->setStyleSheet(QString("background-color: ") + config->palette[7].name());
      palette8->setStyleSheet(QString("background-color: ") + config->palette[8].name());
      palette9->setStyleSheet(QString("background-color: ") + config->palette[9].name());
      palette10->setStyleSheet(QString("background-color: ") + config->palette[10].name());
      palette11->setStyleSheet(QString("background-color: ") + config->palette[11].name());
      palette12->setStyleSheet(QString("background-color: ") + config->palette[12].name());
      palette13->setStyleSheet(QString("background-color: ") + config->palette[13].name());
      palette14->setStyleSheet(QString("background-color: ") + config->palette[14].name());
      palette15->setStyleSheet(QString("background-color: ") + config->palette[15].name());
      
      global_bg->takeChildren();
      user_bg->takeChildren();

      QDir bgdir = MusEGlobal::museGlobalShare + "/wallpapers/";
      QStringList filters;
      filters << "*.jpg" << "*.jpeg" << "*.png" << "*.gif";
      bgdir.setNameFilters(filters);
      backgroundTree->model()->setData(backgroundTree->model()->index(0,0), 
                                       QVariant(QSize(200,BG_ITEM_HEIGHT)), 
                                       Qt::SizeHintRole);
      QStringList bglist = bgdir.entryList(QDir::Files, QDir::Name);
      foreach (const QString &bgfile, bglist)
            {
            QTreeWidgetItem* item = new QTreeWidgetItem(global_bg, 0);
            item->setData(0, Qt::UserRole, QVariant(MusEGlobal::museGlobalShare + "/wallpapers/" + bgfile));
            BgPreviewWidget* bgw = new BgPreviewWidget(MusEGlobal::museGlobalShare + "/wallpapers/" + bgfile, backgroundTree);
            backgroundTree->setItemWidget(item, 0, bgw);
            if (config->canvasBgPixmap == MusEGlobal::museGlobalShare + "/wallpapers/" + bgfile)
                  backgroundTree->setCurrentItem(item);
            }
Пример #5
0
EditorView::EditorView(QWidget *parent) : QPlainTextEdit(parent)
{
    highlighter = 0;
    setExtension("spin");

    canUndo = false;
    canRedo = false;
    canCopy = false;
    tabOn = false;

    currentTheme = &Singleton<ColorScheme>::Instance();
    loadPreferences();

    lineNumberArea = new LineNumberArea(this);

    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth()));
    connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
    updateLineNumberAreaWidth();

    setMouseTracking(true);
    setCenterOnScroll(true);
    setWordWrapMode(QTextOption::NoWrap);

    updateColors();
    updateFonts();
    saveContent();

    connect(this,   SIGNAL(undoAvailable(bool)), this, SLOT(setUndo(bool)));
    connect(this,   SIGNAL(redoAvailable(bool)), this, SLOT(setRedo(bool)));
    connect(this,   SIGNAL(copyAvailable(bool)), this, SLOT(setCopy(bool)));

    // this must be a pointer otherwise we can't control the position.
    cbAuto = new QComboBox(this);
    cbAuto->setMaxVisibleItems(10);
    cbAuto->hide();
}
Пример #6
0
void SearchDialog::init() {
    setModal( true );
    queryPanel = new QWidget();
    queryPanelLayout = new QHBoxLayout();
    queryPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    queryPanel->setLayout( queryPanelLayout );

    resetButton = new QPushButton();
    resetButton->setIcon( QIcon( QPixmap( ZPIXMAP( resetQueryForm_xpm ) ) ) );
    //resetButton->setToolTip( tr( "Reset" ) );
    connect( resetButton, SIGNAL( clicked() ), this, SLOT( reset() ) );
    queryField = new HistoryField();
    queryField->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
    searchButton = new QPushButton( /*tr( "Search" ),*/ this ); // Passing this inits autoDefault property.
    searchButton->setIcon( QIcon( ZPIXMAP( search_xpm ) ) );
    searchButton->setIconSize( QSize( 32, 32 ) );
    //searchButton->setToolTip( tr( "Search" ) );
    searchButton->setDefault( true );
    connect( searchButton, SIGNAL( clicked() ), queryField->lineEdit(), SIGNAL( returnPressed() ) );
    connect( searchButton, SIGNAL( clicked() ), this, SLOT( search() ) );

    queryPanelLayout->addWidget( resetButton );
    queryPanelLayout->addWidget( queryField );
    queryPanelLayout->addWidget( searchButton );

    int prefHeight = resetButton->sizeHint().height();
    queryField->setMaximumHeight( prefHeight );

    resultsHeaderPanel = new QWidget();
    resultsHeaderPanelLayout = new QHBoxLayout();
    resultsHeaderPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    resultsHeaderPanel->setLayout( resultsHeaderPanelLayout );
    resultsHeaderLabel = new QLabel( tr( "Results" ) );
    resultsCounterLabel = new QLabel();
    resultsCounterLabel->setAlignment( Qt::AlignRight );
    resultsHeaderPanelLayout->addWidget( resultsHeaderLabel );
    resultsHeaderPanelLayout->addStretch();
    resultsHeaderPanelLayout->addWidget( resultsCounterLabel );

    resultsListView = new QTreeWidget();
    resultsListView->setColumnCount( 4 );
    resultsListView->setSortingEnabled( true );
    resultsListView->header()->setMovable( false );
    QStringList headerLabels;
    headerLabels << QApplication::translate( "QObject", controller->getPreferences().getFirstLanguage().toLatin1().data() );
    headerLabels << QApplication::translate( "QObject", controller->getPreferences().getTestLanguage().toLatin1().data() );
    headerLabels << tr( "Glossary" ) << tr( "Location" );
    resultsListView->setHeaderLabels( headerLabels );
    resultsListView->header()->setResizeMode( QHeaderView::Stretch );
    resultsListView->setAllColumnsShowFocus( true );
    resultsListView->setSelectionMode( QAbstractItemView::ExtendedSelection );
    connect( resultsListView, SIGNAL( itemSelectionChanged() ), this, SLOT( updateUi() ) );

    resultsButtonsPanel = new QWidget();
    resultsButtonsPanelLayout = new QVBoxLayout();
    resultsButtonsPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    resultsButtonsPanel->setLayout( resultsButtonsPanelLayout );
    goResultVocabButton = new QPushButton( tr( "View Glossary" ) );
    goResultVocabButton->setIcon( QIcon( ZPIXMAP( goVocab_xpm ) ) );
    goResultVocabButton->setIconSize( QSize( 32, 32 ) );
    //goResultVocabButton->setToolTip( tr( "View Glossary" ) );
    connect( goResultVocabButton, SIGNAL( clicked() ), this, SLOT( goResultVocab() ) );
    editResultTermButton = new QPushButton( tr( "Edit Term" ) );
    editResultTermButton->setIcon( QIcon( ZPIXMAP( editTerm_xpm ) ) );
    editResultTermButton->setIconSize( QSize( 32, 32 ) );
    //editResultTermButton->setToolTip( tr( "Edit Term" ) );
    connect( editResultTermButton, SIGNAL( clicked() ), this, SLOT( editResultTerm() ) );
    removeResultTermButton = new QPushButton( tr( "Remove Term(s)" ) );
    removeResultTermButton->setIcon( QIcon( ZPIXMAP( removeTerm_xpm ) ) );
    removeResultTermButton->setIconSize( QSize( 32, 32 ) );
    //removeResultTermButton->setToolTip( tr( "Remove Term(s)" ) );
    connect( removeResultTermButton, SIGNAL( clicked() ), this, SLOT( removeResultTerms() ) );

    closeButton = new QPushButton( tr( "Close" ) );
    connect( closeButton, SIGNAL( clicked() ), this, SLOT( reject() ) );

    resultsButtonsPanelLayout->addWidget( goResultVocabButton );
    resultsButtonsPanelLayout->addWidget( editResultTermButton );
    resultsButtonsPanelLayout->addWidget( removeResultTermButton );
    resultsButtonsPanelLayout->addWidget( closeButton );

    prefHeight = removeResultTermButton->sizeHint().height();
    goResultVocabButton->setMaximumHeight( prefHeight );
    editResultTermButton->setMaximumHeight( prefHeight );

    resultsPanel = new QWidget();
    resultsPanelLayout = new QHBoxLayout();
    resultsPanelLayout->setContentsMargins( 0, 0, 0, 0 );
    resultsPanel->setLayout( resultsPanelLayout );

    resultsPanelLayout->addWidget( resultsListView );
    resultsPanelLayout->addWidget( resultsButtonsPanel );

    mainLayout = new QVBoxLayout( this );
    mainLayout->addWidget( queryPanel );
    mainLayout->addWidget( resultsHeaderPanel );
    mainLayout->addWidget( resultsPanel, 1 );

    setWindowTitle( tr( "Search..." ) );

    updateFonts();
    updateUi();
}
Пример #7
0
void AbstractTableView::slot_updateFonts()
{
    updateFonts();
}
Пример #8
0
void QuizFrame::resumeQuiz() {
    updateLanguageLabels();
    updateFonts();
    askCurrentTerm();
}
Пример #9
0
void QuizFrame::restartQuiz() {
    setButtonsEnabled( false );
    updateLanguageLabels();
    updateFonts();
    askNextTerm();
}
Пример #10
0
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() );
}