Exemplo n.º 1
0
CDisplayWindow::CDisplayWindow(const QList<CSwordModuleInfo *> & modules, CMDIArea * parent)
        : QMainWindow(parent),
        m_actionCollection(0),
        m_mdi(parent),
        m_keyChooser(0),
        m_swordKey(0),
        m_isReady(false),
        m_moduleChooserBar(0),
        m_mainToolBar(0),
        m_buttonsToolBar(0),
        m_formatToolBar(0),
        m_headerBar(0),
        m_popupMenu(0),
        m_displayWidget(0),
        m_history(0) {
    setAttribute(Qt::WA_DeleteOnClose); //we want to destroy this window when it is closed
    m_actionCollection = new BtActionCollection(this);
    setModules(modules);

    // Connect this to the backend module list changes
    connect(CSwordBackend::instance(),
            SIGNAL(sigSwordSetupChanged(CSwordBackend::SetupChangedReason)),
            SLOT(reload(CSwordBackend::SetupChangedReason)));
    BibleTime* mainwindow = btMainWindow();
    connect(mainwindow, SIGNAL(toggledTextWindowHeader(bool)), SLOT(slotShowHeader(bool)) );
    connect(mainwindow, SIGNAL(toggledTextWindowNavigator(bool)), SLOT(slotShowNavigator(bool)) );
    connect(mainwindow, SIGNAL(toggledTextWindowToolButtons(bool)), SLOT(slotShowToolButtons(bool)) );
    connect(mainwindow, SIGNAL(toggledTextWindowModuleChooser(bool)), SLOT(slotShowModuleChooser(bool)) );
    connect(mainwindow, SIGNAL(toggledTextWindowFormatToolbar(bool)), SLOT(slotShowFormatToolBar(bool)) );
}
void BtInstallPage::initConnections() {
    qDebug("void BtInstallPage::initConnections() start");
    QObject::connect(m_pathCombo, SIGNAL(activated(const QString&)), this , SLOT(slotPathChanged(const QString&)));
    QObject::connect(m_configurePathButton, SIGNAL(clicked()), this, SLOT(slotEditPaths()));
    QObject::connect(m_installButton, SIGNAL(clicked()), m_sourceWidget, SLOT(slotInstall()) );

    QObject::connect(CPointers::backend(), SIGNAL(sigSwordSetupChanged(CSwordBackend::SetupChangedReason)), this, SLOT(slotSwordSetupChanged()));
    //source widget has its own connections, not here
}
BtIndexPage::BtIndexPage()
	: BtConfigPage()
{

	QVBoxLayout *vboxLayout;
	QHBoxLayout *hboxLayout;
    vboxLayout = new QVBoxLayout(this);
 
	m_autoDeleteOrphanedIndicesBox = new QCheckBox(this);
	m_autoDeleteOrphanedIndicesBox->setToolTip(tr("If selected, those indexes which have no corresponding work will be deleted when BibleTime starts"));
	m_autoDeleteOrphanedIndicesBox->setText(tr("Automatically delete orphaned indexes when BibleTime starts"));
	vboxLayout->addWidget(m_autoDeleteOrphanedIndicesBox);

	m_moduleList = new QTreeWidget(this);
	vboxLayout->addWidget(m_moduleList);

	hboxLayout = new QHBoxLayout();

	QSpacerItem *spacerItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
	hboxLayout->addItem(spacerItem);

	m_deleteButton = new QPushButton(this);
	m_deleteButton->setToolTip(tr("Delete the selected indexes"));
	m_deleteButton->setText(tr("Delete"));
	hboxLayout->addWidget(m_deleteButton);

	m_createButton = new QPushButton(this);
	m_createButton->setToolTip(tr("Create new indexes for the selected works"));
	m_createButton->setText(tr("Create..."));
	hboxLayout->addWidget(m_createButton);

	vboxLayout->addLayout(hboxLayout);

	// configure the list view
	m_moduleList->setHeaderLabels( (QStringList(tr("Work")) << tr("Index size")) );
	m_moduleList->setRootIsDecorated(true);
	m_moduleList->setColumnWidth(0, CToolClass::mWidth(m_moduleList, 20) );
	//m_moduleList->setTextAlignment(1, Qt::AlignRight); see doc...
	m_moduleList->setSortingEnabled(false);

	m_autoDeleteOrphanedIndicesBox->setChecked( CBTConfig::get( CBTConfig::autoDeleteOrphanedIndices ) );

	// icons for our buttons
	m_createButton->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::bookshelfmgr::indexpage::create_icon));
	m_deleteButton->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::bookshelfmgr::indexpage::delete_icon));

	// connect our signals/slots
	connect(m_createButton, SIGNAL(clicked()), this, SLOT(createIndices()));
	connect(m_deleteButton, SIGNAL(clicked()), this, SLOT(deleteIndices()));
	connect(CPointers::backend(), SIGNAL(sigSwordSetupChanged(CSwordBackend::SetupChangedReason)), SLOT(slotSwordSetupChanged()));

	populateModuleList();
}
/** Initialize the SIGNAL<->SLOT connections */
void CBookshelfIndex::initConnections()
{
//	qDebug("CBookshelfIndex::initConnections");

	//Connect this to the backend module list changes.
	connect(CPointers::backend(), SIGNAL(sigSwordSetupChanged(CSwordBackend::SetupChangedReason)), SLOT(reloadSword(CSwordBackend::SetupChangedReason)));
	
	QObject::connect(this, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(slotExecuted(QTreeWidgetItem*)));

	// Single/double click item activation is style dependend
	if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) == 0) {
		QObject::connect(this, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(slotExecuted(QTreeWidgetItem*)));
	}