Exemple #1
0
void MainWindow::createCentralWidget()
{
    mWebView = new EnView(this);
    mWebView->setContextMenuPolicy(Qt::NoContextMenu);
    if(isFirstRun)
        mWebView->setHtml(defaultPage(false));
    else
        mWebView->setHtml(defaultPage(true));

    connect(mWebView, SIGNAL(noteClicked(QString)), &mEnExport, SLOT(openNote(QString)));
    //connect(mWebView, SIGNAL(linkClicked(QUrl)), SLOT(openUrl(QUrl)));

    QPalette navigationPalette;
    navigationPalette.setColor(QPalette::Window, QColor(mBgColor));

    mToolBar = new QToolBar(this);
    addToolBar(Qt::TopToolBarArea, mToolBar);
    mToolBar->setBackgroundRole(QPalette::Window);
    mToolBar->setAutoFillBackground(true);
    mToolBar->setPalette(navigationPalette);
    mToolBar->setMovable(false);
    mToolBar->setIconSize(QSize(30, 30));

    //mPageNumberLabel = new QLabel("4 / 7", this);
    //mPageNumberLabel->setFont(QFont("Times", 18));

    QAction* settingsAction = new QAction(QIcon(":/images/gear2.png"), tr("Settings"), mToolBar);
    QAction* prevAction = new QAction(QIcon(":/images/prev.png"), tr("Prev"), mToolBar);
    QAction* nextAction = new QAction(QIcon(":/images/next.png"), tr("Next"), mToolBar);

    mToolBar->addAction(settingsAction);
    mToolBar->addAction(prevAction);
    mToolBar->addAction(nextAction);

    mNavigationLabel = new QLabel(mToolBar);
    mNavigationLabel->setFont(QFont("Times", 18));
    mToolBar->addWidget(mNavigationLabel);

    connect(settingsAction, SIGNAL(triggered()), SLOT(loadDialogSettings()));
    //connect(settingsAction, SIGNAL(triggered()), mDialog, SLOT(show()));
    connect(prevAction, SIGNAL(triggered()), SLOT(prevNote()));
    connect(nextAction, SIGNAL(triggered()), SLOT(nextNote()));

    setCentralWidget(mWebView);
}
Exemple #2
0
bool MainWindow::checkNoteAction(QPoint &pos)
{
    int releaseRect = rectHitTest(pos);
    if(m_nPressRect == releaseRect)
    {
        if(m_nPressRect == 0)
        {
            newNote();
            return true;
        }
        else if(m_nPressRect > 0)
        {
            openNote(m_notes.at(m_nPressRect + m_nStartNote - 1));
            return true;
        }
    }
    return false;
}
Exemple #3
0
void TrayMenu::noteChosen(int note) {
    emit (openNote(note));
}