void BtConfigDialog::addPage(BtConfigPage* pageWidget) { // this is a friend pageWidget->m_parentDialog = this; QVBoxLayout* containerLayout = new QVBoxLayout; QLabel* headerLabel = CToolClass::explanationLabel(pageWidget, pageWidget->header(), pageWidget->label()); containerLayout->addWidget(headerLabel); containerLayout->addWidget(pageWidget); QWidget* containerWidget = new QWidget(m_pageWidget); containerWidget->setLayout(containerLayout); m_pageWidget->addWidget(containerWidget); QListWidgetItem* item = new QListWidgetItem(m_contentsList); item->setIcon(util::filesystem::DirectoryUtil::getIcon(pageWidget->iconName())); item->setText(pageWidget->header()); item->setTextAlignment(Qt::AlignHCenter); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); //set the list width - it may bee too wide (if there were no pages) or too narrow if (m_maxItemWidth < m_contentsList->visualItemRect(item).width()) { m_maxItemWidth = m_contentsList->visualItemRect(item).width(); m_contentsList->setFixedWidth( m_maxItemWidth + (m_contentsList->frameWidth()*2) ); } // all items should has the same width for(int i = 0; i < m_contentsList->count(); ++i) { m_contentsList->item(i)->setSizeHint(QSize(m_maxItemWidth, m_contentsList->visualItemRect(m_contentsList->item(i)).height()) ); } slotChangePage(m_contentsList->row(item)); }
BtModuleManagerDialog::BtModuleManagerDialog(QWidget* parent) : BtConfigDialog(parent) { setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(tr("Bookshelf Manager")); // Install page BtInstallPage* installPage = new BtInstallPage(); addPage(installPage); //Uninstall page BtRemovePage* removePage = new BtRemovePage(); addPage(removePage); //Index page BtIndexPage* indexPage = new BtIndexPage(); addPage(indexPage); slotChangePage(0); // Dialog button (Close) QDialogButtonBox* bbox = new QDialogButtonBox(this); bbox->addButton(QDialogButtonBox::Close); util::prepareDialogBox(bbox); addButtonBox(bbox); connect(bbox, SIGNAL(rejected()), SLOT(close())); loadDialogSettings(); }
MiniBar::MiniBar( QWidget * parent, KPDFDocument * document ) : QFrame( parent, "miniBar" ), m_document( document ), m_currentPage( -1 ) { // left spacer QHBoxLayout * horLayout = new QHBoxLayout( this ); QSpacerItem * spacerL = new QSpacerItem( 20, 10, QSizePolicy::Expanding ); horLayout->addItem( spacerL ); // central 2r by 3c grid layout that contains all components QGridLayout * gridLayout = new QGridLayout( 0, 3,5, 2,1 ); // top spacer 6x6 px // QSpacerItem * spacerTop = new QSpacerItem( 6, 6, QSizePolicy::Fixed, QSizePolicy::Fixed ); // gridLayout->addMultiCell( spacerTop, 0, 0, 0, 4 ); // center progress widget m_progressWidget = new ProgressWidget( this ); gridLayout->addMultiCellWidget( m_progressWidget, 0, 0, 0, 4 ); // bottom: left prev_page button m_prevButton = new HoverButton( this ); m_prevButton->setIconSet( SmallIconSet( QApplication::reverseLayout() ? "1rightarrow" : "1leftarrow" ) ); gridLayout->addWidget( m_prevButton, 1, 0 ); // bottom: left lineEdit (current page box) m_pagesEdit = new PagesEdit( this ); gridLayout->addWidget( m_pagesEdit, 1, 1 ); // bottom: central '/' label gridLayout->addWidget( new QLabel( "/", this ), 1, 2 ); // bottom: right button m_pagesButton = new HoverButton( this ); gridLayout->addWidget( m_pagesButton, 1, 3 ); // bottom: right next_page button m_nextButton = new HoverButton( this ); m_nextButton->setIconSet( SmallIconSet( QApplication::reverseLayout() ? "1leftarrow" : "1rightarrow" ) ); gridLayout->addWidget( m_nextButton, 1, 4 ); horLayout->addLayout( gridLayout ); // right spacer QSpacerItem * spacerR = new QSpacerItem( 20, 10, QSizePolicy::Expanding ); horLayout->addItem( spacerR ); // customize own look setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); // connect signals from child widgets to internal handlers / signals bouncers connect( m_pagesEdit, SIGNAL( returnPressed() ), this, SLOT( slotChangePage() ) ); connect( m_pagesButton, SIGNAL( clicked() ), this, SIGNAL( gotoPage() ) ); connect( m_prevButton, SIGNAL( clicked() ), this, SIGNAL( prevPage() ) ); connect( m_nextButton, SIGNAL( clicked() ), this, SIGNAL( nextPage() ) ); // widget starts hidden (will be shown after opening a document) parent->hide(); }
CConfigurationDialog::CConfigurationDialog(QWidget * parent, BtActionCollection* actionCollection ) : BtConfigDialog(parent), m_actionCollection(actionCollection), m_displayPage(0), m_swordPage(0), m_acceleratorsPage(0), m_languagesPage(0), m_bbox(0) { setWindowTitle(tr("Configure BibleTime")); setAttribute(Qt::WA_DeleteOnClose); // Add "Display" page m_displayPage = new CDisplaySettingsPage(this); addPage(m_displayPage); // Add "Desk" (sword) page m_swordPage = new CSwordSettingsPage(this); addPage(m_swordPage); // Add "Languages" (fonts) page m_languagesPage = new CLanguageSettingsPage(this); addPage(m_languagesPage); // // Add "Keyboard" (accelerators) page // m_acceleratorsPage = new CAcceleratorSettingsPage(this); // KPageWidgetItem* accelPage = new KPageWidgetItem(m_acceleratorsPage); // accelPage->setHeader( tr( "HotKeys" ) ); // accelPage->setName( tr( "HotKeys" ) ); // accelPage->setIcon( KIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::settings::keys::icon)) ); // addPage(accelPage); // Dialog buttons m_bbox = new QDialogButtonBox(this); m_bbox->addButton(QDialogButtonBox::Ok); m_bbox->addButton(QDialogButtonBox::Apply); m_bbox->addButton(QDialogButtonBox::Cancel); util::prepareDialogBox(m_bbox); addButtonBox(m_bbox); bool ok = connect(m_bbox, SIGNAL(clicked(QAbstractButton *)), SLOT(slotButtonClicked(QAbstractButton *))); Q_ASSERT(ok); loadDialogSettings(); slotChangePage(0); }
CAlarmSortedView::CAlarmSortedView(CDialogAlarm *parent) : QWidget ( (QWidget*)parent ), m_filter(new CAlarmSortFilterProxyModel(ROW_PER_PAGE)), m_nbPage(1), m_numPage(0), m_parent(parent) { m_layout = new QHBoxLayout(); m_listView = new QListView(this); m_layout->addWidget(m_listView); m_listView->setEditTriggers( QAbstractItemView::NoEditTriggers ); m_listView->setResizeMode(QListView::Adjust); m_layout->setContentsMargins ( 0, 0, 0, 0 ); this->setLayout(m_layout); QSizePolicy expandPolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); this->setSizePolicy(expandPolicy); connect(m_filter, SIGNAL(pageChanged()), this, SLOT(slotChangePage())); }