~pkgcrosswire/bibletime/main

« back to all changes in this revision

Viewing changes to src/frontend/bookshelfmanager/removepage/btremovepage.cpp

  • Committer: Jonathan Marsden
  • Date: 2011-12-23 20:32:12 UTC
  • Revision ID: jmarsden@fastmail.fm-20111223203212-1g3e35rlhbys07iu
New upstream version 2.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#include "frontend/bookshelfmanager/removepage/btremovepage.h"
14
14
 
15
15
#include <QAction>
 
16
#include <QDebug>
16
17
#include <QGroupBox>
17
18
#include <QHBoxLayout>
18
19
#include <QHeaderView>
22
23
#include <QVBoxLayout>
23
24
#include "backend/bookshelfmodel/btbookshelffiltermodel.h"
24
25
#include "backend/managers/cswordbackend.h"
 
26
#include "frontend/bookshelfmanager/btmodulemanagerdialog.h"
25
27
#include "frontend/btbookshelfview.h"
26
28
#include "frontend/btbookshelfwidget.h"
27
29
#include "util/cresmgr.h"
37
39
const QString groupingOrderKey("GUI/BookshelfManager/RemovePage/grouping");
38
40
}
39
41
 
40
 
BtRemovePage::BtRemovePage(QWidget *parent)
41
 
        : BtConfigPage(parent)
 
42
BtRemovePage::BtRemovePage(BtModuleManagerDialog *parent)
 
43
        : BtConfigDialog::Page(util::directory::getIcon(CResMgr::bookshelfmgr::removepage::icon), parent)
42
44
{
43
45
    namespace DU = util::directory;
44
46
 
45
 
    m_worksGroupBox = new QGroupBox(tr("Select &works to uninstall:"), this);
 
47
    m_worksGroupBox = new QGroupBox(this);
46
48
    m_worksGroupBox->setFlat(true);
47
49
    QVBoxLayout *wLayout = new QVBoxLayout;
48
50
    wLayout->setContentsMargins(0, 0, 0, 0);
65
67
 
66
68
    m_uninstallGroupBox = new QGroupBox(this);
67
69
    m_uninstallGroupBox->setFlat(true);
68
 
    retranslateUninstallGroupBox();
69
70
    QHBoxLayout *uLayout = new QHBoxLayout;
70
71
    uLayout->setContentsMargins(0, 0, 0, 0);
71
72
    m_uninstallGroupBox->setLayout(uLayout);
72
73
    uLayout->addStretch(1);
73
74
 
74
 
    m_removeButton = new QPushButton(tr("&Remove..."), this);
75
 
    m_removeButton->setToolTip(tr("Remove the selected works"));
 
75
    m_removeButton = new QPushButton(this);
76
76
    m_removeButton->setIcon(DU::getIcon(CResMgr::bookshelfmgr::removepage::remove_icon));
77
77
    m_removeButton->setEnabled(false);
78
78
    uLayout->addWidget(m_removeButton, 0, Qt::AlignRight);
79
79
 
80
 
    Q_ASSERT(qobject_cast<QVBoxLayout*>(layout()) != 0);
81
 
    QVBoxLayout *mainLayout = static_cast<QVBoxLayout*>(layout());
 
80
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
82
81
    mainLayout->addWidget(m_worksGroupBox, 1);
83
82
    mainLayout->addWidget(m_uninstallGroupBox);
84
83
 
88
87
            this,                           SLOT(slotResetRemoveButton()));
89
88
    connect(m_bookshelfWidget->treeModel(), SIGNAL(rowsRemoved(const QModelIndex&,int,int)),
90
89
            this,                           SLOT(slotResetRemoveButton()));
91
 
}
92
 
 
93
 
const QIcon &BtRemovePage::icon() const {
94
 
    return util::directory::getIcon(CResMgr::bookshelfmgr::removepage::icon);
95
 
}
96
 
 
97
 
QString BtRemovePage::header() const {
98
 
    return tr("Remove");
 
90
 
 
91
    retranslateUi();
 
92
}
 
93
 
 
94
void BtRemovePage::retranslateUi() {
 
95
    setHeaderText(tr("Remove"));
 
96
 
 
97
    m_worksGroupBox->setTitle(tr("Select &works to uninstall:"));
 
98
 
 
99
    m_removeButton->setText(tr("&Remove..."));
 
100
    m_removeButton->setToolTip(tr("Remove the selected works"));
 
101
 
 
102
    retranslateUninstallGroupBox();
99
103
}
100
104
 
101
105
void BtRemovePage::retranslateUninstallGroupBox() {