diff --git a/plugins/generic/skg_properties/skgpropertiesplugin.cpp b/plugins/generic/skg_properties/skgpropertiesplugin.cpp index 7970fdabc..ee1c46921 100644 --- a/plugins/generic/skg_properties/skgpropertiesplugin.cpp +++ b/plugins/generic/skg_properties/skgpropertiesplugin.cpp @@ -1,355 +1,355 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ /** @file * A plugin to manage properties on objects * * @author Stephane MANKOWSKI */ #include "skgpropertiesplugin.h" #include #include #include #include #include #include #include #include "skgmainpanel.h" #include "skgpropertiesplugindockwidget.h" #include "skgtraces.h" #include "skgtransactionmng.h" /** * This plugin factory. */ K_PLUGIN_FACTORY(SKGPropertiesPluginFactory, registerPlugin();) SKGPropertiesPlugin::SKGPropertiesPlugin(QWidget* iWidget, QObject* iParent, const QVariantList& /*iArg*/) : SKGInterfacePlugin(iParent), m_currentDocument(nullptr), m_dockWidget(nullptr), m_dockContent(nullptr), m_addPropertyMenu(nullptr) { Q_UNUSED(iWidget) SKGTRACEINFUNC(10) // Get list of bills m_billsProcess.setStandardOutputFile(QDir::tempPath() % "/skg_bills.csv"); m_billsProcess.start(QStringLiteral("boobill bills -q -f csv -v")); connect(&m_billsProcess, QOverload::of(&QProcess::finished), this, &SKGPropertiesPlugin::onBillsRetreived); - connect(&m_billsProcess, static_cast(&QProcess::error), this, &SKGPropertiesPlugin::onBillsRetreived); + connect(&m_billsProcess, static_cast(&QProcess::errorOccurred), this, &SKGPropertiesPlugin::onBillsRetreived); } SKGPropertiesPlugin::~SKGPropertiesPlugin() { SKGTRACEINFUNC(10) m_currentDocument = nullptr; m_dockWidget = nullptr; m_dockContent = nullptr; m_addPropertyMenu = nullptr; if (m_billsProcess.state() == QProcess::Running) { m_billsProcess.kill(); } } void SKGPropertiesPlugin::onBillsRetreived() { QFile file(QDir::tempPath() % "/skg_bills.csv"); if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { QTextStream stream(&file); stream.readLine(); // To avoid header id;date;format;label;idparent;price;currency;deadline;startdate;finishdate while (!stream.atEnd()) { // Read line QString line = stream.readLine().trimmed(); m_bills.push_back(line); } // close file file.close(); } file.remove(); } bool SKGPropertiesPlugin::setupActions(SKGDocument* iDocument) { SKGTRACEINFUNC(10) m_currentDocument = iDocument; setComponentName(QStringLiteral("skg_properties"), title()); setXMLFile(QStringLiteral("skg_properties.rc")); m_dockContent = new SKGPropertiesPluginDockWidget(SKGMainPanel::getMainPanel(), m_currentDocument); if (m_dockContent != nullptr) { connect(m_dockContent, &SKGPropertiesPluginDockWidget::selectionChanged, SKGMainPanel::getMainPanel(), &SKGMainPanel::refresh); m_dockWidget = new QDockWidget(SKGMainPanel::getMainPanel()); if (m_dockWidget != nullptr) { m_dockWidget->setObjectName(QStringLiteral("skg_properties_docwidget")); m_dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); m_dockWidget->setWindowTitle(title()); m_dockWidget->setWidget(m_dockContent); // add action to control hide / display of Bookmarks QAction* toggle = m_dockWidget->toggleViewAction(); QAction* panelAction = actionCollection()->addAction(QStringLiteral("view_properties")); registerGlobalAction(QStringLiteral("view_properties"), panelAction); panelAction->setCheckable(true); panelAction->setChecked(toggle->isChecked()); panelAction->setText(toggle->text()); actionCollection()->setDefaultShortcut(panelAction, Qt::SHIFT + Qt::Key_F12); connect(panelAction, &QAction::triggered, toggle, &QAction::trigger); connect(toggle, &QAction::toggled, panelAction, &QAction::setChecked); } } // Menu auto actAddProperty = new KToolBarPopupAction(SKGServices::fromTheme(icon()), i18nc("Allows user to add a user defined property on an object", "Add property"), this); m_addPropertyMenu = actAddProperty->menu(); connect(m_addPropertyMenu, &QMenu::aboutToShow, this, &SKGPropertiesPlugin::onShowAddPropertyMenu); actAddProperty->setStickyMenu(false); actAddProperty->setDelayed(false); registerGlobalAction(QStringLiteral("add_property"), actAddProperty, QStringList() << QStringLiteral("query:type='table' AND name NOT LIKE 'doctransaction%'"), 1, -1, 450); return true; } void SKGPropertiesPlugin::onAddProperty() { SKGTRACEINFUNC(10) SKGError err; // Scope for the transaction auto* act = qobject_cast(sender()); if ((act != nullptr) && (m_currentDocument != nullptr)) { // Get parameters QStringList list = act->data().toStringList(); const QString& name = list.at(0); const QString& value = list.at(1); // Create properties IFOK(err) { SKGObjectBase::SKGListSKGObjectBase selection = SKGMainPanel::getMainPanel()->getSelectedObjects(); int nb = selection.count(); SKGBEGINPROGRESSTRANSACTION(*m_currentDocument, i18nc("Create a user defined property", "Property creation"), err, nb) for (int i = 0; !err && i < nb; ++i) { err = selection.at(i).setProperty(name, value); IFOKDO(err, m_currentDocument->stepForward(i + 1)) } } } // status bar IFOK(err) { err = SKGError(0, i18nc("The user defined property was successfully created", "Property created")); } SKGMainPanel::displayErrorMessage(err); } void SKGPropertiesPlugin::onDownloadAndAddBills() { SKGTRACEINFUNC(10) SKGError err; // Scope for the transaction auto* act = qobject_cast(sender()); if ((act != nullptr) && (m_currentDocument != nullptr)) { // Get parameters QStringList list = act->data().toStringList(); const QString& id = list.at(0); QString fileName = QDir::tempPath() % '/' % list.at(3) % '.' % list.at(2); // Create properties IFOK(err) { SKGObjectBase::SKGListSKGObjectBase selection = SKGMainPanel::getMainPanel()->getSelectedObjects(); int nb = selection.count(); SKGBEGINPROGRESSTRANSACTION(*m_currentDocument, i18nc("Create a user defined property", "Property creation"), err, 2 * nb) for (int i = 0; !err && i < nb; ++i) { // Download the files QFile::remove(fileName); QString cmd = "boobill download " % id % " \"" % fileName % '"'; QProcess p; p.start(cmd); if (!p.waitForFinished(60000) || p.exitCode() != 0) { err.setReturnCode(ERR_FAIL).setMessage(i18nc("Error message", "The following command line failed with code %2:\n'%1'", cmd, p.exitCode())); } else { IFOKDO(err, m_currentDocument->stepForward(2 * i)) IFOKDO(err, selection.at(i).setProperty(i18nc("Noun", "Bill"), id, fileName)) QStringList importedBills = SKGServices::splitCSVLine(m_currentDocument->getParameter(QStringLiteral("SKG_IMPORTED_BILLS"))); importedBills.push_back(id); IFOKDO(err, m_currentDocument->setParameter(QStringLiteral("SKG_IMPORTED_BILLS"), SKGServices::stringsToCsv(importedBills))) IFOKDO(err, m_currentDocument->stepForward(2 * i + 1)) QFile::remove(fileName); } } } } // status bar IFOK(err) { err = SKGError(0, i18nc("The user defined property was successfully created", "Property created")); } SKGMainPanel::displayErrorMessage(err); } void SKGPropertiesPlugin::onShowAddPropertyMenu() { if ((m_addPropertyMenu != nullptr) && (m_currentDocument != nullptr)) { m_addPropertyMenu->clear(); // Get selection SKGObjectBase::SKGListSKGObjectBase sels = SKGMainPanel::getMainPanel()->getSelectedObjects(); if (!sels.isEmpty()) { // Get the table of the selection QString table = sels.at(0).getRealTable(); // Get list of more used properties for this table SKGStringListList listTmp; m_currentDocument->executeSelectSqliteOrder( "SELECT t_name, t_value FROM (SELECT t_name, t_value, COUNT(1) AS nb FROM parameters WHERE (t_uuid_parent like '%-" % table % "' OR t_uuid_parent like '%-sub" % table % "') AND t_name NOT LIKE 'SKG_%' AND b_blob IS NULL GROUP BY t_name, t_value) ORDER BY nb DESC LIMIT 7", listTmp); // Create actions int nb = listTmp.count(); QIcon iconp = SKGServices::fromTheme(icon()); if (nb > 1) { for (int i = 1; i < nb; ++i) { // Should the string below be translated ??? It contains no word... QAction* act = m_addPropertyMenu->addAction(iconp, i18nc("Add a property (attribute=value)", "Add %1=%2", listTmp.at(i).at(0), listTmp.at(i).at(1))); if (act != nullptr) { act->setData(listTmp.at(i)); connect(act, &QAction::triggered, this, &SKGPropertiesPlugin::onAddProperty); } } } else { QAction* act = m_addPropertyMenu->addAction(iconp, i18nc("Help", "No property found. You must create a property from the dock first.")); act->setEnabled(false); } // Check if the sub process is still running if (m_billsProcess.state() == QProcess::Running) { // Create separator { QAction* act = m_addPropertyMenu->addAction(QLatin1String("")); act->setSeparator(true); } // Add download on going QAction* act = m_addPropertyMenu->addAction(i18nc("Message", "Download list of available bills on going...")); if (act != nullptr) { act->setEnabled(false); } } else { // Check if some bills can be downloaded int nb2 = m_bills.count(); if (nb2 != 0) { // Create separator { QAction* act = m_addPropertyMenu->addAction(QLatin1String("")); act->setSeparator(true); } // Create action QStringList importedBills = SKGServices::splitCSVLine(m_currentDocument->getParameter(QStringLiteral("SKG_IMPORTED_BILLS"))); QMenu* menuMore = nullptr; QIcon icond = SKGServices::fromTheme(icon(), QStringList() << QStringLiteral("download")); QSet backendDone; for (int j = 1; j < nb2; ++j) { // id;date;format;label;idparent;price;currency;deadline;startdate;finishdate QStringList fields = SKGServices::splitCSVLine(m_bills.at(j)); if (fields.count() > 3 && !importedBills.contains(fields.at(0))) { QStringList ids = SKGServices::splitCSVLine(fields.at(0), '@'); if (ids.count() == 2) { const QString& backend = ids.at(1); // Selection of the menu where the item must be added QMenu* menu; if (!backendDone.contains(backend)) { // This item must be added in root menu menu = m_addPropertyMenu; backendDone.insert(backend); } else { // This item must be added in "More..." menu if (menuMore == nullptr) { menuMore = new QMenu(i18nc("Noun", "More..."), m_addPropertyMenu); } menu = menuMore; } // Should the string below be translated ??? It contains no word... QAction* act = menu->addAction(icond, i18nc("Add a property (attribute=value)", "Download and add %1 (%2)", fields[3] % '.' % fields[2], fields[0])); if (act != nullptr) { act->setToolTip(fields[0]); act->setData(fields); connect(act, &QAction::triggered, this, &SKGPropertiesPlugin::onDownloadAndAddBills); } } } } // Add "More..." menu if (menuMore != nullptr) { m_addPropertyMenu->addMenu(menuMore); } } } } } } void SKGPropertiesPlugin::refresh() { SKGTRACEINFUNC(10) if (m_dockContent != nullptr) { m_dockContent->refresh(); } } QDockWidget* SKGPropertiesPlugin::getDockWidget() { return m_dockWidget; } QString SKGPropertiesPlugin::title() const { return i18nc("Noun, an item's properties", "Properties"); } QString SKGPropertiesPlugin::icon() const { return QStringLiteral("tag"); } int SKGPropertiesPlugin::getOrder() const { return 6; } QStringList SKGPropertiesPlugin::tips() const { QStringList output; output.push_back(i18nc("Description of a tip", "

... you can manage properties on all objects.

")); output.push_back(i18nc("Description of a tip", "

... you can add files or Internet links as property.

")); output.push_back(i18nc("Description of a tip", "

... you can automatically download and add bills as properties by using %1.

", "weboob")); return output; } #include diff --git a/skgbankguidesigner/skgbkwidgetcollectiondesignerplugin.h b/skgbankguidesigner/skgbkwidgetcollectiondesignerplugin.h index 6a432130f..544d9be85 100644 --- a/skgbankguidesigner/skgbkwidgetcollectiondesignerplugin.h +++ b/skgbankguidesigner/skgbkwidgetcollectiondesignerplugin.h @@ -1,53 +1,53 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGBKWIDGETCOLLECTIONDESIGNERPLUGIN_H #define SKGBKWIDGETCOLLECTIONDESIGNERPLUGIN_H /** @file * A collection of widgets for skrooge (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include #include "skgbankguidesigner_export.h" /** * QDesigner plugin collection */ class SKGBANKGUIDESIGNER_EXPORT SKGBKWidgetCollectionDesignerPlugin: public QObject, public QDesignerCustomWidgetCollectionInterface { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetCollectionInterface") Q_INTERFACES(QDesignerCustomWidgetCollectionInterface) public: /** * Constructor * @param iParent the parent */ explicit SKGBKWidgetCollectionDesignerPlugin(QObject* iParent = nullptr); /** * To get the list of widgets * @return the list of widgets */ QList customWidgets() const override; private: QList m_widgets; }; #endif // SKGBKWIDGETCOLLECTIONDESIGNERPLUGIN_H diff --git a/skgbankguidesigner/skgpredicatcreatordesignerplugin.h b/skgbankguidesigner/skgpredicatcreatordesignerplugin.h index 5ea2f54a6..9b84ed687 100644 --- a/skgbankguidesigner/skgpredicatcreatordesignerplugin.h +++ b/skgbankguidesigner/skgpredicatcreatordesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGPREDICATCREATORDESIGNERPLUGIN_H #define SKGPREDICATCREATORDESIGNERPLUGIN_H /** @file * This file is a predicat creator for skrooge (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGTableWithGraph */ class SKGPredicatCreatorDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGPredicatCreatorDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbankguidesigner/skgquerycreatordesignerplugin.h b/skgbankguidesigner/skgquerycreatordesignerplugin.h index 8d2b38c87..f1c930038 100644 --- a/skgbankguidesigner/skgquerycreatordesignerplugin.h +++ b/skgbankguidesigner/skgquerycreatordesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGQUERYCREATORDESIGNERPLUGIN_H #define SKGQUERYCREATORDESIGNERPLUGIN_H /** @file * This file is a query creator for skrooge (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGTableWithGraph */ class SKGQueryCreatorDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGQueryCreatorDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbankguidesigner/skgunitcomboboxdesignerplugin.h b/skgbankguidesigner/skgunitcomboboxdesignerplugin.h index 88b329281..f9bc7dedb 100644 --- a/skgbankguidesigner/skgunitcomboboxdesignerplugin.h +++ b/skgbankguidesigner/skgunitcomboboxdesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGUNITCOMBOBOXDESIGNERPLUGIN_H #define SKGUNITCOMBOBOXDESIGNERPLUGIN_H /** @file * This file is a predicat creator for skrooge (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGTableWithGraph */ class SKGUnitComboBoxDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGUnitComboBoxDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbasegui/kdateedit.cpp b/skgbasegui/kdateedit.cpp index 7b963f4e3..06ff778eb 100644 --- a/skgbasegui/kdateedit.cpp +++ b/skgbasegui/kdateedit.cpp @@ -1,386 +1,386 @@ /* This file is part of libkdepim. Copyright (c) 2002 Cornelius Schumacher Copyright (c) 2002 David Jarvie Copyright (c) 2003-2004 Reinhold Kainhofer Copyright (c) 2004 Tobias Koenig This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // krazy:excludeall=qclasses as we want to subclass from QComboBox, not KComboBox #include "kdateedit.h" #include #include #include #include #include #include #include #include #include #include "kdatevalidator.h" #define LOCALTEST using namespace KPIM; KDateEdit::KDateEdit(QWidget* iParent) : QComboBox(iParent), mReadOnly(false) { // need at least one entry for popup to work setMaxCount(1); setEditable(true); // Check if we can use the QLocale::ShortFormat mAlternativeDateFormatToUse = QLocale(LOCALTEST).dateFormat(QLocale::ShortFormat); if (!mAlternativeDateFormatToUse.contains(QStringLiteral("yyyy"))) { mAlternativeDateFormatToUse = mAlternativeDateFormatToUse.replace(QStringLiteral("yy"), QStringLiteral("yyyy")); } mDate = QDate::currentDate(); QString today = QLocale(LOCALTEST).toString(mDate, mAlternativeDateFormatToUse); addItem(today); setCurrentIndex(0); connect(lineEdit(), &QLineEdit::returnPressed, this, &KDateEdit::lineEnterPressed); connect(this, &KDateEdit::editTextChanged, this, &KDateEdit::slotTextChanged); mPopup = new KDatePickerPopup(KDatePickerPopup::DatePicker | KDatePickerPopup::Words, QDate::currentDate(), this); mPopup->hide(); mPopup->installEventFilter(this); connect(mPopup, &KDatePickerPopup::dateChanged, this, &KDateEdit::dateSelected); // handle keyword entry setupKeywords(); lineEdit()->installEventFilter(this); auto newValidator = new KDateValidator(this); newValidator->setKeywords(mKeywordMap.keys()); setValidator(newValidator); mTextChanged = false; } KDateEdit::~KDateEdit() = default; void KDateEdit::setDate(QDate iDate) { assignDate(iDate); updateView(); } QDate KDateEdit::date() const { return mDate; } void KDateEdit::setReadOnly(bool readOnly) { mReadOnly = readOnly; lineEdit()->setReadOnly(readOnly); } bool KDateEdit::isReadOnly() const { return mReadOnly; } void KDateEdit::showPopup() { if (mReadOnly) { return; } QRect desk = QGuiApplication::primaryScreen()->geometry(); QPoint popupPoint = mapToGlobal(QPoint(0, 0)); int dateFrameHeight = mPopup->sizeHint().height(); if (popupPoint.y() + height() + dateFrameHeight > desk.bottom()) { popupPoint.setY(popupPoint.y() - dateFrameHeight); } else { popupPoint.setY(popupPoint.y() + height()); } int dateFrameWidth = mPopup->sizeHint().width(); if (popupPoint.x() + dateFrameWidth > desk.right()) { popupPoint.setX(desk.right() - dateFrameWidth); } if (popupPoint.x() < desk.left()) { popupPoint.setX(desk.left()); } if (popupPoint.y() < desk.top()) { popupPoint.setY(desk.top()); } if (mDate.isValid()) { mPopup->setDate(mDate); } else { mPopup->setDate(QDate::currentDate()); } mPopup->popup(popupPoint); // The combo box is now shown pressed. Make it show not pressed again // by causing its (invisible) list box to emit a 'selected' signal. // First, ensure that the list box contains the date currently displayed. QDate date2 = parseDate(); assignDate(date2); updateView(); // Now, simulate an Enter to unpress it QAbstractItemView* lb = view(); if (lb != nullptr) { lb->setCurrentIndex(lb->model()->index(0, 0)); QKeyEvent* keyEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier); QApplication::postEvent(lb, keyEvent); } } void KDateEdit::dateSelected(QDate iDate) { if (assignDate(iDate)) { updateView(); emit dateChanged(iDate); emit dateEntered(iDate); if (iDate.isValid()) { mPopup->hide(); } } } void KDateEdit::lineEnterPressed() { bool replaced = false; QDate date2 = parseDate(&replaced); if (assignDate(date2)) { if (replaced) { updateView(); } emit dateChanged(date2); emit dateEntered(date2); } } QDate KDateEdit::parseDate(bool* replaced) const { QString text = currentText(); QDate result; if (replaced != nullptr) { (*replaced) = false; } if (text.isEmpty()) { result = QDate(); } else if (mKeywordMap.contains(text.toLower())) { QDate today = QDate::currentDate(); int i = mKeywordMap[ text.toLower()]; if (i == 30) { today = today.addMonths(1); } else if (i >= 100) { /* A day name has been entered. Convert to offset from today. * This uses some math tricks to figure out the offset in days * to the next date the given day of the week occurs. There * are two cases, that the new day is >= the current day, which means * the new day has not occurred yet or that the new day < the current day, * which means the new day is already passed (so we need to find the * day in the next week). */ i -= 100; int currentDay = today.dayOfWeek(); if (i >= currentDay) { i -= currentDay; } else { i += 7 - currentDay; } } result = today.addDays(i); if (replaced != nullptr) { (*replaced) = true; } } else { result = QLocale(LOCALTEST).toDate(text, mAlternativeDateFormatToUse); } return result; } void KDateEdit::focusOutEvent(QFocusEvent* e) { if (mTextChanged) { lineEnterPressed(); mTextChanged = false; } QComboBox::focusOutEvent(e); } void KDateEdit::keyPressEvent(QKeyEvent* e) { QDate date2; if (!mReadOnly) { switch (e->key()) { case Qt::Key_Up: date2 = parseDate(); if (!date2.isValid()) { break; } if ((e->modifiers() & Qt::ControlModifier) != 0u) { // Warning OSX: The KeypadModifier value will also be set when an arrow key is pressed as the arrow keys are considered part of the keypad. date2 = date2.addMonths(1); } else { date2 = date2.addDays(1); } break; case Qt::Key_Down: date2 = parseDate(); if (!date2.isValid()) { break; } if ((e->modifiers() & Qt::ControlModifier) != 0u) { // Warning OSX: The KeypadModifier value will also be set when an arrow key is pressed as the arrow keys are considered part of the keypad. date2 = date2.addMonths(-1); } else { date2 = date2.addDays(-1); } break; case Qt::Key_PageUp: date2 = parseDate(); if (!date2.isValid()) { break; } date2 = date2.addMonths(1); break; case Qt::Key_PageDown: date2 = parseDate(); if (!date2.isValid()) { break; } date2 = date2.addMonths(-1); break; case Qt::Key_Equal: date2 = QDate::currentDate(); break; default: {} } if (date2.isValid() && assignDate(date2)) { e->accept(); updateView(); emit dateChanged(date2); emit dateEntered(date2); return; } } QComboBox::keyPressEvent(e); } bool KDateEdit::eventFilter(QObject* iObject, QEvent* iEvent) { if (iObject == lineEdit()) { // We only process the focus out event if the text has changed // since we got focus if ((iEvent->type() == QEvent::FocusOut) && mTextChanged) { lineEnterPressed(); mTextChanged = false; } else if (iEvent->type() == QEvent::KeyPress) { // Up and down arrow keys step the date auto* keyEvent = dynamic_cast(iEvent); - if (keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter) { + if (keyEvent && (keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter)) { lineEnterPressed(); return true; } } } return QComboBox::eventFilter(iObject, iEvent); } void KDateEdit::slotTextChanged(const QString& /*unused*/) { QDate date2 = parseDate(); if (assignDate(date2)) { emit dateChanged(date2); } mTextChanged = true; } void KDateEdit::setupKeywords() { // Create the keyword list. This will be used to match against when the user // enters information. mKeywordMap.insert(i18nc("the day after today", "tomorrow"), 1); mKeywordMap.insert(i18nc("this day", "today"), 0); mKeywordMap.insert(i18nc("the day before today", "yesterday"), -1); mKeywordMap.insert(i18nc("the week after this week", "next week"), 7); mKeywordMap.insert(i18nc("the month after this month", "next month"), 30); QString dayName; for (int i = 1; i <= 7; ++i) { dayName = QLocale().dayName(i).toLower(); mKeywordMap.insert(dayName, i + 100); } auto comp = new QCompleter(mKeywordMap.keys(), this); comp->setCaseSensitivity(Qt::CaseInsensitive); comp->setCompletionMode(QCompleter::InlineCompletion); setCompleter(comp); } bool KDateEdit::assignDate(QDate iDate) { mDate = iDate; mTextChanged = false; return true; } void KDateEdit::updateView() { QString dateString; if (mDate.isValid()) { dateString = QLocale(LOCALTEST).toString(mDate, mAlternativeDateFormatToUse); } // We do not want to generate a signal here, // since we explicitly setting the date bool blocked = signalsBlocked(); blockSignals(true); removeItem(0); insertItem(0, dateString); blockSignals(blocked); } diff --git a/skgbasegui/skgtreeview.cpp b/skgbasegui/skgtreeview.cpp index a36a0aa10..57056af72 100644 --- a/skgbasegui/skgtreeview.cpp +++ b/skgbasegui/skgtreeview.cpp @@ -1,1441 +1,1441 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ /** @file * A tree view with more features. * * @author Stephane MANKOWSKI / Guillaume DE BURE */ #include "skgtreeview.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "skgdocument.h" #include "skgerror.h" #include "skgmainpanel.h" #include "skgobjectbase.h" #include "skgobjectmodelbase.h" #include "skgpropertyobject.h" #include "skgservices.h" #include "skgsortfilterproxymodel.h" #include "skgtableview.h" #include "skgtraces.h" #include "skgtransactionmng.h" SKGTreeView::SKGTreeView(QWidget* iParent) : QTreeView(iParent), m_autoResize(true), m_autoResizeDone(false), m_actAutoResize(nullptr), m_document(nullptr), m_textResizable(true), m_model(nullptr), m_proxyModel(nullptr), m_actGroupByNone(nullptr), stickH(false), stickV(false) { // Initialize setTextElideMode(Qt::ElideMiddle); setAutoExpandDelay(300); setAnimated(true); m_timerDelayedResize.setSingleShot(true); connect(&m_timerDelayedResize, &QTimer::timeout, this, &SKGTreeView::resizeColumnsToContents, Qt::QueuedConnection); m_timerSelectionChanged.setSingleShot(true); connect(&m_timerSelectionChanged, &QTimer::timeout, this, &SKGTreeView::selectionChangedDelayed, Qt::QueuedConnection); m_timerScrollSelection.setSingleShot(true); connect(&m_timerScrollSelection, &QTimer::timeout, this, &SKGTreeView::scroolOnSelection, Qt::QueuedConnection); // Menu QHeaderView* hori = header(); hori->setContextMenuPolicy(Qt::CustomContextMenu); m_headerMenu = new QMenu(this); setContextMenuPolicy(Qt::ActionsContextMenu); connect(hori, &QHeaderView::customContextMenuRequested, this, static_cast(&SKGTreeView::showHeaderMenu)); connect(hori, &QHeaderView::sortIndicatorChanged, this, &SKGTreeView::onSortChanged); // m_actCopy = KStandardAction::copy(this, SLOT(copy()), nullptr); m_actCopy->setProperty("isShortcutConfigurable", false); m_actCopy->setShortcutContext(Qt::WidgetShortcut); m_actExpandAll = new QAction(SKGServices::fromTheme(QStringLiteral("format-indent-more")), i18nc("Noun, user action", "Expand all"), this); m_actExpandAll->setShortcut(Qt::ALT + Qt::Key_Plus); m_actExpandAll->setProperty("isShortcutConfigurable", false); m_actExpandAll->setShortcutContext(Qt::WidgetShortcut); connect(m_actExpandAll, &QAction::triggered, this, &SKGTreeView::expandAll); m_actCollapseAll = new QAction(SKGServices::fromTheme(QStringLiteral("format-indent-less")), i18nc("Noun, user action", "Collapse all"), this); m_actCollapseAll->setShortcut(Qt::ALT + Qt::Key_Minus); m_actCollapseAll->setProperty("isShortcutConfigurable", false); m_actCollapseAll->setShortcutContext(Qt::WidgetShortcut); connect(m_actCollapseAll, &QAction::triggered, this, &SKGTreeView::collapseAll); if (SKGMainPanel::getMainPanel() != nullptr) { SKGMainPanel::getMainPanel()->registerGlobalAction(QStringLiteral("edit_copy"), m_actCopy); SKGMainPanel::getMainPanel()->registerGlobalAction(QStringLiteral("edit_expandall"), m_actExpandAll); SKGMainPanel::getMainPanel()->registerGlobalAction(QStringLiteral("edit_collapseall"), m_actCollapseAll); } // Scroll bars connect(horizontalScrollBar(), &QScrollBar::actionTriggered, this, &SKGTreeView::onActionTriggered); connect(verticalScrollBar(), &QScrollBar::actionTriggered, this, &SKGTreeView::onActionTriggered); connect(horizontalScrollBar(), &QScrollBar::rangeChanged, this, &SKGTreeView::onRangeChanged); connect(verticalScrollBar(), &QScrollBar::rangeChanged, this, &SKGTreeView::onRangeChanged); // Headers hori->setSectionsMovable(true); hori->setSectionResizeMode(QHeaderView::Fixed); setWordWrap(false); connect(header(), &QHeaderView::sectionMoved, this, &SKGTreeView::setupHeaderMenu, Qt::QueuedConnection); connect(this, &SKGTreeView::clicked, this, &SKGTreeView::onClick); connect(this, &SKGTreeView::collapsed, this, &SKGTreeView::onCollapse); connect(this, &SKGTreeView::expanded, this, &SKGTreeView::onExpand); QWidget* vp = this->viewport(); if (vp != nullptr) { vp->installEventFilter(this); this->installEventFilter(this); } // Save original size m_fontOriginalPointSize = this->font().pointSize(); m_iconOriginalSize = this->iconSize().height(); if (m_iconOriginalSize <= 0) { m_iconOriginalSize = 16; } } SKGTreeView::~SKGTreeView() { m_document = nullptr; m_headerMenu = nullptr; m_proxyModel = nullptr; m_model = nullptr; m_actExpandAll = nullptr; m_actCollapseAll = nullptr; } bool SKGTreeView::isAutoResized() { return m_autoResize; } QString SKGTreeView::getState() { SKGTRACEINFUNC(10) QDomDocument doc(QStringLiteral("SKGML")); QDomElement root = doc.createElement(QStringLiteral("parameters")); doc.appendChild(root); QHeaderView* hHeader = header(); if ((hHeader != nullptr) && (m_model != nullptr)) { if (isSortingEnabled()) { root.setAttribute(QStringLiteral("sortOrder"), SKGServices::intToString(static_cast(hHeader->sortIndicatorOrder()))); root.setAttribute(QStringLiteral("sortColumn"), m_model->getAttribute(hHeader->sortIndicatorSection())); if (m_proxyModel != nullptr) { root.setAttribute(QStringLiteral("sortPreviousColumn"), SKGServices::intToString(m_proxyModel->getPreviousSortColumn())); } } root.setAttribute(QStringLiteral("groupBy"), m_groupby); // Memorize order int nb = hHeader->count(); if (nb != 0) { QString columns; QString columnsSize; QString columnsVisibility; for (int i = 0; i < nb; ++i) { int idx = hHeader->logicalIndex(i); if (i != 0) { columns += ';'; } columns += m_model->getAttribute(idx); if (i != 0) { columnsSize += ';'; } columnsSize += SKGServices::intToString(hHeader->sectionSize(idx)); if (i != 0) { columnsVisibility += ';'; } columnsVisibility += (hHeader->isSectionHidden(idx) ? QStringLiteral("N") : QStringLiteral("Y")); } root.setAttribute(QStringLiteral("columns"), columns); if (!m_autoResize) { root.setAttribute(QStringLiteral("columnsSize"), columnsSize); } root.setAttribute(QStringLiteral("columnsVisibility"), columnsVisibility); root.setAttribute(QStringLiteral("columnsAutoResize"), m_autoResize ? QStringLiteral("Y") : QStringLiteral("N")); } // Memorize expanded groups if (!m_groupby.isEmpty()) { root.setAttribute(QStringLiteral("expandedGroups"), m_expandedNodes.join(QStringLiteral(";"))); } } root.setAttribute(QStringLiteral("alternatingRowColors"), alternatingRowColors() ? QStringLiteral("Y") : QStringLiteral("N")); root.setAttribute(QStringLiteral("zoomPosition"), SKGServices::intToString(zoomPosition())); QScrollBar* scroll2 = horizontalScrollBar(); if ((scroll2 != nullptr) && scroll2->value() == scroll2->maximum() && scroll2->value() != scroll2->minimum()) { root.setAttribute(QStringLiteral("stickH"), QStringLiteral("Y")); } scroll2 = verticalScrollBar(); if ((scroll2 != nullptr) && scroll2->value() == scroll2->maximum() && scroll2->value() != scroll2->minimum()) { root.setAttribute(QStringLiteral("stickV"), QStringLiteral("Y")); } return doc.toString(-1); } void SKGTreeView::setState(const QString& iState) { SKGTRACEINFUNC(10) resetColumnsOrder(); QDomDocument doc(QStringLiteral("SKGML")); QString viewState = iState; if (viewState.isEmpty() && (m_document != nullptr)) { // Get default state viewState = m_document->getParameter(m_parameterName); } Qt::SortOrder qtsortorder = Qt::AscendingOrder; if (doc.setContent(viewState)) { QDomElement root = doc.documentElement(); QString sortOrder = root.attribute(QStringLiteral("sortOrder")); QString sortColumn = root.attribute(QStringLiteral("sortColumn")); QString sortPreviousColumn = root.attribute(QStringLiteral("sortPreviousColumn")); m_groupby = root.attribute(QStringLiteral("groupBy")); QString columns = root.attribute(QStringLiteral("columns")); QString columnsSize = root.attribute(QStringLiteral("columnsSize")); QString columnsVisibility = root.attribute(QStringLiteral("columnsVisibility")); QString columnsAutoResize = root.attribute(QStringLiteral("columnsAutoResize")); QString alternatingRowColors2 = root.attribute(QStringLiteral("alternatingRowColors")); QString zoomPositionString = root.attribute(QStringLiteral("zoomPosition")); QString expandedGroups = root.attribute(QStringLiteral("expandedGroups")); stickH = (root.attribute(QStringLiteral("stickH")) == QStringLiteral("Y")); stickV = (root.attribute(QStringLiteral("stickV")) == QStringLiteral("Y")); // Set column order QStringList listAtt; if (!columns.isEmpty()) { listAtt = SKGServices::splitCSVLine(columns, ';'); QStringList sizes = SKGServices::splitCSVLine(columnsSize, ';'); QStringList visibilities = SKGServices::splitCSVLine(columnsVisibility, ';'); int nb = listAtt.count(); int nbvisibilities = visibilities.count(); int nbsizes = sizes.count(); for (int i = 0; i < nb; ++i) { if (nbvisibilities == nb) { listAtt[i] = listAtt.at(i) % '|' % visibilities.at(i); if (nbsizes == nb) { listAtt[i] = listAtt.at(i) % '|' % sizes.at(i); } } } } if (m_model != nullptr) { m_model->setSupportedAttributes(listAtt); } // Set autoResize if (!columnsAutoResize.isEmpty()) { m_autoResize = (columnsAutoResize == QStringLiteral("Y")); header()->setSectionResizeMode(m_autoResize ? QHeaderView::Fixed : QHeaderView::Interactive); if (!m_autoResize) { m_timerDelayedResize.stop(); m_autoResizeDone = false; } } // Set sort if ((m_proxyModel != nullptr) && !sortPreviousColumn.isEmpty()) { m_proxyModel->setPreviousSortColumn(SKGServices::stringToInt(sortPreviousColumn)); } if ((m_model != nullptr) && isSortingEnabled() && !sortOrder.isEmpty() && !sortColumn.isEmpty()) { int index = SKGServices::splitCSVLine(columns, ';').indexOf(sortColumn); if (index == -1) { index = m_model->getIndexAttribute(sortColumn); } if (index == -1) { index = 0; } qtsortorder = static_cast(SKGServices::stringToInt(sortOrder)); this->sortByColumn(index, qtsortorder); } if (m_model != nullptr) { QString att = m_groupby; if (att == QStringLiteral("#")) { att = sortColumn; } m_model->setGroupBy(att); m_model->dataModified(); refreshExpandCollapse(); } // Set alternatingRowColors if (!alternatingRowColors2.isEmpty()) { setAlternatingRowColors(alternatingRowColors2 == QStringLiteral("Y")); } if (!zoomPositionString.isEmpty()) { setZoomPosition(SKGServices::stringToInt(zoomPositionString)); } // Set expanded groups m_expandedNodes = SKGServices::splitCSVLine(expandedGroups); resetSelection(); } else { if (m_model != nullptr) { m_model->setSupportedAttributes(QStringList()); m_groupby = QLatin1String(""); m_model->setGroupBy(m_groupby); m_model->dataModified(); refreshExpandCollapse(); } this->sortByColumn(0, qtsortorder); } } void SKGTreeView::refreshExpandCollapse() { bool treeMode = !m_model->getParentChildAttribute().isEmpty(); setRootIsDecorated(treeMode && m_groupby.isEmpty()); if (m_actExpandAll != nullptr) { m_actExpandAll->setVisible(treeMode || !m_groupby.isEmpty()); } if (m_actCollapseAll != nullptr) { m_actCollapseAll->setVisible(treeMode || !m_groupby.isEmpty()); } } void SKGTreeView::respanFirstColumns() { // Span groups int nbRow = m_model->rowCount(); for (int row = 0; row < nbRow; ++row) { this -> setFirstColumnSpanned(row, QModelIndex(), !m_groupby.isEmpty()); } } void SKGTreeView::onRangeChanged() { auto* scroll2 = qobject_cast(sender()); if ((stickH && scroll2 == horizontalScrollBar()) || (stickV && scroll2 == verticalScrollBar())) { scroll2->setValue(scroll2->maximum()); } } void SKGTreeView::onActionTriggered(int action) { auto* scroll2 = qobject_cast(sender()); if ((scroll2 != nullptr) && action == QAbstractSlider::SliderToMaximum) { if (scroll2 == horizontalScrollBar()) { stickH = true; } if (scroll2 == verticalScrollBar()) { stickV = true; } } else { if (scroll2 == horizontalScrollBar()) { stickH = false; } if (scroll2 == verticalScrollBar()) { stickV = false; } } } void SKGTreeView::insertGlobalAction(const QString& iRegisteredAction) { if (iRegisteredAction.isEmpty()) { auto sep = new QAction(this); sep->setSeparator(true); this->insertAction(nullptr, sep); } else if (SKGMainPanel::getMainPanel() != nullptr) { QAction* act = SKGMainPanel::getMainPanel()->getGlobalAction(iRegisteredAction); this->insertAction(nullptr, act); } } void SKGTreeView::resizeColumnsToContentsDelayed() { SKGTRACEINFUNC(10) m_timerDelayedResize.start(300); } void SKGTreeView::resizeColumnsToContents() { SKGTRACEINFUNC(10) { SKGTRACEIN(10, "SKGTreeView::resizeColumnsToContents-respanFirstColumns") respanFirstColumns(); } int nb = header()->count(); for (int i = nb - 1; i >= 0; --i) { SKGTRACEIN(10, "SKGTreeView::resizeColumnsToContents-resizeColumnToContents(" + SKGServices::intToString(i) + ')') if (!isColumnHidden(i)) { resizeColumnToContents(i); } } } void SKGTreeView::showHeaderMenu() { showHeaderMenu(header()->mapFromGlobal(QCursor::pos())); } void SKGTreeView::showHeaderMenu(const QPoint iPos) { if (m_headerMenu != nullptr) { m_headerMenu->popup(header()->mapToGlobal(iPos)); } } void SKGTreeView::setDefaultSaveParameters(SKGDocument* iDocument, const QString& iParameterName) { m_document = iDocument; m_parameterName = iParameterName; } void SKGTreeView::setupHeaderMenu() { SKGTRACEINFUNC(10) if ((m_model != nullptr) && m_model->isRefreshBlocked()) { return; } setCornerWidget(nullptr); if ((m_model != nullptr) && (m_headerMenu != nullptr)) { // Corner button on tables to show the contextual menu auto btn = new QPushButton(this); btn->setIcon(SKGServices::fromTheme(QStringLiteral("configure"))); btn->setFocusPolicy(Qt::NoFocus); connect(btn, &QPushButton::clicked, this, static_cast(&SKGTreeView::showHeaderMenu)); setCornerWidget(btn); m_headerMenu->clear(); // Processing QMenu* columns = m_headerMenu->addMenu(i18nc("Noun, Menu name", "Columns")); // Get current groupby column QMenu* groupbymenu = nullptr; QActionGroup* groupby = nullptr; if (!m_model->getWhereClause().contains(QStringLiteral("ORDER BY"))) { groupbymenu = m_headerMenu->addMenu(i18nc("Noun, Menu name", "Group by")); groupby = new QActionGroup(groupbymenu); m_actGroupByNone = groupbymenu->addAction(i18nc("Noun, grouping option", "None")); if (m_actGroupByNone != nullptr) { m_actGroupByNone->setIcon(SKGServices::fromTheme(QStringLiteral("dialog-cancel"))); m_actGroupByNone->setCheckable(true); m_actGroupByNone->setChecked(m_groupby.isEmpty()); m_actGroupByNone->setData(QLatin1String("")); groupby->addAction(m_actGroupByNone); } if (m_proxyModel != nullptr) { QAction* actSort = groupbymenu->addAction(i18nc("Noun, grouping option", "Sorted column")); if (actSort != nullptr) { actSort->setIcon(SKGServices::fromTheme(QStringLiteral("view-sort-ascending"))); actSort->setCheckable(true); actSort->setChecked(m_groupby == QStringLiteral("#")); actSort->setData(QStringLiteral("#")); groupby->addAction(actSort); } } groupbymenu->addSeparator(); } // Set right click menu SKGDocument::SKGModelTemplateList schemas = m_model->getSchemas(); int nbSchemas = schemas.count(); if (nbSchemas != 0) { QMenu* viewAppearanceMenu = columns->addMenu(SKGServices::fromTheme(QStringLiteral("view-file-columns")), i18nc("Noun, user action", "View appearance")); for (int i = 0; i < nbSchemas; ++i) { SKGDocument::SKGModelTemplate schema = schemas.at(i); QAction* act = viewAppearanceMenu->addAction(schema.name); if (!schema.icon.isEmpty()) { act->setIcon(SKGServices::fromTheme(schema.icon)); } act->setData(schema.schema); connect(act, &QAction::triggered, this, &SKGTreeView::changeSchema); } } QAction* actResize = columns->addAction(SKGServices::fromTheme(QStringLiteral("zoom-fit-width")), i18nc("Noun, user action", "Resize to content")); connect(actResize, &QAction::triggered, this, &SKGTreeView::resizeColumnsToContents); m_actAutoResize = columns->addAction(SKGServices::fromTheme(QStringLiteral("zoom-fit-width"), QStringList() << QStringLiteral("run-build")), i18nc("Noun, user action", "Auto resize")); m_actAutoResize->setCheckable(true); m_actAutoResize->setChecked(m_autoResize); connect(m_actAutoResize, &QAction::triggered, this, &SKGTreeView::switchAutoResize); QAction* actAlternatingRowColors = m_headerMenu->addAction(i18nc("Noun, user action", "Alternate row colors")); if (actAlternatingRowColors != nullptr) { actAlternatingRowColors->setCheckable(true); actAlternatingRowColors->setChecked(alternatingRowColors()); connect(actAlternatingRowColors, &QAction::triggered, this, &SKGTreeView::setAlternatingRowColors); } if (m_document != nullptr) { QAction* actDefault = m_headerMenu->addAction(SKGServices::fromTheme(QStringLiteral("document-save")), i18nc("Noun, user action", "Save parameters")); connect(actDefault, &QAction::triggered, this, &SKGTreeView::saveDefaultClicked); } columns->addSeparator(); if (m_model != nullptr) { // Build menus for columns QHeaderView* hHeader = header(); int nbcol = hHeader->count(); for (int i = 0; i < nbcol; ++i) { int idx = hHeader->logicalIndex(i); QString col = m_model->headerData(idx, Qt::Horizontal, Qt::UserRole).toString(); QStringList values = col.split('|'); if (!m_autoResizeDone) { if (values.count() > 1) { hHeader->setSectionHidden(idx, values.at(1) == QStringLiteral("N")); } if (values.count() > 2) { auto s = SKGServices::stringToInt(values.at(2)); if (s > 0) { hHeader->resizeSection(idx, s); } } } // Column menu QAction* act = columns->addAction(values.at(0)); if (act != nullptr) { act->setCheckable(true); act->setChecked(!hHeader->isSectionHidden(idx)); act->setIcon(m_model->headerData(idx, Qt::Horizontal, Qt::DecorationRole).value()); act->setData(idx); act->setEnabled(i > 0); connect(act, &QAction::triggered, this, &SKGTreeView::showHideColumn); // Group by menu QString att = m_model->getAttribute(idx); if ((groupbymenu != nullptr) && (groupby != nullptr)) { QAction* act2 = groupbymenu->addAction(values.at(0)); if (act2 != nullptr) { act2->setCheckable(true); act2->setChecked(att == m_groupby); act2->setIcon(act->icon()); act2->setData(att); groupby->addAction(act2); } } } } m_autoResizeDone = true; } if (groupby != nullptr) { connect(groupby, &QActionGroup::triggered, this, &SKGTreeView::groupByChanged); } m_headerMenu->addSeparator(); QAction* actExport = m_headerMenu->addAction(SKGServices::fromTheme(QStringLiteral("document-export")), i18nc("Noun, user action", "Export...")); connect(actExport, &QAction::triggered, this, &SKGTreeView::onExport); if (m_autoResize) { resizeColumnsToContentsDelayed(); } } } void SKGTreeView::setSelectionModel(QItemSelectionModel* iSelectionModel) { if (this->selectionModel() != nullptr) { disconnect(this->selectionModel(), &QItemSelectionModel::selectionChanged, this, &SKGTreeView::onSelectionChanged); } QTreeView::setSelectionModel(iSelectionModel); if (iSelectionModel != nullptr) { connect(iSelectionModel, &QItemSelectionModel::selectionChanged, this, &SKGTreeView::onSelectionChanged); } } void SKGTreeView::onSelectionChanged() { SKGTRACEINFUNC(10) SKGObjectBase::SKGListSKGObjectBase selection; SKGObjectBase::SKGListSKGObjectBase selectionparents; QItemSelectionModel* selModel = selectionModel(); if (selModel != nullptr) { if (m_model != nullptr) { auto indexes = selModel->selectedRows(); int nb = indexes.count(); QVector indexesToSource; indexesToSource.reserve(indexes.count()); for (const auto& index : qAsConst(indexes)) { indexesToSource.push_back(m_proxyModel != nullptr ? m_proxyModel->mapToSource(index) : index); } selection.reserve(indexesToSource.count()); selectionparents.reserve(nb); for (int i = 0; i < nb; ++i) { QModelIndex index = indexes.at(i); QModelIndex idxs = indexesToSource.at(i); // Get above QModelIndex idxtmp = (m_proxyModel != nullptr ? m_proxyModel->mapToSource(indexAbove(index)) : indexAbove(index)); auto* tmp = m_model->getObjectPointer(idxtmp); if (tmp != nullptr && idxtmp.parent() == idxs.parent() && !indexesToSource.contains(idxtmp)) { selectionparents.push_back(*tmp); } else { // Get below idxtmp = (m_proxyModel != nullptr ? m_proxyModel->mapToSource(indexBelow(index)) : indexBelow(index)); tmp = m_model->getObjectPointer(idxtmp); if (tmp != nullptr && idxtmp.parent() == idxs.parent() && !indexesToSource.contains(idxtmp)) { selectionparents.push_back(*tmp); } else { // Get parent tmp = m_model->getObjectPointer(idxs.parent()); if (tmp != nullptr) { selectionparents.push_back(*tmp); } } } SKGObjectBase obj = m_model->getObject(idxs); selection.push_back(obj); } } } // if (selection != m_lastSelection) { // WARNING: selection can be equal but attributes of selected objects modified m_lastSelection = selection; m_lastSelection_if_deleted = selectionparents; m_timerSelectionChanged.start(300); // } } void SKGTreeView::saveDefaultClicked() { if (m_document != nullptr) { SKGError err; SKGBEGINTRANSACTION(*m_document, i18nc("Noun, name of the user action", "Save default parameters"), err) err = m_document->setParameter(m_parameterName, getState()); } } void SKGTreeView::switchAutoResize() { m_autoResize = m_actAutoResize->isChecked(); header()->setSectionResizeMode(m_autoResize ? QHeaderView::Fixed : QHeaderView::Interactive); if (m_autoResize) { resizeColumnsToContentsDelayed(); } else { m_timerDelayedResize.stop(); m_autoResizeDone = false; } } void SKGTreeView::groupByChanged(QAction* iAction) { if ((m_model != nullptr) && m_model->isRefreshBlocked()) { return; } if ((iAction != nullptr) && (m_model != nullptr)) { m_groupby = iAction->data().toString(); QString att = m_groupby; if (att == QStringLiteral("#") && (m_proxyModel != nullptr)) { att = m_model->getAttribute(m_proxyModel->sortColumn()); } m_model->setGroupBy(att); m_model->refresh(); refreshExpandCollapse(); respanFirstColumns(); } } void SKGTreeView::onSortChanged(int iIndex, Qt::SortOrder iOrder) { Q_UNUSED(iOrder) if (m_groupby == QStringLiteral("#") && (m_model != nullptr)) { m_model->setGroupBy(m_model->getAttribute(iIndex)); m_model->refresh(); } m_timerScrollSelection.start(300); } void SKGTreeView::showHideColumn() { auto* send = qobject_cast(this->sender()); if (send != nullptr) { QHeaderView* hHeader = header(); int idx = send->data().toInt(); bool hidden = !hHeader->isSectionHidden(idx); hHeader->setSectionHidden(idx, hidden); } } void SKGTreeView::resetColumnsOrder() { QHeaderView* hHeader = header(); int nbcol = hHeader->count(); for (int i = 0; i < nbcol; ++i) { int idx = hHeader->visualIndex(i); if (idx != i) { hHeader->moveSection(idx, i); } } } void SKGTreeView::changeSchema() { QStringList list; auto* send = qobject_cast(this->sender()); if (send != nullptr) { list = SKGServices::splitCSVLine(send->data().toString(), ';'); } if (m_model != nullptr) { // Reset column oder resetColumnsOrder(); m_model->setSupportedAttributes(list); bool tmp = m_autoResizeDone; m_autoResizeDone = false; m_model->dataModified(); m_autoResizeDone = tmp; header()->setSortIndicator(0, Qt::AscendingOrder); } } QStringList SKGTreeView::getCurrentSchema() const { QStringList list; QHeaderView* hHeader = header(); if ((hHeader != nullptr) && (m_model != nullptr)) { int nb = hHeader->count(); if (nb != 0) { QString att; for (int i = 0; i < nb; ++i) { int idx = hHeader->logicalIndex(i); att = m_model->getAttribute(idx); att += QStringLiteral("|") % (hHeader->isSectionHidden(idx) ? QStringLiteral("N") : QStringLiteral("Y")); att += QStringLiteral("|") % SKGServices::intToString(hHeader->sectionSize(idx)); list.push_back(att); } } } return list; } void SKGTreeView::setAlternatingRowColors(bool enable) { QTreeView::setAlternatingRowColors(enable); } SKGObjectBase SKGTreeView::getFirstSelectedObject() { return m_lastSelection.value(0); } SKGObjectBase::SKGListSKGObjectBase SKGTreeView::getSelectedObjects() { return m_lastSelection; } int SKGTreeView::getNbSelectedObjects() { return m_lastSelection.count(); } void SKGTreeView::saveSelection() { SKGTRACEINFUNC(10) m_selection.clear(); SKGObjectBase::SKGListSKGObjectBase objs = getSelectedObjects(); int nb = objs.count(); // We save the selection only if not too big if (nb <= 100) { for (int i = 0; i < nb; ++i) { QString id = objs.at(i).getUniqueID(); m_selection.push_back(id); } } SKGTRACEL(10) << m_selection.count() << " objects saved" << endl; } void SKGTreeView::selectObject(const QString& iUniqueID) { SKGTRACEINFUNC(10) QStringList tmp; tmp.push_back(iUniqueID); selectObjects(tmp, true); } void SKGTreeView::selectObjects(const QStringList& iUniqueIDs, bool iFocusOnFirstOne) { SKGTRACEINFUNC(10) SKGTRACEL(10) << iUniqueIDs.count() << " objects to select" << endl; int nbset = 0; QItemSelectionModel* selModel = selectionModel(); if (selModel != nullptr) { bool previous = selModel->blockSignals(true); selModel->clearSelection(); if (m_model != nullptr) { // Get all indexes QVector items; items.reserve(items.count() * 2); items.push_back(QModelIndex()); for (int i = 0; i < items.count(); ++i) { // Dynamic size because the list is modified QModelIndex mi = items.at(i); int nbRows = m_model->rowCount(mi); for (int j = 0; j < nbRows; ++j) { items.push_back(m_model->index(j, 0, mi)); } } items.removeAt(0); int nbRows = items.count(); if (nbRows != 0) { // Expand nodes bool previousForThis = this->blockSignals(true); for (int i = 0; i < nbRows; ++i) { QModelIndex index = items.at(i); SKGObjectBase obj = m_model->getObject(index); if (m_expandedNodes.contains(obj.getUniqueID())) { QModelIndex idxs = (m_proxyModel != nullptr ? m_proxyModel->mapFromSource(index) : index); setExpanded(idxs, true); } } this->blockSignals(previousForThis); // Set selection bool focusDone = false; for (int i = 0; i < nbRows; ++i) { QModelIndex index = items.at(i); SKGObjectBase obj = m_model->getObject(index); if (iUniqueIDs.contains(obj.getUniqueID())) { QModelIndex idxs = (m_proxyModel != nullptr ? m_proxyModel->mapFromSource(index) : index); selModel->select(idxs, QItemSelectionModel::Select | QItemSelectionModel::Rows); selModel->setCurrentIndex(idxs, QItemSelectionModel::NoUpdate); ++nbset; if (iFocusOnFirstOne && !focusDone) { scrollTo(idxs); focusDone = true; } } } } } selModel->blockSignals(previous); } SKGTRACEL(10) << nbset << " objects selected" << endl; onSelectionChanged(); } void SKGTreeView::resetSelection() { SKGTRACEINFUNC(10) auto lastSelection_parents_save = m_lastSelection_if_deleted; // because selectObjects will modify m_lastSelection_if_deleted selectObjects(m_selection); if ((lastSelection_parents_save.count() != 0) && (getSelectedObjects().count() == 0)) { // Try to select parent objects int nb = lastSelection_parents_save.count(); // We save the selection only if not too big if (nb <= 100) { QStringList sel; sel.reserve(nb); for (int i = 0; i < nb; ++i) { QString id = lastSelection_parents_save.at(i).getUniqueID(); sel.push_back(id); } selectObjects(sel); } } } void SKGTreeView::scroolOnSelection() { QItemSelectionModel* selModel = selectionModel(); if (selModel != nullptr) { if (m_model != nullptr) { QModelIndexList indexes = selModel->selectedRows(); if (!indexes.isEmpty()) { scrollTo(indexes.at(0)); } } } } void SKGTreeView::onExpand(const QModelIndex& index) { SKGTRACEINFUNC(10) if (index.isValid() && (m_model != nullptr)) { QModelIndex idxs = (m_proxyModel != nullptr ? m_proxyModel->mapToSource(index) : index); SKGObjectBase obj = m_model->getObject(idxs); QString id = obj.getUniqueID(); m_expandedNodes.push_back(id); } if (m_autoResize) { resizeColumnsToContentsDelayed(); } } void SKGTreeView::expandAll() { SKGTRACEINFUNC(10) QTreeView::expandAll(); if (m_autoResize) { resizeColumnsToContentsDelayed(); } } void SKGTreeView::onCollapse(const QModelIndex& index) { SKGTRACEINFUNC(10) if (index.isValid() && (m_model != nullptr)) { QModelIndex idxs = (m_proxyModel != nullptr ? m_proxyModel->mapToSource(index) : index); SKGObjectBase obj = m_model->getObject(idxs); QString id = obj.getUniqueID(); m_expandedNodes.removeOne(id); } if (m_autoResize) { resizeColumnsToContentsDelayed(); } } void SKGTreeView::onClick(const QModelIndex& index) { SKGTRACEINFUNC(10) if (index.isValid() && (m_actExpandAll != nullptr) && m_actExpandAll->isVisible()) { this->setExpanded(index, !this->isExpanded(index)); } } void SKGTreeView::copy() { QItemSelectionModel* selection = selectionModel(); if (selection != nullptr) { QModelIndexList indexes = selection->selectedIndexes(); if (indexes.empty()) { return; } std::sort(indexes.begin(), indexes.end()); // You need a pair of indexes to find the row changes QModelIndex previous = indexes.first(); indexes.removeFirst(); bool header_done = false; QStringList colums_title; colums_title.reserve(indexes.count()); SKGStringListList columns_values; int index = 0; for (const auto& current : qAsConst(indexes)) { if (columns_values.count() < index + 1) { columns_values.append(QStringList()); columns_values.append(QStringList()); } columns_values[index].append(model()->data(previous).toString()); columns_values[index + 1].append(model()->data(previous, Qt::UserRole).toString()); if (!header_done) { auto header_title = model()->headerData(previous.column(), Qt::Horizontal).toString(); if (header_title.isEmpty()) { header_title = SKGServices::splitCSVLine(model()->headerData(previous.column(), Qt::Horizontal, Qt::UserRole).toString(), QLatin1Char('|')).at(0); } colums_title.append(header_title); colums_title.append(header_title + QLatin1String("_raw")); } if (current.row() != previous.row()) { index = 0; header_done = true; } else { index = index + 2; } previous = current; } // Add last element if (columns_values.count() < index + 1) { columns_values.append(QStringList()); columns_values.append(QStringList()); } columns_values[index].append(model()->data(previous).toString()); columns_values[index + 1].append(model()->data(previous, Qt::UserRole).toString()); // Remove useless raw columns (when all raw values = displayed values) int nbCols = columns_values.count(); int nbRows = 0; if (nbCols > 0) { nbRows = columns_values.at(0).count(); for (int c = nbCols - 1; c >= 0; c = c - 2) { bool allEqual = true; bool allDisplayedEmpty = true; auto displayedValues = columns_values.at(c - 1); auto rawValues = columns_values.at(c); for (int r = 0; r < nbRows; ++r) { if (!displayedValues.at(r).isEmpty()) { allDisplayedEmpty = false; } if (rawValues.at(r) != displayedValues.at(r)) { allEqual = false; } } // Remove the raw column if (allEqual) { // Remove the useless raw column colums_title.removeAt(c); columns_values.removeAt(c); nbCols--; } else if (allDisplayedEmpty) { // Remove the empty column and keep the raw version colums_title.removeAt(c - 1); columns_values.removeAt(c - 1); nbCols--; } } } // Build text QString text = colums_title.join(QLatin1Char(';')) + QLatin1Char('\n'); if (nbCols > 0) { for (int r = 0; r < nbRows; ++r) { for (int c = 0; c < nbCols; ++c) { if (c != 0) { text += QLatin1Char(';'); } text += columns_values.at(c).at(r); } text += QLatin1Char('\n'); } } auto clipBoard = QApplication::clipboard(); if (clipBoard != nullptr) { clipBoard->setText(text); } } } void SKGTreeView::setZoomPosition(int iZoomPosition) { int newZoomPos = qMax(qMin(iZoomPosition, 10), -10); if (newZoomPos != zoomPosition() && m_fontOriginalPointSize + newZoomPos > 1) { QFont newFont = this->font(); newFont.setPointSize(m_fontOriginalPointSize + newZoomPos); int newIconSize = qMax(m_iconOriginalSize + newZoomPos, 1); this->setFont(newFont); this->setIconSize(QSize(newIconSize, newIconSize)); header()->setIconSize(QSize(newIconSize, newIconSize)); if (m_autoResize) { resizeColumnsToContentsDelayed(); } Q_EMIT zoomChanged(newZoomPos); } } int SKGTreeView::zoomPosition() { return this->font().pointSize() - m_fontOriginalPointSize; } bool SKGTreeView::eventFilter(QObject* iObject, QEvent* iEvent) { if (iObject == this && iEvent != nullptr && iEvent->type() == QEvent::Wheel) { auto* e = dynamic_cast(iEvent); - if (m_textResizable && (e != nullptr) && e->orientation() == Qt::Vertical && ((QApplication::keyboardModifiers() &Qt::ControlModifier) != 0u)) { - int numDegrees = e->delta() / 8; + if (m_textResizable && (e != nullptr) && ((QApplication::keyboardModifiers() &Qt::ControlModifier) != 0u)) { + int numDegrees = e->angleDelta().y() / 8; int numTicks = numDegrees / 15; setZoomPosition(zoomPosition() + (numTicks > 0 ? 1 : -1)); e->setAccepted(true); return true; } } if (iObject == this && iEvent != nullptr && iEvent->type() == QEvent::KeyPress) { auto* kevent = dynamic_cast(iEvent); if (kevent != nullptr) { if (kevent->matches(QKeySequence::Copy) && this->state() != QAbstractItemView::EditingState) { copy(); if (iEvent != nullptr) { iEvent->accept(); } return true; // stop the process } } } return QTreeView::eventFilter(iObject, iEvent); } void SKGTreeView::mousePressEvent(QMouseEvent* iEvent) { if ((iEvent != nullptr) && iEvent->button() == Qt::LeftButton && !(this->indexAt(iEvent->pos()).isValid())) { Q_EMIT clickEmptyArea(); clearSelection(); } if ((iEvent != nullptr) && iEvent->button() == Qt::LeftButton && (m_proxyModel != nullptr) && (m_model != nullptr)) { int propertyUUID = m_proxyModel->data(indexAt(iEvent->pos()), 101).toInt(); if (propertyUUID != 0) { SKGPropertyObject prop(m_model->getDocument(), propertyUUID); QDesktopServices::openUrl(prop.getUrl(true)); } } QTreeView::mousePressEvent(iEvent); } bool SKGTreeView::isTextResizable() const { return m_textResizable; } void SKGTreeView::setTextResizable(bool resizable) { if (m_textResizable != resizable) { m_textResizable = resizable; Q_EMIT modified(); } } QTextBrowser* SKGTreeView::getTextBrowser() const { auto output = new QTextBrowser(); QTextCursor tcursor = output->textCursor(); tcursor.beginEditBlock(); // Create table format QTextTableFormat tableFormat; tableFormat.setAlignment(Qt::AlignHCenter); tableFormat.setAlignment(Qt::AlignLeft); tableFormat.setBackground(QColor(255, 255, 255)); tableFormat.setCellPadding(5); tableFormat.setCellSpacing(5); // Create table SKGStringListList table = getTable(); int nbRows = table.count(); int nbCol = table.at(0).count(); QTextTable* tableau = tcursor.insertTable(nbRows, nbCol, tableFormat); // Create frame QTextFrame* frame = tcursor.currentFrame(); QTextFrameFormat frameFormat = frame->frameFormat(); frameFormat.setBorder(0); frame->setFrameFormat(frameFormat); // Create header table format QTextCharFormat headerFormat; headerFormat.setFontPointSize(6); headerFormat.setFontWeight(QFont::Bold); // Create text format QTextCharFormat textFormat; textFormat.setFontPointSize(6); // Create header for (int r = 0; r < nbRows; ++r) { const QStringList& line = table.at(r); for (int c = 0 ; c < nbCol ; ++c) { QTextCursor cellCursor = tableau->cellAt(r, c).firstCursorPosition(); cellCursor.insertText(line.at(c), (r == 0 ? headerFormat : textFormat)); } } // End tcursor.endEditBlock(); return output; } SKGStringListList SKGTreeView::getTable(const QModelIndex& iIndex) const { // Build table SKGStringListList table; // Get header names if (m_model != nullptr) { // Header int nb = m_model->columnCount(); int nb2 = m_model->rowCount(iIndex); table.reserve(1 + nb2 * 2); if (!iIndex.isValid()) { QStringList cols; cols.reserve(nb); for (int i = 0; i < nb; ++i) { cols.append(m_model->headerData(i, Qt::Horizontal, Qt::UserRole).toString().split('|').at(0)); } table.append(cols); } // Get content for (int i = 0; i < nb2; ++i) { QStringList row; row.reserve(nb); for (int j = 0; j < nb; j++) { // We have to check the type for 214849 QModelIndex idx = m_model->index(i, j, iIndex); SKGServices::AttributeType type = m_model->getAttributeType(j); QString display = m_model->data(idx, type == SKGServices::FLOAT || m_model->getObject(idx).getTable().isEmpty() ? Qt::DisplayRole : Qt::UserRole).toString(); if (display.isEmpty()) { display = m_model->data(idx, Qt::DisplayRole).toString(); } row.append(display); } table.append(row); QModelIndex idx0 = m_model->index(i, 0, iIndex); if (m_model->hasChildren(idx0)) { table.append(getTable(idx0)); } } } return table; } SKGError SKGTreeView::exportInFile(const QString& iFileName) { SKGError err; _SKGTRACEINFUNC(10) QString codec = QTextCodec::codecForLocale()->name(); QString extension = QFileInfo(iFileName).suffix().toUpper(); if (extension == QStringLiteral("CSV")) { // Write file QSaveFile file(iFileName); if (!file.open(QIODevice::WriteOnly)) { err.setReturnCode(ERR_INVALIDARG).setMessage(i18nc("Error message", "Save file '%1' failed", iFileName)); } else { QTextStream out(&file); out.setCodec(codec.toLatin1().constData()); QStringList dump = SKGServices::tableToDump(getTable(), SKGServices::DUMP_CSV); int nbl = dump.count(); for (int i = 0; i < nbl; ++i) { out << dump.at(i) << endl; } // Close file file.commit(); } } else if (extension == QStringLiteral("PDF")) { QImage image(this->size(), QImage::Format_ARGB32); QPainter painter(&image); this->render(&painter); painter.end(); { QPrinter printer(QPrinter::HighResolution); printer.setOutputFileName(iFileName); QPainter newPainter(&printer); QRect painterRect = newPainter.viewport(); QSize imageSize = image.size(); imageSize.scale(painterRect.size(), Qt::KeepAspectRatio); newPainter.setViewport(painterRect.x(), painterRect.y(), imageSize.width(), imageSize.height()); newPainter.setWindow(image.rect()); newPainter.drawImage(0, 0, image); newPainter.end(); } } else if (extension == QStringLiteral("SVG")) { QSvgGenerator generator; generator.setFileName(iFileName); generator.setTitle(i18nc("Title of the content SVG export", "Skrooge SVG export")); generator.setDescription(i18nc("Description of the content SVG export", "A SVG drawing created by the Skrooge.")); QPainter painter(&generator); QWidget* w = this->viewport(); w->render(&painter); generator.setSize(QSize(w->widthMM(), w->heightMM())); generator.setViewBox(QRect(0, 0, w->widthMM(), w->heightMM())); painter.end(); } else if (extension == QStringLiteral("HTML")) { // Write file QSaveFile file(iFileName); if (!file.open(QIODevice::WriteOnly)) { err.setReturnCode(ERR_INVALIDARG).setMessage(i18nc("Error message", "Save file '%1' failed", iFileName)); } else { QTextStream out(&file); out.setCodec(codec.toLatin1().constData()); QTextBrowser* tb = getTextBrowser(); if (tb != nullptr) { out << tb->toHtml().replace(QStringLiteral(""), QStringLiteral("")) << endl; delete tb; } // Close file file.commit(); } } else if (extension == QStringLiteral("ODT")) { QTextBrowser* tb = getTextBrowser(); if (tb != nullptr) { QTextDocument doc; doc.setHtml(tb->toHtml()); QTextDocumentWriter docWriter(iFileName); docWriter.write(&doc); delete tb; } } else { // Write file QSaveFile file(iFileName); if (!file.open(QIODevice::WriteOnly)) { err.setReturnCode(ERR_INVALIDARG).setMessage(i18nc("Error message", "Save file '%1' failed", iFileName)); } else { QTextStream out(&file); out.setCodec(codec.toLatin1().constData()); QStringList dump = SKGServices::tableToDump(getTable(), SKGServices::DUMP_TEXT); int nbl = dump.count(); for (int i = 0; i < nbl; ++i) { out << dump.at(i) << endl; } // Close file file.commit(); } } return err; } void SKGTreeView::onExport() { _SKGTRACEINFUNC(10) QString fileName = SKGMainPanel::getSaveFileName(QStringLiteral("kfiledialog:///IMPEXP"), QStringLiteral("text/csv text/plain text/html application/vnd.oasis.opendocument.text image/svg+xml application/pdf"), this); if (!fileName.isEmpty()) { SKGError err = exportInFile(fileName); SKGMainPanel::displayErrorMessage(err); QDesktopServices::openUrl(QUrl::fromLocalFile(fileName)); } } void SKGTreeView::setModel(QAbstractItemModel* iModel) { if (iModel != this->model()) { m_model = qobject_cast(iModel); m_proxyModel = qobject_cast (iModel); if (m_proxyModel != nullptr) { m_model = qobject_cast(m_proxyModel->sourceModel()); } if (m_model != nullptr) { connect(m_model, &SKGObjectModelBase::afterReset, this, &SKGTreeView::setupHeaderMenu); // connect(m_model, &SKGObjectModelBase::afterReset, this, &SKGTreeView::onSelectionChanged); connect(m_model, &SKGObjectModelBase::afterReset, this, &SKGTreeView::respanFirstColumns, Qt::QueuedConnection); } QTreeView::setModel(iModel); rebuildContextualMenu(); refreshExpandCollapse(); } } QMenu* SKGTreeView::getHeaderMenu() const { return m_headerMenu; } void SKGTreeView::rebuildContextualMenu() { // Remove all Actions const auto list = actions(); for (auto act : list) { removeAction(act); } if (selectionMode() != NoSelection) { // Build contextual menu this->insertAction(nullptr, m_actCopy); this->insertAction(nullptr, m_actExpandAll); this->insertAction(nullptr, m_actCollapseAll); if ((m_model != nullptr) && (SKGMainPanel::getMainPanel() != nullptr)) { const auto list = SKGMainPanel::getMainPanel()->getActionsForContextualMenu(m_model->getRealTable()); for (const auto& act : list) { if (act == nullptr) { insertGlobalAction(); } else { insertAction(nullptr, act); } } } } } diff --git a/skgbasegui/skgwebview.cpp b/skgbasegui/skgwebview.cpp index 42820f5a2..2ae271cba 100644 --- a/skgbasegui/skgwebview.cpp +++ b/skgbasegui/skgwebview.cpp @@ -1,347 +1,347 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ /** @file * A web viewer with more features. * * @author Stephane MANKOWSKI / Guillaume DE BURE */ #include "skgwebview.h" #include #include #include #include #include #include #include #include #include #ifdef SKG_WEBENGINE #include #else #include #endif #include #include #include #include #include #include #include #include #include #include #include #include "skgmainpanel.h" #include "skgtraces.h" #ifdef SKG_WEBENGINE class SKGWebEnginePage : public QWebEnginePage { Q_DISABLE_COPY(SKGWebEnginePage) public: explicit SKGWebEnginePage(QObject* p = nullptr) : QWebEnginePage(p) {} virtual bool acceptNavigationRequest(const QUrl& url, NavigationType type, bool isMainFrame) override { if (type == QWebEnginePage::NavigationTypeLinkClicked) { if (url.toString().startsWith(QLatin1String("https://linkclicked/"))) { SKGWebView* v = qobject_cast(this->view()); if (v) { v->emitLinkClicked(url); return false; } } else { SKGMainPanel::getMainPanel()->openPage(url); return false; } } return QWebEnginePage::acceptNavigationRequest(url, type, isMainFrame); } }; SKGWebView::SKGWebView(QWidget* iParent, const char* name, bool iWithContextualMenu) : QWebEngineView(iParent), m_ContextualMenu(iWithContextualMenu) { setObjectName(name); setPage(new SKGWebEnginePage(this)); if (m_ContextualMenu) { this->installEventFilter(this); page()->installEventFilter(this); } connect(this, &SKGWebView::fileExporter, this, [](const QString & iFileName) { QDesktopServices::openUrl(QUrl::fromLocalFile(iFileName)); }); } void SKGWebView::emitLinkClicked(const QUrl& iURL) { Q_EMIT linkClicked(iURL); } #else SKGWebView::SKGWebView(QWidget* iParent, const char* name) : QWebView(iParent) { setObjectName(name); this->installEventFilter(this); page()->installEventFilter(this); connect(this, &SKGWebView::fileExporter, this, [](const QString & iFileName) { QDesktopServices::openUrl(QUrl::fromLocalFile(iFileName)); }); connect(this, &SKGWebView::linkClicked, this, [ = ](const QUrl & val) { SKGMainPanel::getMainPanel()->openPage(val); }); this->page()->setForwardUnsupportedContent(true); connect(this->page(), &QWebPage::unsupportedContent, this, [ = ](QNetworkReply * reply) { openReply(reply); }); connect(this->page(), &QWebPage::downloadRequested, this, [ = ](const QNetworkRequest & request) { QNetworkAccessManager manager; openReply(manager.get(request)); }); } void SKGWebView::openReply(QNetworkReply* reply) { QString fileName = QDir::tempPath() + '/' + "export.csv"; QFile file(fileName); if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { file.write(reply->readAll()); file.close(); } QDesktopServices::openUrl(QUrl::fromLocalFile(fileName)); reply->deleteLater(); } #endif SKGWebView::~SKGWebView() = default; QString SKGWebView::getState() { SKGTRACEINFUNC(10) QDomDocument doc(QStringLiteral("SKGML")); QDomElement root = doc.createElement(QStringLiteral("parameters")); doc.appendChild(root); root.setAttribute(QStringLiteral("zoomFactor"), SKGServices::intToString(qMax(qRound(30.0 * log10(zoomFactor())), -10))); return doc.toString(); } void SKGWebView::setState(const QString& iState) { SKGTRACEINFUNC(10) QDomDocument doc(QStringLiteral("SKGML")); doc.setContent(iState); QDomElement root = doc.documentElement(); QString zoomPosition = root.attribute(QStringLiteral("zoomFactor")); if (zoomPosition.isEmpty()) { zoomPosition = '0'; } double z = qPow(10, (static_cast(SKGServices::stringToInt(zoomPosition)) / 30.0)); setZoomFactor(z); emit zoomChanged(z); } void SKGWebView::contextMenuEvent(QContextMenuEvent* iEvent) { if (iEvent != nullptr) { auto menu = new QMenu(this); #ifdef SKG_WEBENGINE menu->addAction(pageAction(QWebEnginePage::Copy)); #else menu->addAction(pageAction(QWebPage::Copy)); #endif QAction* actPrint = menu->addAction(SKGServices::fromTheme(QStringLiteral("printer")), i18nc("Action", "Print...")); connect(actPrint, &QAction::triggered, this, &SKGWebView::onPrint); menu->addAction(KStandardAction::printPreview(this, SLOT(onPrintPreview()), this)); QAction* actExport = menu->addAction(SKGServices::fromTheme(QStringLiteral("document-export")), i18nc("Noun, user action", "Export...")); connect(actExport, &QAction::triggered, this, &SKGWebView::onExport); menu->popup(this->mapToGlobal(iEvent->pos())); iEvent->accept(); } } bool SKGWebView::eventFilter(QObject* iObject, QEvent* iEvent) { SKGTRACEINFUNC(10) if ((iEvent != nullptr) && iEvent->type() == QEvent::Wheel) { auto* e = dynamic_cast(iEvent); if (e != nullptr) { - if (e->orientation() == Qt::Vertical && ((QApplication::keyboardModifiers() &Qt::ControlModifier) != 0u)) { - int numDegrees = e->delta() / 8; + if ((QApplication::keyboardModifiers() &Qt::ControlModifier) != 0u) { + int numDegrees = e->angleDelta().y() / 8; int numTicks = numDegrees / 15; if (numTicks > 0) { onZoomIn(); } else { onZoomOut(); } e->setAccepted(true); return true; } } } return QWidget::eventFilter(iObject, iEvent); } void SKGWebView::onZoomIn() { _SKGTRACEINFUNC(10) int z = qMin(static_cast(qRound(30.0 * log10(zoomFactor()))) + 1, 10); setZoomFactor(qPow(10, static_cast(z) / 30.0)); emit zoomChanged(z); } void SKGWebView::onZoomOut() { _SKGTRACEINFUNC(10) int z = qMax(static_cast(qRound(30.0 * log10(zoomFactor()))) - 1, -10); setZoomFactor(qPow(10, static_cast(z) / 30.0)); emit zoomChanged(z); } void SKGWebView::onZoomOriginal() { _SKGTRACEINFUNC(10) setZoomFactor(0); emit zoomChanged(0); } void SKGWebView::exportInFile(const QString& iFileName) { QString extension = QFileInfo(iFileName).suffix().toUpper(); if (extension == QStringLiteral("ODT")) { #ifdef SKG_WEBENGINE page()->toHtml([ = ](const QString & result) { QTextDocument doc; QTextDocumentWriter docWriter(iFileName); doc.setHtml(result); docWriter.write(&doc); emit fileExporter(iFileName); }); #else QTextDocument doc; QTextDocumentWriter docWriter(iFileName); doc.setHtml(page()->mainFrame()->toHtml()); docWriter.write(&doc); emit fileExporter(iFileName); #endif } else if (extension == QStringLiteral("PDF")) { #ifdef SKG_WEBENGINE page()->printToPdf(iFileName); connect(page(), &QWebEnginePage::pdfPrintingFinished, this, &SKGWebView::fileExporter); #else QPrinter printer; printer.setOutputFileName(iFileName); print(&printer); emit fileExporter(iFileName); #endif } else if (extension == QStringLiteral("HTML") || extension == QStringLiteral("HTM")) { #ifdef SKG_WEBENGINE page()->toHtml([ = ](const QString & result) { QSaveFile file(iFileName); if (file.open(QIODevice::WriteOnly)) { QTextStream out(&file); out << result; // Close file file.commit(); emit fileExporter(iFileName); } }); #else QSaveFile file(iFileName); if (file.open(QIODevice::WriteOnly)) { QTextStream out(&file); out << page()->mainFrame()->toHtml(); // Close file file.commit(); emit fileExporter(iFileName); } #endif } else { QImage image(this->size(), QImage::Format_ARGB32); QPainter painter(&image); this->render(&painter); painter.end(); image.save(iFileName); emit fileExporter(iFileName); } } void SKGWebView::onExport() { _SKGTRACEINFUNC(10) QString fileName = SKGMainPanel::getSaveFileName(QStringLiteral("kfiledialog:///IMPEXP"), QStringLiteral("application/pdf text/html application/vnd.oasis.opendocument.text image/png image/jpeg image/gif image/tiff"), this); if (fileName.isEmpty()) { return; } exportInFile(fileName); } void SKGWebView::onPrintPreview() { SKGTRACEINFUNC(10) QPointer dialog = new QPrintPreviewDialog(this); #ifdef SKG_WEBENGINE // TODO(SMI): QWebEngine connect(dialog.data(), &QPrintPreviewDialog::paintRequested, page(), [&](QPrinter * printer) { page()->print(printer, [](bool) {}); }); #else connect(dialog.data(), &QPrintPreviewDialog::paintRequested, this, &SKGWebView::print); #endif dialog->exec(); } void SKGWebView::onPrint() { _SKGTRACEINFUNC(10) QPointer dialog = new QPrintDialog(&m_printer, this); if (dialog->exec() == QDialog::Accepted) { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); #ifdef SKG_WEBENGINE page()->print(&m_printer, [](bool) {}); #else print(&m_printer); #endif QApplication::restoreOverrideCursor(); } } diff --git a/skgbaseguidesigner/skgcalculatoreditdesignerplugin.h b/skgbaseguidesigner/skgcalculatoreditdesignerplugin.h index 4de880948..1c04a0e38 100644 --- a/skgbaseguidesigner/skgcalculatoreditdesignerplugin.h +++ b/skgbaseguidesigner/skgcalculatoreditdesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGCALCULATOREDITDESIGNERPLUGIN_H #define SKGCALCULATOREDITDESIGNERPLUGIN_H /** @file * A QLineEdit with calculator included (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGCalculatorEdit */ class SKGCalculatorEditDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGCalculatorEditDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skgcolorbuttondesignerplugin.h b/skgbaseguidesigner/skgcolorbuttondesignerplugin.h index e5a2ad101..7555d7d0f 100644 --- a/skgbaseguidesigner/skgcolorbuttondesignerplugin.h +++ b/skgbaseguidesigner/skgcolorbuttondesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGCOLORBUTTONDESIGNERPLUGIN_H #define SKGCOLORBUTTONDESIGNERPLUGIN_H /** @file * A color button with more features (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGColorButton */ class SKGColorButtonDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGColorButtonDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skgcomboboxdesignerplugin.h b/skgbaseguidesigner/skgcomboboxdesignerplugin.h index e781ddc32..36b986a1c 100644 --- a/skgbaseguidesigner/skgcomboboxdesignerplugin.h +++ b/skgbaseguidesigner/skgcomboboxdesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGCOMBOBOXDESIGNERPLUGIN_H #define SKGCOMBOBOXDESIGNERPLUGIN_H /** @file * A combo box with more features (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGComboBox */ class SKGComboBoxDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGComboBoxDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skgdateeditdesignerplugin.h b/skgbaseguidesigner/skgdateeditdesignerplugin.h index cde9d473b..c4b2ff0c9 100644 --- a/skgbaseguidesigner/skgdateeditdesignerplugin.h +++ b/skgbaseguidesigner/skgdateeditdesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGDATEEDITDESIGNERPLUGIN_H #define SKGDATEEDITDESIGNERPLUGIN_H /** @file * A date edit with more features (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGDateEdit */ class SKGDateEditDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGDateEditDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skgfilteredtableviewdesignerplugin.h b/skgbaseguidesigner/skgfilteredtableviewdesignerplugin.h index ff765af06..958ba362f 100644 --- a/skgbaseguidesigner/skgfilteredtableviewdesignerplugin.h +++ b/skgbaseguidesigner/skgfilteredtableviewdesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGFILTEREDTABLEVIEWDESIGNERPLUGIN_H #define SKGFILTEREDTABLEVIEWDESIGNERPLUGIN_H /** @file * A widget to select what to show (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGFilteredTableView */ class SKGFilteredTableViewDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGFilteredTableViewDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skggraphicsviewdesignerplugin.h b/skgbaseguidesigner/skggraphicsviewdesignerplugin.h index d4ab9a760..a8edf07bc 100644 --- a/skgbaseguidesigner/skggraphicsviewdesignerplugin.h +++ b/skgbaseguidesigner/skggraphicsviewdesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGGRAPHICSVIEWDESIGNERPLUGIN_H #define SKGGRAPHICSVIEWDESIGNERPLUGIN_H /** @file * A Graphic view with more functionalities (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGGraphicsView */ class SKGGraphicsViewDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGGraphicsViewDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skgperiodeditdesignerplugin.h b/skgbaseguidesigner/skgperiodeditdesignerplugin.h index b9bfeaf84..d5f557004 100644 --- a/skgbaseguidesigner/skgperiodeditdesignerplugin.h +++ b/skgbaseguidesigner/skgperiodeditdesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGPERIODEDITDESIGNERPLUGIN_H #define SKGPERIODEDITDESIGNERPLUGIN_H /** @file * A period editor (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGColorButton */ class SKGPeriodEditDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGPeriodEditDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skgprogressbardesignerplugin.h b/skgbaseguidesigner/skgprogressbardesignerplugin.h index 1bf7baa53..1f39ca32d 100644 --- a/skgbaseguidesigner/skgprogressbardesignerplugin.h +++ b/skgbaseguidesigner/skgprogressbardesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGPROGRESSBARDESIGNERPLUGIN_H #define SKGPROGRESSBARDESIGNERPLUGIN_H /** @file * A progress bar with colors * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGProgressBar */ class SKGProgressBarDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGProgressBarDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skgshowdesignerplugin.h b/skgbaseguidesigner/skgshowdesignerplugin.h index a54e64248..ece4c15f1 100644 --- a/skgbaseguidesigner/skgshowdesignerplugin.h +++ b/skgbaseguidesigner/skgshowdesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGSHOWDESIGNERPLUGIN_H #define SKGSHOWDESIGNERPLUGIN_H /** @file * A widget to select what to show (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGShow */ class SKGShowDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGShowDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skgsimpleperiodeditdesignerplugin.h b/skgbaseguidesigner/skgsimpleperiodeditdesignerplugin.h index d4ff64d5c..91286469e 100644 --- a/skgbaseguidesigner/skgsimpleperiodeditdesignerplugin.h +++ b/skgbaseguidesigner/skgsimpleperiodeditdesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGSIMPLEPERIODEDITDESIGNERPLUGIN_H #define SKGSIMPLEPERIODEDITDESIGNERPLUGIN_H /** @file * A period editor (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGColorButton */ class SKGSimplePeriodEditDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGSimplePeriodEditDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skgtableviewdesignerplugin.h b/skgbaseguidesigner/skgtableviewdesignerplugin.h index 25b5cf505..46d8d57fe 100644 --- a/skgbaseguidesigner/skgtableviewdesignerplugin.h +++ b/skgbaseguidesigner/skgtableviewdesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGTABLEVIEWDESIGNERPLUGIN_H #define SKGTABLEVIEWDESIGNERPLUGIN_H /** @file * A table view with more features (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGTableView */ class SKGTableViewDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGTableViewDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skgtablewidgetdesignerplugin.h b/skgbaseguidesigner/skgtablewidgetdesignerplugin.h index 64661f0c7..0ec9991c9 100644 --- a/skgbaseguidesigner/skgtablewidgetdesignerplugin.h +++ b/skgbaseguidesigner/skgtablewidgetdesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGTABLEWIDGETDESIGNERPLUGIN_H #define SKGTABLEWIDGETDESIGNERPLUGIN_H /** @file * A table widget with more features (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGTableWidget */ class SKGTableWidgetDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGTableWidgetDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skgtablewithgraphdesignerplugin.h b/skgbaseguidesigner/skgtablewithgraphdesignerplugin.h index 3affd39a4..9e613198e 100644 --- a/skgbaseguidesigner/skgtablewithgraphdesignerplugin.h +++ b/skgbaseguidesigner/skgtablewithgraphdesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGTABLEWITHGRAPHDESIGNERPLUGIN_H #define SKGTABLEWITHGRAPHDESIGNERPLUGIN_H /** @file * A table with graph (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGTableWithGraph */ class SKGTableWithGraphDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGTableWithGraphDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skgtabwidgetdesignerplugin.h b/skgbaseguidesigner/skgtabwidgetdesignerplugin.h index 726e0b344..d72ecdb6d 100644 --- a/skgbaseguidesigner/skgtabwidgetdesignerplugin.h +++ b/skgbaseguidesigner/skgtabwidgetdesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGTABWIDGETDESIGNERPLUGIN_H #define SKGTABWIDGETDESIGNERPLUGIN_H /** @file * A QTabWidget (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGTabWidget */ class SKGTabWidgetDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGTabWidgetDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skgtreeviewdesignerplugin.h b/skgbaseguidesigner/skgtreeviewdesignerplugin.h index 12f32bb41..719371318 100644 --- a/skgbaseguidesigner/skgtreeviewdesignerplugin.h +++ b/skgbaseguidesigner/skgtreeviewdesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGTREEVIEWDESIGNERPLUGIN_H #define SKGTREEVIEWDESIGNERPLUGIN_H /** @file * A tree view with more features (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGTreeView */ class SKGTreeViewDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGTreeViewDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skgwebviewdesignerplugin.h b/skgbaseguidesigner/skgwebviewdesignerplugin.h index a00bcc309..d248b28f5 100644 --- a/skgbaseguidesigner/skgwebviewdesignerplugin.h +++ b/skgbaseguidesigner/skgwebviewdesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGWEBVIEWDESIGNERPLUGIN_H #define SKGWEBVIEWDESIGNERPLUGIN_H /** @file * A web viewer with more features (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGWebView */ class SKGWebViewDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGWebViewDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skgwidgetcollectiondesignerplugin.h b/skgbaseguidesigner/skgwidgetcollectiondesignerplugin.h index 8336cd97d..912f6afd7 100644 --- a/skgbaseguidesigner/skgwidgetcollectiondesignerplugin.h +++ b/skgbaseguidesigner/skgwidgetcollectiondesignerplugin.h @@ -1,54 +1,54 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGWIDGETCOLLECTIONDESIGNERPLUGIN_H #define SKGWIDGETCOLLECTIONDESIGNERPLUGIN_H /** @file * A collection of widgets (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include #include "skgbaseguidesigner_export.h" /** * QDesigner plugin collection */ class SKGBASEGUIDESIGNER_EXPORT SKGWidgetCollectionDesignerPlugin: public QObject, public QDesignerCustomWidgetCollectionInterface { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetCollectionInterface") Q_INTERFACES(QDesignerCustomWidgetCollectionInterface) public: /** * Constructor * @param iParent the parent */ explicit SKGWidgetCollectionDesignerPlugin(QObject* iParent = nullptr); /** * To get the list of widgets * @return the list of widgets */ QList customWidgets() const override; private: QList m_widgets; }; #endif // SKGWIDGETCOLLECTIONDESIGNERPLUGIN_H diff --git a/skgbaseguidesigner/skgwidgetselectordesignerplugin.h b/skgbaseguidesigner/skgwidgetselectordesignerplugin.h index 25c86bbfc..fc15a4146 100644 --- a/skgbaseguidesigner/skgwidgetselectordesignerplugin.h +++ b/skgbaseguidesigner/skgwidgetselectordesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGWIDGETSELECTORDESIGNERPLUGIN_H #define SKGWIDGETSELECTORDESIGNERPLUGIN_H /** @file * A widget selector (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGWidgetSelector */ class SKGWidgetSelectorDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGWidgetSelectorDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif diff --git a/skgbaseguidesigner/skgzoomselectordesignerplugin.h b/skgbaseguidesigner/skgzoomselectordesignerplugin.h index 9023a0468..e7e13ae1b 100644 --- a/skgbaseguidesigner/skgzoomselectordesignerplugin.h +++ b/skgbaseguidesigner/skgzoomselectordesignerplugin.h @@ -1,112 +1,112 @@ /*************************************************************************** * Copyright (C) 2008 by S. MANKOWSKI / G. DE BURE support@mankowski.fr * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see * ***************************************************************************/ #ifndef SKGZOOMSELECTORDESIGNERPLUGIN_H #define SKGZOOMSELECTORDESIGNERPLUGIN_H /** @file * A color button with more features (qt designer plugin). * * @author Stephane MANKOWSKI / Guillaume DE BURE */ -#include +#include /** * QDesigner plugin for SKGZoomSelector */ class SKGZoomSelectorDesignerPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: /** * Constructor * @param iParent parent */ explicit SKGZoomSelectorDesignerPlugin(QObject* iParent = nullptr); /** * To know if the component is a container * @return true or false */ bool isContainer() const override; /** * To know if the component is initialized * @return true or false */ bool isInitialized() const override; /** * To get the icon for this component * @return the icon */ QIcon icon() const override; /** * To get the icon for this component * @return */ QString domXml() const override; /** * To get the group for this component * @return group */ QString group() const override; /** * To get the include file for this component * @return the include file */ QString includeFile() const override; /** * To get the name for this component * @return name */ QString name() const override; /** * To get the "tool tip" for this component * @return the "tool tip" */ QString toolTip() const override; /** * To get the "whats this" for this component * @return the "whats this" */ QString whatsThis() const override; /** * To get the widget representing the component * @param iParent the parent of the widget * @return the widget */ QWidget* createWidget(QWidget* iParent) override; /** * Initilialize the component * @param iCore interface */ void initialize(QDesignerFormEditorInterface* iCore) override; private: bool m_initialized; }; #endif