Esempio n. 1
0
KPager::KPager(KPagerMainWindow *parent, const char *name)
	: QFrame (parent, name, WStyle_Customize | WStyle_NoBorder | WStyle_Tool)
    , m_layout(0)
    , m_mnu(0)
    , m_smnu(0)
    , m_dmnu(0)
{
    m_windows.setAutoDelete(true); // delete windows info after removal

    setBackgroundColor( black );
    m_winmodule=new KWinModule(this);
    m_currentDesktop=m_winmodule->currentDesktop();

    m_grabWinTimer=new QTimer(this,"grabWinTimer");
    connect(m_grabWinTimer, SIGNAL(timeout()), this, SLOT(slotGrabWindows()));

    KPagerConfigDialog::initConfiguration();

    KConfig *cfg = kapp->config();
    cfg->setGroup("KPager");
    m_showStickyOption=cfg->readBoolEntry("ShowStickyOption",false);

    int numberOfDesktops=m_winmodule->numberOfDesktops();
    for (int i=0;i<numberOfDesktops;i++)
    {
        Desktop *dsk=new Desktop(i+1,m_winmodule->desktopName(i),this);
        m_desktops.append(dsk);
    }

    m_layoutType=static_cast<enum KPager::LayoutTypes>( KPagerConfigDialog::m_layoutType );

    connect( m_winmodule, SIGNAL( activeWindowChanged(WId)),
             SLOT(slotActiveWindowChanged(WId)));
    connect( m_winmodule, SIGNAL( windowAdded(WId) ),
             SLOT( slotWindowAdded(WId) ) );
    connect( m_winmodule, SIGNAL( windowRemoved(WId) ),
             SLOT( slotWindowRemoved(WId) ) );
    connect( m_winmodule, SIGNAL( windowChanged(WId,unsigned int) ),
             SLOT( slotWindowChanged(WId,unsigned int) ) );
    connect( m_winmodule, SIGNAL( stackingOrderChanged() ),
             SLOT( slotStackingOrderChanged() ) );
    connect( m_winmodule, SIGNAL( desktopNamesChanged() ),
             SLOT( slotDesktopNamesChanged() ) );
    connect( m_winmodule, SIGNAL( numberOfDesktopsChanged(int) ),
             SLOT( slotNumberOfDesktopsChanged(int) ) );
    connect( m_winmodule, SIGNAL( currentDesktopChanged(int)),
             SLOT( slotCurrentDesktopChanged(int) ) );
    connect(kapp, SIGNAL(backgroundChanged(int)),
            SLOT(slotBackgroundChanged(int)));

    QFont defFont(KGlobalSettings::generalFont().family(), 10, QFont::Bold);
    defFont = cfg->readFontEntry("Font", &defFont);
    setFont(defFont);

    m_prefs_action = KStdAction::preferences(this, SLOT(configureDialog()), parent->actionCollection());
    m_quit_action = KStdAction::quit(kapp, SLOT(quit()), parent->actionCollection());

    updateLayout();
}
Esempio n. 2
0
void MainWindow::newFile()
{
    Editor *editor = new Editor;
    editor->newFile(); //set windows title
    addEditor(editor);
    //mdiArea->activeSubWindow()->resize(350, 300);

    //reset fonts for every new file
    fontChanged(editor->font());
    colorChanged(editor->textColor());

    QFont defFont("Courier");
    comboFont->setCurrentFont(defFont);
    comboSize->setCurrentIndex(3); //= 9 pt.
    editor->setFont(defFont);
}
Esempio n. 3
0
void SqlEditorWidget::prefsChanged()
{
    QFont baseFont(m_prefs->sqlFont());
    baseFont.setPointSize(m_prefs->sqlFontSize());

    lexer()->setFont(baseFont);
    setFont(baseFont);

    // syntax highlighting
    lexer()->setColor(m_prefs->syDefaultColor(), QsciLexerSQL::Default);
    lexer()->setColor(m_prefs->syKeywordColor(), QsciLexerSQL::Keyword);
    QFont defFont(lexer()->font(QsciLexerSQL::Keyword));
    defFont.setBold(true);
    lexer()->setFont(defFont, QsciLexerSQL::Keyword);
    lexer()->setColor(m_prefs->syNumberColor(), QsciLexerSQL::Number);
    lexer()->setColor(m_prefs->syStringColor(), QsciLexerSQL::SingleQuotedString);
    lexer()->setColor(m_prefs->syStringColor(), QsciLexerSQL::DoubleQuotedString);
    lexer()->setColor(m_prefs->syCommentColor(), QsciLexerSQL::Comment);
    lexer()->setColor(m_prefs->syCommentColor(), QsciLexerSQL::CommentLine);
    lexer()->setColor(m_prefs->syCommentColor(), QsciLexerSQL::CommentDoc);

    setAutoCompletionThreshold(m_prefs->codeCompletion() ?
                               m_prefs->codeCompletionLength() : -1
                              );

    if (m_prefs->textWidthMark())
    {
        setEdgeColumn(m_prefs->textWidthMarkSize());
        setEdgeColor(Qt::gray);
        setEdgeMode(QsciScintilla::EdgeLine);
    }
    else
        setEdgeMode(QsciScintilla::EdgeNone);

    setMarkerBackgroundColor(m_prefs->activeHighlighting() ?
                             m_prefs->activeHighlightColor() : paper());
}