Commit a039b491 authored by camilo higuita's avatar camilo higuita

polihs the piebutton wiht floating button

parent 94517a45
......@@ -17,86 +17,112 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.6
import QtQuick.Controls 2.2
import QtQuick 2.10
import QtQuick.Controls 2.10
import org.kde.mauikit 1.0 as Maui
import org.kde.kirigami 2.7 as Kirigami
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
ToolButton
{
Item
{
id: control
property int alignment : Qt.AlignLeft
property int barHeight : 0
property int maxWidth : ApplicationWindow.overlay.width * (isMobile ? 1 : 0.5)
property int maxWidth : ApplicationWindow.overlay.width * (Kirigami.Settings.isMobile ? 1 : 0.5)
property alias content : content.middleContent
default property list<Action> actions
property alias icon : _button.icon
property alias text: _button.text
property alias display: _button.display
onClicked: popup.visible ? close(): open()
implicitWidth: _actionsBar.visible ? Math.min(maxWidth, height + _actionsBar.implicitWidth + Maui.Style.space.big) : height
layer.enabled: true
clip: true
z: 1
Popup
{
id: popup
height: barHeight
implicitWidth: content.middleLayout.implicitWidth + Maui.Style.space.big + Maui.Style.space.small
width: implicitWidth > maxWidth ? maxWidth : (content.middleLayout.implicitWidth > ApplicationWindow.overlay.width ? ApplicationWindow.overlay.width : implicitWidth)
padding: 0
margins: 0
x: alignment === Qt.AlignLeft ? (control.x - width) - Maui.Style.space.big : (control.x + control.width) + Maui.Style.space.big
y: parent.height / 2 - height / 2
background: Rectangle
Behavior on implicitWidth
{
NumberAnimation
{
radius: Maui.Style.radiusV
color: Kirigami.Theme.backgroundColor
border.color: Kirigami.Theme.borderColor
duration: Kirigami.Units.longDuration
easing.type: Easing.InOutQuad
}
onFocusChanged: !activeFocus || !focus ? close() : undefined
enter: Transition
{
// grow_fade_in
NumberAnimation { property: "scale"; from: 0.9; to: 1.0; easing.type: Easing.OutQuint; duration: 220 }
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; easing.type: Easing.OutCubic; duration: 150 }
}
exit: Transition
Rectangle
{
id: _background
visible: _actionsBar.visible
anchors.fill: parent
color: _button.Kirigami.Theme.backgroundColor
radius: Maui.Style.radiusV
}
DropShadow
{
// shrink_fade_out
NumberAnimation { property: "scale"; from: 1.0; to: 0.9; easing.type: Easing.OutQuint; duration: 220 }
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.OutCubic; duration: 150 }
}
visible: _actionsBar.visible
anchors.fill: _background
cached: true
horizontalOffset: 0
verticalOffset: 0
radius: 8.0
samples: 16
color: "#333"
opacity: 0.5
smooth: true
source: _background
}
Maui.ToolBar
RowLayout
{
anchors.fill: parent
Maui.ToolBar
{
id: content
anchors.fill: parent
implicitHeight: parent.height
spacing: Maui.Style.space.big
// Kirigami.Theme.backgroundColor: "transparent"
id: _actionsBar
visible: false
Layout.fillWidth: true
Layout.fillHeight: true
background: null
background: Rectangle
middleContent: Repeater
{
color: Kirigami.Theme.backgroundColor
radius: Maui.Style.radiusV
border.color: Qt.tint(Kirigami.Theme.textColor, Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.7))
model: control.actions
ToolButton
{
Layout.fillHeight: true
action: modelData
display: ToolButton.TextUnderIcon
onClicked: control.close()
}
}
}
}
Maui.FloatingButton
{
id: _button
Layout.fillHeight: true
Layout.preferredHeight: control.height
Layout.alignment:Qt.AlignRight
onClicked: _actionsBar.visible = !_actionsBar.visible
}
}
function open()
{
popup.open()
_actionsBar.visible = true
}
function close()
{
popup.close()
_actionsBar.visible = false
}
}
......@@ -19,23 +19,17 @@
#include "mauiaccounts.h"
#include "accountsdb.h"
MauiAccounts::MauiAccounts(QObject *parent) : MauiList(parent),
db(new AccountsDB(parent))
MauiAccounts::MauiAccounts() : MauiList(nullptr),
db(new AccountsDB(nullptr))
{
this->setAccounts();
}
MauiAccounts::~MauiAccounts()
{
}
MauiAccounts *MauiAccounts::m_instance = nullptr;
MauiAccounts *MauiAccounts::instance(QObject *parent)
{
if(MauiAccounts::m_instance == nullptr)
MauiAccounts::m_instance = new MauiAccounts(parent);
return MauiAccounts::m_instance;
qDebug() << "DELETING MAUI ACCOUNTS INSTANCE";
this->db->deleteLater();
this->db = nullptr;
}
FMH::MODEL_LIST MauiAccounts::items() const
......
......@@ -41,14 +41,23 @@ class MAUIKIT_EXPORT MauiAccounts : public MauiList
#endif
{
Q_OBJECT
Q_PROPERTY(int currentAccountIndex READ getCurrentAccountIndex WRITE setCurrentAccountIndex NOTIFY currentAccountIndexChanged)
Q_PROPERTY(QVariantMap currentAccount READ getCurrentAccount NOTIFY currentAccountChanged)
Q_PROPERTY(uint count READ getCount NOTIFY countChanged)
public:
static MauiAccounts * instance(QObject *parent = nullptr);
static MauiAccounts *instance()
{
static MauiAccounts accounts;
return &accounts;
}
MauiAccounts(const MauiAccounts&) = delete;
MauiAccounts& operator=(const MauiAccounts &) = delete;
MauiAccounts(MauiAccounts &&) = delete;
MauiAccounts & operator=(MauiAccounts &&) = delete;
FMH::MODEL_LIST items() const final override;
void setCurrentAccountIndex(const int &index);
......@@ -69,10 +78,9 @@ public slots:
void refresh();
private:
static MauiAccounts *m_instance;
MauiAccounts(QObject *parent = nullptr);
~MauiAccounts() override;
MauiAccounts();
~MauiAccounts();
AccountsDB *db;
FMH::MODEL_LIST m_data;
QVariantMap m_currentAccount;
......@@ -93,7 +101,6 @@ signals:
void currentAccountChanged(QVariantMap account);
void currentAccountIndexChanged(int index);
void countChanged(uint count);
};
#endif // MAUIACCOUNTS_H
......@@ -25,25 +25,14 @@
#include "mauiaccounts.h"
#endif
MauiApp::MauiApp(QObject *parent) : QObject(parent)
MauiApp::MauiApp() : QObject(nullptr)
#ifdef COMPONENT_ACCOUNTS
, m_accounts(MauiAccounts::instance(this))
, m_accounts(MauiAccounts::instance())
#else
, m_accounts(nullptr)
#endif
{}
MauiApp::~MauiApp() {}
MauiApp * MauiApp::m_instance = nullptr;
MauiApp * MauiApp::instance()
{
if(MauiApp::m_instance == nullptr)
MauiApp::m_instance = new MauiApp();
return MauiApp::m_instance;
}
QString MauiApp::getName()
{
return qApp->applicationName();
......@@ -173,11 +162,9 @@ MauiAccounts * MauiApp::getAccounts() const
#endif
MauiApp * MauiApp::qmlAttachedProperties(QObject* object)
{
if(MauiApp::m_instance == nullptr)
MauiApp::m_instance = new MauiApp(object);
return MauiApp::m_instance;
{
Q_UNUSED(object)
return MauiApp::instance();
}
void MauiApp::notify(const QString &icon, const QString& title, const QString& body, const QJSValue& callback, const int& timeout, const QString& buttonText)
......
......@@ -55,7 +55,17 @@ class MAUIKIT_EXPORT MauiApp : public QObject
public:
static MauiApp *qmlAttachedProperties(QObject *object);
static MauiApp *instance();
static MauiApp *instance()
{
static MauiApp app;
return &app;
}
MauiApp(const MauiApp&) = delete;
MauiApp& operator=(const MauiApp &) = delete;
MauiApp(MauiApp &&) = delete;
MauiApp & operator=(MauiApp &&) = delete;
static QString getName();
static QString getDisplayName();
......@@ -97,12 +107,8 @@ public:
MauiAccounts *getAccounts() const;
#endif
~MauiApp();
private:
static MauiApp *m_instance;
MauiApp(QObject *parent = nullptr);
MauiApp(const MauiApp &other) = delete;
MauiApp();
MauiAccounts *m_accounts;
QString description;
......
......@@ -21,7 +21,7 @@
#include <QUuid>
#include "fmh.h"
TAGDB::TAGDB(QObject *parent) : QObject(parent)
TAGDB::TAGDB() : QObject(nullptr)
{
QDir collectionDBPath_dir(TAG::TaggingPath);
if (!collectionDBPath_dir.exists())
......
......@@ -36,7 +36,15 @@
#include "tag.h"
#ifndef STATIC_MAUIKIT
#include "mauikit_export.h"
#endif
#ifdef STATIC_MAUIKIT
class TAGDB : public QObject
#else
class MAUIKIT_EXPORT TAGDB : public QObject
#endif
{
Q_OBJECT
private:
......@@ -45,12 +53,12 @@ private:
public:
/* utils*/
Q_INVOKABLE bool checkExistance(const QString &tableName, const QString &searchId, const QString &search);
Q_INVOKABLE bool checkExistance(const QString &queryStr);
bool checkExistance(const QString &tableName, const QString &searchId, const QString &search);
bool checkExistance(const QString &queryStr);
protected:
TAGDB(QObject *parent = nullptr);
~ TAGDB();
TAGDB();
~TAGDB();
QSqlQuery getQuery(const QString &queryTxt);
void openDB(const QString &name);
......@@ -60,7 +68,6 @@ protected:
bool update(const QString &tableName, const TAG::DB &updateData, const QVariantMap &where);
bool update(const QString &table, const QString &column, const QVariant &newValue, const QVariant &op, const QString &id);
bool remove(const QString &tableName, const TAG::DB &removeData);
};
......
......@@ -28,10 +28,6 @@ Tagging::Tagging() : TAGDB()
this->setApp();
}
Tagging::~Tagging()
{
}
const QVariantList Tagging::get(const QString &queryTxt, std::function<bool(QVariantMap &item)> modifier)
{
QVariantList mapList;
......
......@@ -89,7 +89,6 @@ public:
private:
Tagging();
~Tagging();
void setApp();
QString application = QString();
......@@ -107,8 +106,6 @@ signals:
void urlTagged(const QString &url, const QString &tag);
void abstractTagged(const QString &key, const QString &lot, const QString &tag);
void tagged(const QString &tag);
public slots:
};
#endif // TAGGING_H
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