0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 16:44:39 +03:00
LimeReport/limereport/databrowser/lrdatabrowser.h

136 lines
5.7 KiB
C
Raw Normal View History

2016-02-17 10:11:00 +03:00
/***************************************************************************
* This file is part of the Lime Report project *
2021-08-18 20:21:36 +03:00
* Copyright (C) 2021 by Alexander Arin *
2016-02-17 10:11:00 +03:00
* arin_a@bk.ru *
* *
** GNU General Public License Usage **
* *
* This library is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
** GNU Lesser General Public License **
* *
* This library is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library. *
* If not, see <http://www.gnu.org/licenses/>. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
****************************************************************************/
#ifndef LRDATABROWSER_H
#define LRDATABROWSER_H
#include "lrdatabrowsertree.h"
2016-02-17 10:11:00 +03:00
#include "lrreportdesignwidget.h"
#include "lrsqleditdialog.h"
#include <QDockWidget>
#include <QToolButton>
#include <QTreeWidget>
#include <QWidget>
namespace LimeReport {
2016-02-17 10:11:00 +03:00
namespace Ui {
class DataBrowser;
}
class DataBrowser: public QWidget, public IConnectionController {
2016-02-17 10:11:00 +03:00
Q_OBJECT
public:
explicit DataBrowser(QWidget* parent = 0);
2016-02-17 10:11:00 +03:00
~DataBrowser();
QSize sizeHint() const;
void setReportEditor(LimeReport::ReportDesignWidget* report);
void setMainWindow(QMainWindow* mainWindow);
void initConnections();
void updateDataTree();
void updateVariablesTree();
void closeAllDataWindows();
void setSettings(QSettings* value, bool owned = false);
QSettings* settings();
QString lastError() const;
void setLastError(const QString& lastError);
2016-02-17 10:11:00 +03:00
private slots:
void slotDatasourcesChanged();
void slotAddConnection();
void slotDeleteConnection();
void slotAddDataSource();
void slotViewDatasource();
void slotEditDatasource();
void slotDeleteDatasource();
void slotSQLEditingFinished(SQLEditResult result);
void slotClear();
void slotDataWindowClosed();
void slotChangeConnection();
void slotChangeConnectionState();
void slotVariableEditorAccept(const QString& variable);
void on_dataTree_currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
2016-02-17 10:11:00 +03:00
void on_editVariable_clicked();
void on_deleteVariable_clicked();
void on_addVariable_clicked();
void on_variablesTree_currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
2016-02-17 10:11:00 +03:00
void on_errorMessage_clicked();
2016-06-07 00:44:21 +03:00
void on_varToReport_clicked();
void on_variablesTree_itemDoubleClicked(QTreeWidgetItem* item, int);
2016-06-07 00:44:21 +03:00
2016-02-17 10:11:00 +03:00
private:
enum NameType {
NameForUser,
NameForReport
};
2016-02-17 10:11:00 +03:00
QString getDatasourceName();
QString getConnectionName(NameType nameType);
2016-02-17 10:11:00 +03:00
QString getVariable();
bool isClosingWindows() const { return m_closingWindows; }
QTreeWidgetItem* findByNameAndType(QString name, int itemType);
void fillFields(QTreeWidgetItem* parentItem, LimeReport::IDataSource* dataSource);
2016-02-17 10:11:00 +03:00
QDockWidget* createDataWindow(QString datasourceName);
void closeDataWindow(QString datasourceName);
QDockWidget* dataWindow(QString datasourceName);
void showDataWindow(QString datasourceName);
void removeDatasource(QString datasourceName);
void addQuery(SQLEditResult result);
void changeQuery(SQLEditResult result);
void addSubQuery(SQLEditResult result);
void changeSubQuery(SQLEditResult result);
void addProxy(SQLEditResult result);
void changeProxy(SQLEditResult result);
void addCSV(SQLEditResult result);
void changeCSV(SQLEditResult result);
SQLEditResult::ResultMode currentDatasourceType(const QString& datasourceName);
void applyChanges(SQLEditResult result);
void addDatasource(SQLEditResult result);
void addConnectionDesc(ConnectionDesc* connection);
void changeConnectionDesc(ConnectionDesc* connection);
bool checkConnectionDesc(ConnectionDesc* connection);
bool containsDefaultConnection();
void activateItem(const QString& name, DataBrowserTree::NodeType type);
2016-02-17 10:11:00 +03:00
private:
Ui::DataBrowser* ui;
ReportDesignWidget* m_report;
QMap<QString, QDockWidget*> m_dataWindows;
QMainWindow* m_mainWindow;
bool m_closingWindows;
QSettings* m_settings;
bool m_ownedSettings;
QString m_lastError;
2016-02-17 10:11:00 +03:00
};
} // namespace LimeReport
2016-02-17 10:11:00 +03:00
#endif // LRDATABROWSER_H