Commit 674495e7 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Add skeleton db explorer

parent 76eca70e
add_subdirectory(tests)
add_subdirectory(dbexplorer)
set(kritaresources_LIB_SRCS
KisResourceCacheDb.cpp
......
set(kritadbexplorer_SOURCES
DbExplorer.cpp
DlgDbExplorer.cpp
)
ki18n_wrap_ui(kritadbexplorer_SOURCES WdgDbExplorer.ui )
add_library(kritadbexplorer MODULE ${kritadbexplorer_SOURCES})
target_link_libraries(kritadbexplorer
PRIVATE
kritaui
Qt5::Core
Qt5::Widgets
Qt5::Sql
)
install(TARGETS kritadbexplorer DESTINATION ${KRITA_PLUGIN_INSTALL_DIR})
install( FILES dbexplorer.xmlgui DESTINATION ${DATA_INSTALL_DIR}/kritaplugins)
install(FILES dbexplorer.action DESTINATION ${DATA_INSTALL_DIR}/krita/actions)
/*
* Copyright (c) 2018 Boudewijn Rempt <boud@valdyas.org>
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "DbExplorer.h"
#include <cmath>
#include <klocalizedstring.h>
#include <kis_debug.h>
#include <kpluginfactory.h>
#include <kis_icon.h>
#include <KisViewManager.h>
#include <kis_action.h>
#include "DlgDbExplorer.h"
K_PLUGIN_FACTORY_WITH_JSON(DbExplorerFactory, "kritadbexplorer.json", registerPlugin<DbExplorer>();)
DbExplorer::DbExplorer(QObject *parent, const QVariantList &)
: KisActionPlugin(parent)
{
KisAction *action = createAction("dbexplorer");
connect(action, SIGNAL(triggered()), this, SLOT(slotDbExplorer()));
}
DbExplorer::~DbExplorer()
{
}
void DbExplorer::slotDbExplorer()
{
DlgDbExplorer dlgDbExplorer(viewManager()->mainWindow());
dlgDbExplorer.exec();
}
#include "DbExplorer.moc"
/*
* Copyright (c) 2018 Boudewijn Rempt <boud@valdyas.org>
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DBEXPLORER_H
#define DBEXPLORER_H
#include <QVariant>
#include <KisActionPlugin.h>
class KUndo2MagicString;
class DbExplorer : public KisActionPlugin
{
Q_OBJECT
public:
DbExplorer(QObject *parent, const QVariantList &);
~DbExplorer() override;
public Q_SLOTS:
void slotDbExplorer();
};
#endif // DBEXPLORER_H
/*
* Copyright (c) 2018 Boudewijn Rempt <boud@valdyas.org>
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "DlgDbExplorer.h"
#include <klocalizedstring.h>
#include <kis_debug.h>
#include <QTableView>
#include <QtSql/QSqlTableModel>
DlgDbExplorer::DlgDbExplorer(QWidget *parent)
: KoDialog(parent)
{
setCaption(i18n("Please paste this information in your bug report"));
setButtons(Ok);
m_page = new WdgDbExplorer(this);
Q_CHECK_PTR(m_page);
setMainWidget(m_page);
QSqlTableModel *storagesModel = new QSqlTableModel(this);
QSqlTableModel *tagsModel = new QSqlTableModel(this);
QSqlTableModel *resourcesModel = new QSqlTableModel(this);
QSqlTableModel *versionModel = new QSqlTableModel(this);
}
DlgDbExplorer::~DlgDbExplorer()
{
}
/*
* Copyright (c) 2018 Boudewijn Rempt <boud@valdyas.org>
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_DBEXPLORER
#define DLG_DBEXPLORER
#include <KoDialog.h>
#include "ui_WdgDbExplorer.h"
class WdgDbExplorer : public QWidget, public Ui::WdgDbExplorer
{
Q_OBJECT
public:
WdgDbExplorer(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class DlgDbExplorer: public KoDialog
{
Q_OBJECT
public:
DlgDbExplorer(QWidget * parent = 0);
~DlgDbExplorer() override;
private:
WdgDbExplorer *m_page;
};
#endif // DLG_DBEXPLORER
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WdgDbExplorer</class>
<widget class="QWidget" name="WdgDbExplorer">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>439</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tabStorages">
<attribute name="title">
<string>Storages</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTableView" name="tableStorages"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabResources">
<attribute name="title">
<string>Resources</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cmbResourceTypes"/>
</item>
</layout>
</item>
<item>
<widget class="QTableView" name="tableResources"/>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>lblThumbnail</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Versions</string>
</property>
</widget>
</item>
<item>
<widget class="QTableView" name="tableVersions"/>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabTags">
<attribute name="title">
<string>Tags</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QTableView" name="tableTags"/>
</item>
<item>
<widget class="QTableView" name="tableTaggedResources"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabSchema">
<attribute name="title">
<string>Schema Information</string>
</attribute>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Database Version</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="txtDatabaseVersion">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Krita Version</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="txtKritaVersion">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Creation Date</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="txtCreationDate">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ActionCollection version="2" name="DbExplorer">
<Actions category="DbExplorer">
<text>Database Explorer</text>
<Action name="dbexplorer">
<icon></icon>
<text>&amp;Explore Resources Cache Database...</text>
<whatsThis>Resources Cache Database</whatsThis>
<toolTip>Resources Cache Database</toolTip>
<iconText>Resources Cache Database</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
</Actions>
</ActionCollection>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritadbexplorer" version="8" translationDomain="krita">
<MenuBar>
<Menu name="Tools">
<Action name="dbexplorer"/>
</Menu>
</MenuBar>
</kpartgui>
{
"Id": "Cache Db Explorer Plugin",
"Type": "Service",
"X-KDE-Library": "kritadbexplorer",
"X-KDE-ServiceTypes": [
"Krita/ViewPlugin"
],
"X-Krita-Version": "28"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment