| 20 | #include "ui_FrmHistory.h" |
| 21 | |
| 22 | static Q_LOGGING_CATEGORY(log, "WebBrowser.History") |
| 23 | CFrmHistory::CFrmHistory(CParameterWebBrowser *pPara, |
| 24 | QWidget *parent) |
| 25 | : QWidget(parent) |
| 26 | , ui(new Ui::CFrmHistory) |
| 27 | , m_pModelHistory(nullptr) |
| 28 | , m_pPara(pPara) |
| 29 | , m_pDateStart(nullptr) |
| 30 | , m_pDateEnd(nullptr) |
| 31 | { |
| 32 | bool check = false; |
| 33 | ui->setupUi(this); |
| 34 | ui->treeView->hide(); |
| 35 | |
| 36 | setWindowTitle(tr("History")); |
| 37 | |
| 38 | QToolBar* pToolBar = ui->toolBar; |
| 39 | |
| 40 | QDate curDate = QDate::currentDate(); |
| 41 | m_pDateStart = new QDateEdit(curDate.addDays(-7), pToolBar); |
| 42 | if(m_pDateStart) |
| 43 | m_pDateStart->setToolTip(tr("Start date")); |
| 44 | m_pDateEnd = new QDateEdit(curDate, pToolBar); |
| 45 | if(m_pDateEnd) |
| 46 | m_pDateEnd->setToolTip(tr("End date")); |
| 47 | QComboBox* pCB = new QComboBox(pToolBar); |
| 48 | pCB->addItem(tr("One day"), 1); |
| 49 | pCB->addItem(tr("Two days"), 2); |
| 50 | pCB->addItem(tr("One Week"), 7); |
| 51 | pCB->addItem(tr("One month"), curDate.daysInMonth()); |
| 52 | pCB->setCurrentIndex(2); |
| 53 | check = connect(pCB, SIGNAL(currentIndexChanged(int)), |
| 54 | this, SLOT(slotComboxIndexChanged(int))); |
| 55 | Q_ASSERT(check); |
| 56 | |
| 57 | pToolBar->addWidget(pCB); |
| 58 | pToolBar->addWidget(m_pDateStart); |
| 59 | pToolBar->addWidget(m_pDateEnd); |
| 60 | |
| 61 | QAction* pRefresh = pToolBar->addAction( |
| 62 | QIcon::fromTheme("view-refresh"), tr("Refresh"), |
| 63 | this, &CFrmHistory::slotRefresh); |
| 64 | if(pRefresh) { |
| 65 | pRefresh->setToolTip(pRefresh->text()); |
| 66 | pRefresh->setStatusTip(pRefresh->text()); |
| 67 | } |
| 68 | |
| 69 | pToolBar->addSeparator(); |
| 70 | QSpinBox* pSBLimit = new QSpinBox(pToolBar); |
| 71 | if(pSBLimit) { |
| 72 | pToolBar->addWidget(pSBLimit); |
| 73 | pSBLimit->setToolTip(tr("Limit")); |
| 74 | int nMax = 1000; |
| 75 | if(m_pPara) |
| 76 | nMax = qMax(nMax, m_pPara->GetDatabaseViewLimit()); |
| 77 | pSBLimit->setRange(-1, nMax); |
| 78 | if(m_pPara) |
| 79 | pSBLimit->setValue(m_pPara->GetDatabaseViewLimit()); |
nothing calls this directly
no test coverage detected