diff --git a/include/lrglobal.h b/include/lrglobal.h
index be094a4..0894ee0 100644
--- a/include/lrglobal.h
+++ b/include/lrglobal.h
@@ -80,12 +80,14 @@ namespace Const{
QString extractClassName(QString className);
enum RenderPass {FirstPass, SecondPass};
enum ArrangeType {AsNeeded, Force};
- enum PreviewHint{ShowAllPreviewBars=0,
- HidePreviewToolBar=1,
- HidePreviewMenuBar=2,
- HidePreviewStatusBar=4,
- HideAllPreviewBar=7};
+ enum PreviewHint{ShowAllPreviewBars = 0,
+ HidePreviewToolBar = 1,
+ HidePreviewMenuBar = 2,
+ HidePreviewStatusBar = 4,
+ HideAllPreviewBar = 7,
+ PreviewBarsUserSetting = 8};
Q_DECLARE_FLAGS(PreviewHints, PreviewHint)
+ Q_FLAGS(PreviewHints)
class ReportError : public std::runtime_error{
public:
diff --git a/include/lrreportengine.h b/include/lrreportengine.h
index f89db86..48ce408 100644
--- a/include/lrreportengine.h
+++ b/include/lrreportengine.h
@@ -71,7 +71,7 @@ public:
bool printReport(QPrinter *printer=0);
void printToFile(const QString& fileName);
bool printToPDF(const QString& fileName);
- void previewReport(PreviewHints hints = ShowAllPreviewBars);
+ void previewReport(PreviewHints hints = PreviewBarsUserSetting);
void designReport();
void setShowProgressDialog(bool value);
IDataSourceManager* dataManager();
diff --git a/limereport/images/checked.png b/limereport/images/checked.png
new file mode 100644
index 0000000..e505891
Binary files /dev/null and b/limereport/images/checked.png differ
diff --git a/limereport/images/not_checked.png b/limereport/images/not_checked.png
new file mode 100644
index 0000000..daf1aa3
Binary files /dev/null and b/limereport/images/not_checked.png differ
diff --git a/limereport/images/toolbar.png b/limereport/images/toolbar.png
new file mode 100644
index 0000000..06e6300
Binary files /dev/null and b/limereport/images/toolbar.png differ
diff --git a/limereport/lrglobal.h b/limereport/lrglobal.h
index be094a4..0894ee0 100644
--- a/limereport/lrglobal.h
+++ b/limereport/lrglobal.h
@@ -80,12 +80,14 @@ namespace Const{
QString extractClassName(QString className);
enum RenderPass {FirstPass, SecondPass};
enum ArrangeType {AsNeeded, Force};
- enum PreviewHint{ShowAllPreviewBars=0,
- HidePreviewToolBar=1,
- HidePreviewMenuBar=2,
- HidePreviewStatusBar=4,
- HideAllPreviewBar=7};
+ enum PreviewHint{ShowAllPreviewBars = 0,
+ HidePreviewToolBar = 1,
+ HidePreviewMenuBar = 2,
+ HidePreviewStatusBar = 4,
+ HideAllPreviewBar = 7,
+ PreviewBarsUserSetting = 8};
Q_DECLARE_FLAGS(PreviewHints, PreviewHint)
+ Q_FLAGS(PreviewHints)
class ReportError : public std::runtime_error{
public:
diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp
index 53f78cb..788ab5b 100644
--- a/limereport/lrpreviewreportwindow.cpp
+++ b/limereport/lrpreviewreportwindow.cpp
@@ -70,6 +70,7 @@ PreviewReportWindow::PreviewReportWindow(ReportEnginePrivate *report,QWidget *pa
connect(m_previewReportWidget, SIGNAL(scalePercentChanged(int)), this, SLOT(slotScalePercentChanged(int)));
connect(m_scalePercent, SIGNAL(currentIndexChanged(QString)), this, SLOT(scaleComboboxChanged(QString)));
restoreSetting();
+ selectStateIcon();
}
void PreviewReportWindow::writeSetting()
@@ -138,7 +139,8 @@ void PreviewReportWindow::setErrorMessages(const QStringList &value){
void PreviewReportWindow::setToolBarVisible(bool value)
{
- ui->toolBar->setVisible(value);
+ ui->toolBar->setHidden(value);
+ selectStateIcon();
}
void PreviewReportWindow::setStatusBarVisible(bool value)
@@ -224,6 +226,15 @@ void PreviewReportWindow::moveEvent(QMoveEvent* e)
#endif
}
+void PreviewReportWindow::selectStateIcon()
+{
+ if (ui->toolBar->isHidden()){
+ ui->actionShow_Toolbar->setIcon(QIcon(":/report/images/not_checked.png"));
+ } else {
+ ui->actionShow_Toolbar->setIcon(QIcon(":/report/images/checked.png"));
+ }
+}
+
void PreviewReportWindow::slotPrint()
{
m_previewReportWidget->print();
@@ -327,4 +338,13 @@ void PreviewReportWindow::on_actionShowMessages_toggled(bool value)
m_previewReportWidget->setErrorsMesagesVisible(value);
}
+void PreviewReportWindow::on_actionShow_Toolbar_triggered()
+{
+ setToolBarVisible(!ui->toolBar->isHidden());
+ writeSetting();
+}
+
}// namespace LimeReport
+
+
+
diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h
index 5efacdd..50243e1 100644
--- a/limereport/lrpreviewreportwindow.h
+++ b/limereport/lrpreviewreportwindow.h
@@ -69,6 +69,7 @@ protected:
void closeEvent(QCloseEvent *);
void resizeEvent(QResizeEvent *e);
void moveEvent(QMoveEvent *e);
+ void selectStateIcon();
public slots:
void slotPrint();
void slotPriorPage();
@@ -89,6 +90,7 @@ private slots:
void scaleComboboxChanged(QString text);
void slotScalePercentChanged(int percent);
void on_actionShowMessages_toggled(bool value);
+ void on_actionShow_Toolbar_triggered();
private:
ItemsReaderIntf* reader();
diff --git a/limereport/lrpreviewreportwindow.ui b/limereport/lrpreviewreportwindow.ui
index 7618999..7db29c1 100644
--- a/limereport/lrpreviewreportwindow.ui
+++ b/limereport/lrpreviewreportwindow.ui
@@ -35,7 +35,7 @@
0
0
800
- 21
+ 20
diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp
index c52eef2..b924f43 100644
--- a/limereport/lrreportengine.cpp
+++ b/limereport/lrreportengine.cpp
@@ -328,9 +328,11 @@ void ReportEnginePrivate::previewReport(PreviewHints hints)
w->setErrorMessages(dataManager()->errorsList());
}
- w->setMenuVisible(!hints.testFlag(HidePreviewMenuBar));
- w->setStatusBarVisible(!hints.testFlag(HidePreviewStatusBar));
- w->setToolBarVisible(!hints.testFlag(HidePreviewToolBar));
+ if (!hints.testFlag(PreviewBarsUserSetting)){
+ w->setMenuVisible(!hints.testFlag(HidePreviewMenuBar));
+ w->setStatusBarVisible(!hints.testFlag(HidePreviewStatusBar));
+ w->setToolBarVisible(!hints.testFlag(HidePreviewToolBar));
+ }
m_activePreview = w;
connect(w,SIGNAL(destroyed(QObject*)), this, SLOT(slotPreviewWindowDestroed(QObject*)));
diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h
index f89db86..48ce408 100644
--- a/limereport/lrreportengine.h
+++ b/limereport/lrreportengine.h
@@ -71,7 +71,7 @@ public:
bool printReport(QPrinter *printer=0);
void printToFile(const QString& fileName);
bool printToPDF(const QString& fileName);
- void previewReport(PreviewHints hints = ShowAllPreviewBars);
+ void previewReport(PreviewHints hints = PreviewBarsUserSetting);
void designReport();
void setShowProgressDialog(bool value);
IDataSourceManager* dataManager();
diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h
index a88e6ca..ecadd87 100644
--- a/limereport/lrreportengine_p.h
+++ b/limereport/lrreportengine_p.h
@@ -80,7 +80,7 @@ public:
bool printReport(QPrinter *printer=0);
void printToFile(const QString& fileName);
bool printToPDF(const QString& fileName);
- void previewReport(PreviewHints hints = ShowAllPreviewBars);
+ void previewReport(PreviewHints hints = PreviewBarsUserSetting);
void designReport();
void setSettings(QSettings* value);
void setShowProgressDialog(bool value){m_showProgressDialog = value;}
diff --git a/limereport/report.qrc b/limereport/report.qrc
index ad0f243..0c3c2ea 100644
--- a/limereport/report.qrc
+++ b/limereport/report.qrc
@@ -165,5 +165,8 @@
images/FitWidth.png
images/OneToOne.png
images/logo_32x32.png
+ images/toolbar.png
+ images/not_checked.png
+ images/checked.png