コード例 #1
0
/** No descriptions */
void CLexiconReadWindow::initConnections() {
    qDebug() << "CLexiconReadWindow::initConnections";
    Q_ASSERT(keyChooser());

    connect(keyChooser(), SIGNAL(keyChanged(CSwordKey*)), this, SLOT(lookupSwordKey(CSwordKey*)));
    connect(keyChooser()->history(), SIGNAL(historyChanged(bool, bool)), this, SLOT(slotUpdateHistoryButtons(bool, bool)));

    //connect the history actions to the right slots
    bool ok = connect(
                  m_actions.backInHistory->popupMenu(), SIGNAL(aboutToShow()),
                  this, SLOT(slotFillBackHistory())
              );
    Q_ASSERT(ok);
    ok = connect(
             m_actions.backInHistory->popupMenu(), SIGNAL(triggered(QAction*)),
             keyChooser()->history(), SLOT(move(QAction*))
         );
    Q_ASSERT(ok);
    ok = connect(
             m_actions.forwardInHistory->popupMenu(), SIGNAL(aboutToShow()),
             this, SLOT(slotFillForwardHistory())
         );
    Q_ASSERT(ok);
    ok = connect(
             m_actions.forwardInHistory->popupMenu(), SIGNAL(triggered(QAction*)),
             keyChooser()->history(), SLOT(move(QAction*))
         );
    Q_ASSERT(ok);

}
コード例 #2
0
ファイル: cdisplaywindow.cpp プロジェクト: Gandh1PL/bibletime
void CDisplayWindow::initActions() {
    BtActionCollection* ac = actionCollection();

    CDisplayWindow::insertKeyboardActions(ac);

    QAction* actn = ac->action(CResMgr::displaywindows::general::search::actionName);
    Q_ASSERT(actn != 0);
    QObject::connect(actn, SIGNAL(triggered()),
                     this, SLOT(slotSearchInModules()));

    CDisplayConnections* conn = displayWidget()->connectionsProxy();

    actn = ac->action("openLocation");
    Q_ASSERT(actn != 0);
    QObject::connect(actn, SIGNAL(triggered()),
                     this, SLOT(setFocusKeyChooser()));
    addAction(actn);

    actn = ac->action("selectAll");
    Q_ASSERT(actn != 0);
    QObject::connect(actn, SIGNAL(triggered()),
                     conn, SLOT(selectAll()));
    addAction(actn);

    actn = ac->action("copySelectedText");
    Q_ASSERT(actn != 0);
    QObject::connect(actn, SIGNAL(triggered()),
                     conn, SLOT(copySelection()));
    addAction(actn);

    actn = ac->action("findText");
    Q_ASSERT(actn != 0);
    QObject::connect(actn, SIGNAL(triggered()),
                     conn, SLOT(openFindTextDialog()));
    addAction(actn);

    actn = ac->action(CResMgr::displaywindows::general::backInHistory::actionName);
    Q_ASSERT(actn != 0);
    bool ok = QObject::connect(actn,                    SIGNAL(triggered()),
                               keyChooser()->history(), SLOT(back()));
    Q_ASSERT(ok);
    addAction(actn);

    actn = ac->action(CResMgr::displaywindows::general::forwardInHistory::actionName);
    Q_ASSERT(actn != 0);
    ok = QObject::connect(actn,                    SIGNAL(triggered()),
                          keyChooser()->history(), SLOT(fw()));
    Q_ASSERT(ok);
    addAction(actn);

    ac->readShortcuts("Displaywindow shortcuts");
}
コード例 #3
0
void CPlainWriteWindow::beforeKeyChange() {
    Q_ASSERT(displayWidget());
    Q_ASSERT(keyChooser());
    if (!isReady())
        return;

    // Get current key string for this window
    QString thisWindowsKey;
    CSwordKey* oldKey = key();
    if (oldKey == 0)
        return;
    thisWindowsKey = oldKey->key();

    //If the text changed and we'd do a lookup ask the user if the text should be saved
    if (modules().first() && m_writeDisplay->isModified()) {

        switch (message::showQuestion( this, tr("Save Text?"), tr("Save changed text?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) ) {
            case QMessageBox::Yes: { //save the changes
                saveCurrentText( thisWindowsKey );
                break;
            }
            default: {// set modified to false so it won't ask again
                m_writeDisplay->setModified(false);
                break;
            }
        }
    }
}
コード例 #4
0
void CLexiconReadWindow::slotUpdateHistoryButtons(bool backEnabled, bool fwEnabled) {
    qDebug() << "CLexiconReadWindow::slotUpdateHistoryButtons";
    Q_ASSERT(m_actions.backInHistory);
    Q_ASSERT(keyChooser());

    m_actions.backInHistory->setEnabled( backEnabled );
    m_actions.forwardInHistory->setEnabled( fwEnabled );
}
コード例 #5
0
/** Reimplementation to handle the keychooser refresh. */
void CCommentaryReadWindow::reload(CSwordBackend::SetupChangedReason reason) {
    CLexiconReadWindow::reload(reason);

    //refresh the book lists
    verseKey()->setLocale( CSwordBackend::instance()->booknameLanguage().toLatin1() );
    keyChooser()->refreshContent();

    actionCollection()->readShortcuts("Commentary shortcuts");
}
コード例 #6
0
void CLexiconReadWindow::slotFillForwardHistory() {
    qDebug() << "CLexiconReadWindow::slotFillForwardHistory";

    QMenu* menu = m_actions.forwardInHistory->popupMenu();
    menu->clear();
    /// \todo take the history list and fill the menu using addAction
    QListIterator<QAction*> it(keyChooser()->history()->getFwList());
    while (it.hasNext()) {
        menu->addAction(it.next());
    }
}
コード例 #7
0
void CLexiconReadWindow::slotFillBackHistory()
{
	qDebug("CLexiconReadWindow::slotFillBackHistory");

	QMenu* menu = m_actions.backInHistory->popupMenu();
	menu->clear();

	//TODO: take the history list and fill the menu
	QListIterator<QAction*> it(keyChooser()->history()->getBackList());
	while (it.hasNext()) {
		menu->addAction(it.next());
	}
}
コード例 #8
0
ファイル: cdisplaywindow.cpp プロジェクト: Gandh1PL/bibletime
/** Refresh the settings of this window. */
void CDisplayWindow::reload(CSwordBackend::SetupChangedReason) {
    //first make sure all used Sword modules are still present
    QMutableStringListIterator it(m_modules);
    while (it.hasNext()) {
        if (!CSwordBackend::instance()->findModuleByName(it.next())) {
            it.remove();
        }
    }

    if (m_modules.isEmpty()) {
        close();
        return;
    }

    if (keyChooser()) keyChooser()->setModules( modules(), false );

    lookup();

    actionCollection()->readShortcuts("DisplayWindow shortcuts");
    actionCollection()->readShortcuts("Readwindow shortcuts");
    emit sigModuleListSet(m_modules);
}
コード例 #9
0
ファイル: cdisplaywindow.cpp プロジェクト: Gandh1PL/bibletime
void CDisplayWindow::modulesChanged() {
    // this would only set the stringlist again
    //if (moduleChooserBar()) { //necessary for write windows
    //setModules( m_moduleChooserBar->getModuleList() );
    //}
    if (modules().isEmpty()) {
        close();
    }
    else {
        emit sigModulesChanged(modules());
        key()->setModule(modules().first());
        keyChooser()->setModules(modules());
    }
}
コード例 #10
0
void CBibleReadWindow::reload(CSwordBackend::SetupChangedReason reason) {
    CLexiconReadWindow::reload(reason);

    if (m_modules.isEmpty()) {
        close();
        return;
    }

    //refresh the book lists
    verseKey()->setLocale( CSwordBackend::instance()->booknameLanguage().toLatin1() );
    keyChooser()->refreshContent();

    actionCollection()->readShortcuts("Bible shortcuts");
}
コード例 #11
0
void CLexiconReadWindow::initView()
{
	qDebug("CLexiconReadWindow::initView");
	setDisplayWidget( CDisplay::createReadInstance(this) );
	setMainToolBar( new QToolBar(this) );
	addToolBar(mainToolBar());
	setKeyChooser( CKeyChooser::createInstance(modules(), key(), mainToolBar()) );
	mainToolBar()->addWidget(keyChooser());
	setModuleChooserBar( new CModuleChooserBar(modules(), modules().first()->type(), this) );
	moduleChooserBar()->adjustSize();
	addToolBar(moduleChooserBar());
	setButtonsToolBar( new QToolBar(this) );
	addToolBar(buttonsToolBar());
	setWindowIcon(CToolClass::getIconForModule(modules().first()));
	setCentralWidget( displayWidget()->view() );
}
コード例 #12
0
void CLexiconReadWindow::initView() {
    qDebug() << "CLexiconReadWindow::initView";
    setDisplayWidget( CDisplay::createReadInstance(this) );
    setMainToolBar( new QToolBar(this) );
    mainToolBar()->setAllowedAreas(Qt::TopToolBarArea);
    mainToolBar()->setFloatable(false);
    addToolBar(mainToolBar());
    setKeyChooser( CKeyChooser::createInstance(modules(), key(), mainToolBar()) );
    mainToolBar()->addWidget(keyChooser());
    setModuleChooserBar( new CModuleChooserBar(modules(), modules().first()->type(), this) );
    moduleChooserBar()->adjustSize();
    addToolBar(moduleChooserBar());
    setButtonsToolBar( new QToolBar(this) );
    buttonsToolBar()->setAllowedAreas(Qt::TopToolBarArea);
    buttonsToolBar()->setFloatable(false);
    addToolBar(buttonsToolBar());
    setWindowIcon(util::tool::getIconForModule(modules().first()));
    setCentralWidget( displayWidget()->view() );
}
コード例 #13
0
void CPlainWriteWindow::initToolbars() {
    // Navigation toolbar
    setKeyChooser( CKeyChooser::createInstance(modules(),
        history(), key(), mainToolBar()) );
    mainToolBar()->addWidget(keyChooser());

    // Tools toolbar
    QAction* action = actionCollection()->action(CResMgr::displaywindows::commentaryWindow::syncWindow::actionName);
    Q_ASSERT(action != 0);
    buttonsToolBar()->addAction(action);
    action = actionCollection()->action(CResMgr::displaywindows::writeWindow::saveText::actionName);
    Q_ASSERT(action != 0);
    buttonsToolBar()->addAction(action);
    action = actionCollection()->action(CResMgr::displaywindows::writeWindow::deleteEntry::actionName);
    Q_ASSERT(action != 0);
    buttonsToolBar()->addAction(action);
    action = actionCollection()->action(CResMgr::displaywindows::writeWindow::restoreText::actionName);
    Q_ASSERT(action != 0);
    buttonsToolBar()->addAction(action);
}
コード例 #14
0
void CLexiconReadWindow::initToolbars() {
    //Navigation toolbar
    Q_ASSERT(m_actions.backInHistory);
    mainToolBar()->addWidget(keyChooser());
    mainToolBar()->addAction(m_actions.backInHistory); //1st button
    mainToolBar()->addAction(m_actions.forwardInHistory); //2nd button

    //Tools toolbar
    QAction* action = qobject_cast<QAction*>(actionCollection()->action(
                          CResMgr::displaywindows::general::search::actionName));
    Q_ASSERT( action );
    if (action) {
        buttonsToolBar()->addAction(action);
    }
    BtDisplaySettingsButton* button = new BtDisplaySettingsButton(buttonsToolBar());
    setDisplaySettingsButton(button);
    buttonsToolBar()->addWidget(button);

    // Text Header toolbar
    BtTextWindowHeader *h = new BtTextWindowHeader(modules().first()->type(), getModuleList(), this);
    headerBar()->addWidget(h);
}
コード例 #15
0
void CPlainWriteWindow::initConnections() {
    Q_ASSERT(keyChooser());
    QObject::connect(key()->beforeChangedSignaller(), SIGNAL(signal()), this, SLOT(beforeKeyChange()));
    QObject::connect(keyChooser(), SIGNAL(keyChanged(CSwordKey*)), this, SLOT(lookupSwordKey(CSwordKey*)));
    QObject::connect(displayWidget()->connectionsProxy(), SIGNAL(textChanged()), this, SLOT(textChanged()) );
}
コード例 #16
0
/** Moves to the next book. */
void CBibleReadWindow::nextVerse() {
    if (verseKey()->next(CSwordVerseKey::UseVerse)) {
        keyChooser()->setKey(key());
    }
}
コード例 #17
0
/** Moves one book behind. */
void CBibleReadWindow::previousVerse() {
    if (verseKey()->previous(CSwordVerseKey::UseVerse)) {
        keyChooser()->setKey(key());
    }
}
コード例 #18
0
/** Moves to the next book. */
void CCommentaryReadWindow::nextVerse() {
    if (verseKey()->next(CSwordVerseKey::UseVerse))
        keyChooser()->setKey(key());
}
コード例 #19
0
/** No descriptions */
void CLexiconReadWindow::previousEntry() {
    keyChooser()->setKey(ldKey()->PreviousEntry());
}
コード例 #20
0
/** No descriptions */
void CLexiconReadWindow::nextEntry() {
    keyChooser()->setKey(ldKey()->NextEntry());
}
コード例 #21
0
/** Moves one book behind. */
void CCommentaryReadWindow::previousVerse() {
    if (verseKey()->previous(CSwordVerseKey::UseVerse))
        keyChooser()->setKey(key());
}