mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-13 12:22:05 +08:00
New Non-DTK store client prototype
This commit is contained in:
10
inc/deepinplatform.h
Normal file
10
inc/deepinplatform.h
Normal file
@@ -0,0 +1,10 @@
|
||||
//
|
||||
// Created by rigoligo on 2021/5/8.
|
||||
//
|
||||
|
||||
#ifndef _DEEPINPLATFORM_H_
|
||||
#define _DEEPINPLATFORM_H_
|
||||
|
||||
// Stub
|
||||
|
||||
#endif //_DEEPINPLATFORM_H_
|
||||
1
inc/dtk/DObject
Normal file
1
inc/dtk/DObject
Normal file
@@ -0,0 +1 @@
|
||||
#include "dobject.h"
|
||||
1
inc/dtk/DObjectPrivate
Normal file
1
inc/dtk/DObjectPrivate
Normal file
@@ -0,0 +1 @@
|
||||
#include "dobject_p.h"
|
||||
1
inc/dtk/DPalette
Normal file
1
inc/dtk/DPalette
Normal file
@@ -0,0 +1 @@
|
||||
#include "dpalette.h"
|
||||
135
inc/dtk/dguiapplicationhelper.h
Normal file
135
inc/dtk/dguiapplicationhelper.h
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: zccrs <zccrs@live.com>
|
||||
*
|
||||
* Maintainer: zccrs <zhangjide@deepin.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* 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 Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef DGUIAPPLICATIONHELPER_H
|
||||
#define DGUIAPPLICATIONHELPER_H
|
||||
|
||||
#include <dtkgui_global.h>
|
||||
#include <DPalette>
|
||||
#include <DObject>
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QObject>
|
||||
|
||||
DGUI_BEGIN_NAMESPACE
|
||||
|
||||
class DPlatformTheme;
|
||||
class DFontManager;
|
||||
class DGuiApplicationHelperPrivate;
|
||||
class DGuiApplicationHelper : public QObject, public DCORE_NAMESPACE::DObject
|
||||
{
|
||||
Q_OBJECT
|
||||
D_DECLARE_PRIVATE(DGuiApplicationHelper)
|
||||
|
||||
Q_PROPERTY(ColorType themeType READ themeType NOTIFY themeTypeChanged)
|
||||
Q_PROPERTY(ColorType paletteType READ paletteType WRITE setPaletteType NOTIFY paletteTypeChanged)
|
||||
|
||||
public:
|
||||
enum ColorType {
|
||||
UnknownType,
|
||||
LightType,
|
||||
DarkType
|
||||
};
|
||||
// Q_ENUM(ColorType)
|
||||
|
||||
enum SingleScope {
|
||||
UserScope,
|
||||
GroupScope,
|
||||
WorldScope
|
||||
};
|
||||
// Q_ENUM(SingleScope)
|
||||
|
||||
enum Attribute {
|
||||
UseInactiveColorGroup = 1 << 0,
|
||||
ColorCompositing = 1 << 1,
|
||||
|
||||
/* readonly flag */
|
||||
ReadOnlyLimit = 1 << 22,
|
||||
IsDeepinPlatformTheme = ReadOnlyLimit << 0,
|
||||
IsDXcbPlatform = ReadOnlyLimit << 1,
|
||||
IsXWindowPlatform = ReadOnlyLimit << 2,
|
||||
IsTableEnvironment = ReadOnlyLimit << 3,
|
||||
IsDeepinEnvironment = ReadOnlyLimit << 4,
|
||||
};
|
||||
// Q_ENUM(Attribute)
|
||||
Q_DECLARE_FLAGS(Attributes, Attribute)
|
||||
|
||||
typedef DGuiApplicationHelper *(*HelperCreator)();
|
||||
D_DECL_DEPRECATED static void registerInstanceCreator(HelperCreator creator);
|
||||
static DGuiApplicationHelper *instance();
|
||||
~DGuiApplicationHelper();
|
||||
|
||||
static QColor adjustColor(const QColor &base, qint8 hueFloat, qint8 saturationFloat, qint8 lightnessFloat,
|
||||
qint8 redFloat, qint8 greenFloat, qint8 blueFloat, qint8 alphaFloat);
|
||||
static QColor blendColor(const QColor &substrate, const QColor &superstratum);
|
||||
static DPalette standardPalette(ColorType type);
|
||||
static void generatePaletteColor(DPalette &base, QPalette::ColorRole role, ColorType type);
|
||||
static void generatePaletteColor(DPalette &base, DPalette::ColorType role, ColorType type);
|
||||
static void generatePalette(DPalette &base, ColorType type = UnknownType);
|
||||
static DPalette fetchPalette(const DPlatformTheme *theme);
|
||||
Q_DECL_DEPRECATED_X("Use UseInactiveColorGroup enum with setAttribute.") static void setUseInactiveColorGroup(bool on);
|
||||
Q_DECL_DEPRECATED_X("Use ColorCompositing enum with setAttribute.") static void setColorCompositingEnabled(bool on);
|
||||
static bool isXWindowPlatform();
|
||||
static bool isTabletEnvironment();
|
||||
static void setAttribute(Attribute attribute, bool enable);
|
||||
static bool testAttribute(Attribute attribute);
|
||||
|
||||
DPlatformTheme *systemTheme() const;
|
||||
DPlatformTheme *applicationTheme() const;
|
||||
D_DECL_DEPRECATED DPlatformTheme *windowTheme(QWindow *window) const;
|
||||
|
||||
DPalette applicationPalette() const;
|
||||
void setApplicationPalette(const DPalette &palette);
|
||||
D_DECL_DEPRECATED DPalette windowPalette(QWindow *window) const;
|
||||
|
||||
const DFontManager *fontManager() const;
|
||||
|
||||
static ColorType toColorType(const QColor &color);
|
||||
static ColorType toColorType(const QPalette &palette);
|
||||
ColorType themeType() const;
|
||||
ColorType paletteType() const;
|
||||
|
||||
static bool setSingleInstance(const QString &key, SingleScope singleScope = UserScope);
|
||||
static void setSingleInstanceInterval(int interval = 3000);
|
||||
D_DECL_DEPRECATED static void setSingelInstanceInterval(int interval = 3000);
|
||||
|
||||
public Q_SLOTS:
|
||||
D_DECL_DEPRECATED_X("Plase use setPaletteType") void setThemeType(ColorType themeType);
|
||||
void setPaletteType(ColorType paletteType);
|
||||
|
||||
Q_SIGNALS:
|
||||
void themeTypeChanged(ColorType themeType);
|
||||
void paletteTypeChanged(ColorType paletteType);
|
||||
void newProcessInstance(qint64 pid, const QStringList &arguments);
|
||||
void fontChanged(const QFont &font);
|
||||
void applicationPaletteChanged();
|
||||
|
||||
protected:
|
||||
explicit DGuiApplicationHelper();
|
||||
virtual void initialize();
|
||||
|
||||
private:
|
||||
D_PRIVATE_SLOT(void _q_initApplicationTheme(bool))
|
||||
friend class _DGuiApplicationHelper;
|
||||
};
|
||||
|
||||
DGUI_END_NAMESPACE
|
||||
|
||||
#endif // DGUIAPPLICATIONHELPER_H
|
||||
54
inc/dtk/dobject.h
Normal file
54
inc/dtk/dobject.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2015 ~ 2017 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* 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 Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DOBJECT_H
|
||||
#define DOBJECT_H
|
||||
|
||||
#include <QScopedPointer>
|
||||
|
||||
#include "dtkcore_global.h"
|
||||
|
||||
DCORE_BEGIN_NAMESPACE
|
||||
|
||||
#define D_DECLARE_PRIVATE(Class) Q_DECLARE_PRIVATE_D(qGetPtrHelper(d_d_ptr),Class)
|
||||
#define D_DECLARE_PUBLIC(Class) Q_DECLARE_PUBLIC(Class)
|
||||
#define D_D(Class) Q_D(Class)
|
||||
#define D_Q(Class) Q_Q(Class)
|
||||
#define D_DC(Class) Q_D(const Class)
|
||||
#define D_QC(Class) Q_Q(const Class)
|
||||
#define D_PRIVATE_SLOT(Func) Q_PRIVATE_SLOT(d_func(), Func)
|
||||
|
||||
class DObjectPrivate;
|
||||
|
||||
class LIBDTKCORESHARED_EXPORT DObject
|
||||
{
|
||||
protected:
|
||||
DObject(DObject *parent = nullptr);
|
||||
|
||||
DObject(DObjectPrivate &dd, DObject *parent = nullptr);
|
||||
|
||||
virtual ~DObject();
|
||||
|
||||
QScopedPointer<DObjectPrivate> d_d_ptr;
|
||||
|
||||
Q_DISABLE_COPY(DObject)
|
||||
D_DECLARE_PRIVATE(DObject)
|
||||
};
|
||||
|
||||
DCORE_END_NAMESPACE
|
||||
|
||||
#endif // DOBJECT_H
|
||||
42
inc/dtk/dobject_p.h
Normal file
42
inc/dtk/dobject_p.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2015 ~ 2017 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* 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 Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DOBJECT_P_H
|
||||
#define DOBJECT_P_H
|
||||
|
||||
#include "dtkcore_global.h"
|
||||
|
||||
DCORE_BEGIN_NAMESPACE
|
||||
|
||||
class DObject;
|
||||
class DObjectPrivate
|
||||
{
|
||||
public:
|
||||
virtual ~DObjectPrivate();
|
||||
|
||||
protected:
|
||||
DObjectPrivate(DObject *qq);
|
||||
|
||||
DObject *q_ptr;
|
||||
|
||||
Q_DECLARE_PUBLIC(DObject)
|
||||
};
|
||||
|
||||
DCORE_END_NAMESPACE
|
||||
|
||||
#endif // DOBJECT_P_H
|
||||
|
||||
110
inc/dtk/dpalette.h
Normal file
110
inc/dtk/dpalette.h
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: zccrs <zccrs@live.com>
|
||||
*
|
||||
* Maintainer: zccrs <zhangjide@deepin.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* 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 Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef DPALETTE_H
|
||||
#define DPALETTE_H
|
||||
|
||||
#include <dtkgui_global.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QPalette>
|
||||
|
||||
DGUI_BEGIN_NAMESPACE
|
||||
|
||||
class DPalettePrivate;
|
||||
class DPalette : public QPalette
|
||||
{
|
||||
public:
|
||||
enum ColorType {
|
||||
NoType,
|
||||
ItemBackground, //列表项的背景色
|
||||
TextTitle, //标题型文本的颜色
|
||||
TextTips, //提示性文本的颜色
|
||||
TextWarning, //警告类型的文本颜色
|
||||
TextLively, //活跃式文本颜色(不受活动色影响)
|
||||
LightLively, //活跃式按钮(recommend button)背景色中的亮色(不受活跃色影响)
|
||||
DarkLively, //活跃式按钮(recommend button)背景色中的暗色,会从亮色渐变到暗色(不受活跃色影响)
|
||||
FrameBorder, //控件边框颜色
|
||||
PlaceholderText, //占位类型的文本颜色,可用于输入框占位内容等提示性文字
|
||||
FrameShadowBorder, //用于跟阴影叠加的边框颜色
|
||||
ObviousBackground, //明显的背景色
|
||||
NColorTypes
|
||||
};
|
||||
|
||||
DPalette();
|
||||
DPalette(const QPalette &palette);
|
||||
DPalette(const DPalette &palette);
|
||||
~DPalette();
|
||||
|
||||
DPalette &operator=(const DPalette &palette);
|
||||
|
||||
inline const QColor &color(ColorGroup cg, ColorType ct) const
|
||||
{ return brush(cg, ct).color(); }
|
||||
const QBrush &brush(ColorGroup cg, ColorType ct) const;
|
||||
inline void setColor(ColorGroup cg, ColorType ct, const QColor &color)
|
||||
{ setBrush(cg, ct, color); }
|
||||
inline void setColor(ColorType ct, const QColor &color)
|
||||
{ setColor(All, ct, color); }
|
||||
inline void setBrush(ColorType ct, const QBrush &brush)
|
||||
{ setBrush(All, ct, brush); }
|
||||
void setBrush(ColorGroup cg, ColorType ct, const QBrush &brush);
|
||||
|
||||
inline const QColor &color(ColorType ct) const { return color(Current, ct); }
|
||||
inline const QBrush &brush(ColorType ct) const { return brush(Current, ct); }
|
||||
inline const QBrush &itemBackground() const { return brush(ItemBackground); }
|
||||
inline const QBrush &textTiele() const { return brush(TextTitle); }
|
||||
inline const QBrush &textTips() const { return brush(TextTips); }
|
||||
inline const QBrush &textWarning() const { return brush(TextWarning); }
|
||||
inline const QBrush &textLively() const { return brush(TextLively); }
|
||||
inline const QBrush &lightLively() const { return brush(LightLively); }
|
||||
inline const QBrush &darkLively() const { return brush(DarkLively); }
|
||||
inline const QBrush &frameBorder() const { return brush(FrameBorder); }
|
||||
inline const QBrush &placeholderText() const { return brush(PlaceholderText); }
|
||||
inline const QBrush &frameShadowBorder() const { return brush(FrameShadowBorder); }
|
||||
|
||||
using QPalette::color;
|
||||
using QPalette::brush;
|
||||
using QPalette::setBrush;
|
||||
using QPalette::setColor;
|
||||
|
||||
protected:
|
||||
QScopedPointer<DPalettePrivate> d;
|
||||
|
||||
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &s, const DPalette &p);
|
||||
};
|
||||
|
||||
DGUI_END_NAMESPACE
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
/*****************************************************************************
|
||||
DPalette stream functions
|
||||
*****************************************************************************/
|
||||
#ifndef QT_NO_DATASTREAM
|
||||
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &ds, const DTK_GUI_NAMESPACE::DPalette &p);
|
||||
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &ds, DTK_GUI_NAMESPACE::DPalette &p);
|
||||
#endif // QT_NO_DATASTREAM
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
Q_GUI_EXPORT QDebug operator<<(QDebug, const DTK_GUI_NAMESPACE::DPalette &);
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // DPALETTE_H
|
||||
29
inc/dtk/dtkcore_config.h
Normal file
29
inc/dtk/dtkcore_config.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#define DTK_VERSION_MAJOR 5
|
||||
#define DTK_VERSION_MINOR 5
|
||||
#define DTK_VERSION_PATCH 2
|
||||
#define DTK_VERSION_BUILD 0
|
||||
#define DTK_VERSION_STR "5.5.2"
|
||||
//
|
||||
#define DTKCORE_CLASS_DObject
|
||||
#define DTKCORE_CLASS_DObjectPrivate
|
||||
#define DTKCORE_CLASS_DSingleton
|
||||
#define DTKCORE_CLASS_DUtil
|
||||
#define DTKCORE_CLASS_DPinyin
|
||||
#define DTKCORE_CLASS_DDBusSender
|
||||
#define DTKCORE_CLASS_DRecentManager
|
||||
#define DTKCORE_CLASS_DNotifySender
|
||||
#define DTKCORE_CLASS_DExportedInterface
|
||||
#define DTKCORE_CLASS_DVtableHook
|
||||
#define DTKCORE_CLASS_DFileServices
|
||||
#define DTKCORE_CLASS_DThreadUtils
|
||||
#define DTKCORE_CLASS_DLog
|
||||
#define DTKCORE_CLASS_DFileWatcher
|
||||
#define DTKCORE_CLASS_DBaseFileWatcher
|
||||
#define DTKCORE_CLASS_DFileSystemWatcher
|
||||
#define DTKCORE_CLASS_DFileWatcherManager
|
||||
#define DTKCORE_CLASS_DPathBuf
|
||||
#define DTKCORE_CLASS_DStandardPaths
|
||||
#define DTKCORE_CLASS_DTrashManager
|
||||
#define DTKCORE_CLASS_DSettings
|
||||
#define DTKCORE_CLASS_DSettingsGroup
|
||||
#define DTKCORE_CLASS_DSettingsOption
|
||||
69
inc/dtk/dtkcore_global.h
Normal file
69
inc/dtk/dtkcore_global.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* 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 Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#include <dtkcore_config.h>
|
||||
|
||||
#define DTK_NAMESPACE Dtk
|
||||
|
||||
#if !defined(DTK_NAMESPACE)
|
||||
# define DTK_BEGIN_NAMESPACE
|
||||
# define DTK_END_NAMESPACE
|
||||
# define DTK_USE_NAMESPACE
|
||||
#else
|
||||
# define DTK_BEGIN_NAMESPACE namespace DTK_NAMESPACE {
|
||||
# define DTK_END_NAMESPACE }
|
||||
# define DTK_USE_NAMESPACE using namespace DTK_NAMESPACE;
|
||||
#endif
|
||||
|
||||
#define DCORE_NAMESPACE Core
|
||||
#define DTK_CORE_NAMESPACE DTK_NAMESPACE::DCORE_NAMESPACE
|
||||
|
||||
#if !defined(DCORE_NAMESPACE)
|
||||
# define DCORE_BEGIN_NAMESPACE
|
||||
# define DCORE_END_NAMESPACE
|
||||
# define DCORE_USE_NAMESPACE
|
||||
#else
|
||||
# define DCORE_BEGIN_NAMESPACE namespace DTK_NAMESPACE { namespace DCORE_NAMESPACE {
|
||||
# define DCORE_END_NAMESPACE }}
|
||||
# define DCORE_USE_NAMESPACE using namespace DTK_CORE_NAMESPACE;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(DTK_STATIC_LIB)
|
||||
# define LIBDTKCORESHARED_EXPORT
|
||||
#else
|
||||
#if defined(LIBDTKCORE_LIBRARY)
|
||||
# define LIBDTKCORESHARED_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define LIBDTKCORESHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef D_DEPRECATED_CHECK
|
||||
#define D_DECL_DEPRECATED_X(text) Q_DECL_HIDDEN
|
||||
#define D_DECL_DEPRECATED Q_DECL_HIDDEN
|
||||
#else
|
||||
#define D_DECL_DEPRECATED Q_DECL_DEPRECATED
|
||||
#define D_DECL_DEPRECATED_X Q_DECL_DEPRECATED_X
|
||||
#endif
|
||||
|
||||
#define DTK_VERSION_CHECK(major, minor, patch, build) ((major<<24)|(minor<<16)|(patch<<8)|build)
|
||||
#define DTK_VERSION DTK_VERSION_CHECK(DTK_VERSION_MAJOR, DTK_VERSION_MINOR, DTK_VERSION_PATCH, DTK_VERSION_BUILD)
|
||||
35
inc/dtk/dtkgui_global.h
Normal file
35
inc/dtk/dtkgui_global.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2017 ~ 2019 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: zccrs <zccrs@live.com>
|
||||
*
|
||||
* Maintainer: zccrs <zhangjide@deepin.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* 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 Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef DTKGUI_GLOBAL_H
|
||||
#define DTKGUI_GLOBAL_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <dtkcore_global.h>
|
||||
|
||||
#define DGUI_NAMESPACE Gui
|
||||
#define DTK_GUI_NAMESPACE DTK_NAMESPACE::Gui
|
||||
|
||||
#define DGUI_BEGIN_NAMESPACE namespace DTK_NAMESPACE { namespace DGUI_NAMESPACE {
|
||||
#define DGUI_END_NAMESPACE }}
|
||||
#define DGUI_USE_NAMESPACE using namespace DTK_GUI_NAMESPACE;
|
||||
|
||||
#endif // DTKGUI_GLOBAL_H
|
||||
54
inc/qtxcb.h
Normal file
54
inc/qtxcb.h
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file contains code of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QTXCB_H
|
||||
#define QTXCB_H
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
namespace SpkUi
|
||||
{
|
||||
namespace Priv
|
||||
{
|
||||
uint qtEdgesToXcbMoveResizeDirection(Qt::Edges edges);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // QTXCB_H
|
||||
269
inc/qxcbatom.h
Normal file
269
inc/qxcbatom.h
Normal file
@@ -0,0 +1,269 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QXCBATOM_H
|
||||
#define QXCBATOM_H
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
namespace SpkUi
|
||||
{
|
||||
namespace Priv
|
||||
{
|
||||
class QXcbAtom
|
||||
{
|
||||
public:
|
||||
enum Atom {
|
||||
// window-manager <-> client protocols
|
||||
WM_PROTOCOLS,
|
||||
WM_DELETE_WINDOW,
|
||||
WM_TAKE_FOCUS,
|
||||
_NET_WM_PING,
|
||||
_NET_WM_CONTEXT_HELP,
|
||||
_NET_WM_SYNC_REQUEST,
|
||||
_NET_WM_SYNC_REQUEST_COUNTER,
|
||||
MANAGER, // System tray notification
|
||||
_NET_SYSTEM_TRAY_OPCODE, // System tray operation
|
||||
|
||||
// ICCCM window state
|
||||
WM_STATE,
|
||||
WM_CHANGE_STATE,
|
||||
WM_CLASS,
|
||||
WM_NAME,
|
||||
|
||||
// Session management
|
||||
WM_CLIENT_LEADER,
|
||||
WM_WINDOW_ROLE,
|
||||
SM_CLIENT_ID,
|
||||
WM_CLIENT_MACHINE,
|
||||
|
||||
// Clipboard
|
||||
CLIPBOARD,
|
||||
INCR,
|
||||
TARGETS,
|
||||
MULTIPLE,
|
||||
TIMESTAMP,
|
||||
SAVE_TARGETS,
|
||||
CLIP_TEMPORARY,
|
||||
_QT_SELECTION,
|
||||
_QT_CLIPBOARD_SENTINEL,
|
||||
_QT_SELECTION_SENTINEL,
|
||||
CLIPBOARD_MANAGER,
|
||||
|
||||
RESOURCE_MANAGER,
|
||||
|
||||
_XSETROOT_ID,
|
||||
|
||||
_QT_SCROLL_DONE,
|
||||
_QT_INPUT_ENCODING,
|
||||
|
||||
// Qt/XCB specific
|
||||
_QT_CLOSE_CONNECTION,
|
||||
|
||||
_MOTIF_WM_HINTS,
|
||||
|
||||
DTWM_IS_RUNNING,
|
||||
ENLIGHTENMENT_DESKTOP,
|
||||
_DT_SAVE_MODE,
|
||||
_SGI_DESKS_MANAGER,
|
||||
|
||||
// EWMH (aka NETWM)
|
||||
_NET_SUPPORTED,
|
||||
_NET_VIRTUAL_ROOTS,
|
||||
_NET_WORKAREA,
|
||||
|
||||
_NET_MOVERESIZE_WINDOW,
|
||||
_NET_WM_MOVERESIZE,
|
||||
|
||||
_NET_WM_NAME,
|
||||
_NET_WM_ICON_NAME,
|
||||
_NET_WM_ICON,
|
||||
|
||||
_NET_WM_PID,
|
||||
|
||||
_NET_WM_WINDOW_OPACITY,
|
||||
|
||||
_NET_WM_STATE,
|
||||
_NET_WM_STATE_ABOVE,
|
||||
_NET_WM_STATE_BELOW,
|
||||
_NET_WM_STATE_FULLSCREEN,
|
||||
_NET_WM_STATE_MAXIMIZED_HORZ,
|
||||
_NET_WM_STATE_MAXIMIZED_VERT,
|
||||
_NET_WM_STATE_MODAL,
|
||||
_NET_WM_STATE_STAYS_ON_TOP,
|
||||
_NET_WM_STATE_DEMANDS_ATTENTION,
|
||||
_NET_WM_STATE_HIDDEN,
|
||||
|
||||
_NET_WM_USER_TIME,
|
||||
_NET_WM_USER_TIME_WINDOW,
|
||||
_NET_WM_FULL_PLACEMENT,
|
||||
|
||||
_NET_WM_WINDOW_TYPE,
|
||||
_NET_WM_WINDOW_TYPE_DESKTOP,
|
||||
_NET_WM_WINDOW_TYPE_DOCK,
|
||||
_NET_WM_WINDOW_TYPE_TOOLBAR,
|
||||
_NET_WM_WINDOW_TYPE_MENU,
|
||||
_NET_WM_WINDOW_TYPE_UTILITY,
|
||||
_NET_WM_WINDOW_TYPE_SPLASH,
|
||||
_NET_WM_WINDOW_TYPE_DIALOG,
|
||||
_NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
|
||||
_NET_WM_WINDOW_TYPE_POPUP_MENU,
|
||||
_NET_WM_WINDOW_TYPE_TOOLTIP,
|
||||
_NET_WM_WINDOW_TYPE_NOTIFICATION,
|
||||
_NET_WM_WINDOW_TYPE_COMBO,
|
||||
_NET_WM_WINDOW_TYPE_DND,
|
||||
_NET_WM_WINDOW_TYPE_NORMAL,
|
||||
_KDE_NET_WM_WINDOW_TYPE_OVERRIDE,
|
||||
|
||||
_KDE_NET_WM_FRAME_STRUT,
|
||||
_NET_FRAME_EXTENTS,
|
||||
|
||||
_NET_STARTUP_INFO,
|
||||
_NET_STARTUP_INFO_BEGIN,
|
||||
|
||||
_NET_SUPPORTING_WM_CHECK,
|
||||
|
||||
_NET_WM_CM_S0,
|
||||
|
||||
_NET_SYSTEM_TRAY_VISUAL,
|
||||
|
||||
_NET_ACTIVE_WINDOW,
|
||||
|
||||
// Property formats
|
||||
TEXT,
|
||||
UTF8_STRING,
|
||||
CARDINAL,
|
||||
|
||||
// Xdnd
|
||||
XdndEnter,
|
||||
XdndPosition,
|
||||
XdndStatus,
|
||||
XdndLeave,
|
||||
XdndDrop,
|
||||
XdndFinished,
|
||||
XdndTypelist,
|
||||
XdndActionList,
|
||||
|
||||
XdndSelection,
|
||||
|
||||
XdndAware,
|
||||
XdndProxy,
|
||||
|
||||
XdndActionCopy,
|
||||
XdndActionLink,
|
||||
XdndActionMove,
|
||||
XdndActionAsk,
|
||||
XdndActionPrivate,
|
||||
|
||||
// Xkb
|
||||
_XKB_RULES_NAMES,
|
||||
|
||||
// XEMBED
|
||||
_XEMBED,
|
||||
_XEMBED_INFO,
|
||||
|
||||
// XInput2
|
||||
ButtonLeft,
|
||||
ButtonMiddle,
|
||||
ButtonRight,
|
||||
ButtonWheelUp,
|
||||
ButtonWheelDown,
|
||||
ButtonHorizWheelLeft,
|
||||
ButtonHorizWheelRight,
|
||||
AbsMTPositionX,
|
||||
AbsMTPositionY,
|
||||
AbsMTTouchMajor,
|
||||
AbsMTTouchMinor,
|
||||
AbsMTOrientation,
|
||||
AbsMTPressure,
|
||||
AbsMTTrackingID,
|
||||
MaxContacts,
|
||||
RelX,
|
||||
RelY,
|
||||
// XInput2 tablet
|
||||
AbsX,
|
||||
AbsY,
|
||||
AbsPressure,
|
||||
AbsTiltX,
|
||||
AbsTiltY,
|
||||
AbsWheel,
|
||||
AbsDistance,
|
||||
WacomSerialIDs,
|
||||
INTEGER,
|
||||
RelHorizWheel,
|
||||
RelVertWheel,
|
||||
RelHorizScroll,
|
||||
RelVertScroll,
|
||||
|
||||
_XSETTINGS_SETTINGS,
|
||||
|
||||
_COMPIZ_DECOR_PENDING,
|
||||
_COMPIZ_DECOR_REQUEST,
|
||||
_COMPIZ_DECOR_DELETE_PIXMAP,
|
||||
_COMPIZ_TOOLKIT_ACTION,
|
||||
_GTK_LOAD_ICONTHEMES,
|
||||
|
||||
AT_SPI_BUS,
|
||||
|
||||
EDID,
|
||||
EDID_DATA,
|
||||
XFree86_DDC_EDID1_RAWDATA,
|
||||
|
||||
_ICC_PROFILE,
|
||||
|
||||
NAtoms
|
||||
};
|
||||
|
||||
QXcbAtom();
|
||||
void initialize(xcb_connection_t *connection);
|
||||
|
||||
inline xcb_atom_t atom(QXcbAtom::Atom atom) const { return m_allAtoms[atom]; }
|
||||
QXcbAtom::Atom qatom(xcb_atom_t atom) const;
|
||||
|
||||
protected:
|
||||
void initializeAllAtoms(xcb_connection_t *connection);
|
||||
|
||||
private:
|
||||
xcb_atom_t m_allAtoms[QXcbAtom::NAtoms];
|
||||
};
|
||||
|
||||
extern QXcbAtom a;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // QXCBATOM_H
|
||||
6
inc/spkconfig.h
Normal file
6
inc/spkconfig.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef SPKCONFIG_H
|
||||
#define SPKCONFIG_H
|
||||
|
||||
|
||||
|
||||
#endif // SPKCONFIG_H
|
||||
37
inc/spkdialog.h
Normal file
37
inc/spkdialog.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef SPKDIALOG_H
|
||||
#define SPKDIALOG_H
|
||||
|
||||
#include <QList>
|
||||
#include <QButtonGroup>
|
||||
#include "spkui_general.h"
|
||||
#include "spktitlebar.h"
|
||||
#include "spkwindow.h"
|
||||
|
||||
class SpkDialog : public SpkWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SpkDialog(QWidget *parent = nullptr);
|
||||
~SpkDialog();
|
||||
void AddButton(QString text, SpkUi::SpkButtonStyle style = SpkUi::SpkButtonStyle::Normal);
|
||||
void AddWidget(QWidget*);
|
||||
void AddSpacing(int);
|
||||
int Exec();
|
||||
|
||||
private slots:
|
||||
void ButtonPressed(int);
|
||||
void ForceClose();
|
||||
|
||||
signals:
|
||||
void ExitEventLoop(int);
|
||||
void CloseWindow();
|
||||
|
||||
private:
|
||||
QWidget *mDialogWidget;
|
||||
QVBoxLayout *mMainVLay, *mWidgetsVLay;
|
||||
QHBoxLayout *mBtnLay;
|
||||
QButtonGroup *mBtnGroup;
|
||||
QList<QWidget*> mWidgetsList, mParentsList;
|
||||
};
|
||||
|
||||
#endif // SPKDIALOG_H
|
||||
25
inc/spkjsonapiconsumer.h
Normal file
25
inc/spkjsonapiconsumer.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef SPKJSONAPICONSUMER_H
|
||||
#define SPKJSONAPICONSUMER_H
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include <QtNetwork/QNetworkAccessManager>
|
||||
|
||||
class SpkJsonApiConsumer: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SpkJsonApiConsumer();
|
||||
|
||||
private:
|
||||
QNetworkAccessManager mNet;
|
||||
|
||||
public slots:
|
||||
void RequestUrl(QUrl);
|
||||
|
||||
signals:
|
||||
void RequestFinish(QJsonDocument, int);
|
||||
};
|
||||
|
||||
#endif // SPKJSONAPICONSUMER_H
|
||||
47
inc/spklogging.h
Normal file
47
inc/spklogging.h
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
/**
|
||||
* @brief Simple logging for Spark Store
|
||||
*/
|
||||
|
||||
#ifndef _SPKLOGGING_H_
|
||||
#define _SPKLOGGING_H_
|
||||
|
||||
#pragma push_macro("signals")
|
||||
#undef signals
|
||||
#include <libnotify/notify.h>
|
||||
#define signals DUMMY
|
||||
#pragma pop_macro("signals")
|
||||
#include <QString>
|
||||
#include <QStringListModel>
|
||||
#include <QTextStream>
|
||||
#include <QFile>
|
||||
|
||||
class SpkLogger
|
||||
{
|
||||
QStringListModel mLogData;
|
||||
QString mLogPath;
|
||||
QFile mLogFile;
|
||||
QTextStream mLogWriter;
|
||||
static SpkLogger *Instance;
|
||||
void Initialize(QString suggestPath = "");
|
||||
bool NotifyViable = false;
|
||||
|
||||
public:
|
||||
SpkLogger(QString suggestPath = "");
|
||||
~SpkLogger();
|
||||
static SpkLogger *GetInstance() { return Instance; };
|
||||
void Log(QString message);
|
||||
void Warning(QString message);
|
||||
void Error(QString message, bool pop = false);
|
||||
void Critical(QString message);
|
||||
void Notify(QString);
|
||||
};
|
||||
|
||||
#define sLog(X) SpkLogger::GetInstance()->Log(X)
|
||||
#define sWarn(X) SpkLogger::GetInstance()->Warning(X)
|
||||
#define sErr(X) SpkLogger::GetInstance()->Error(X)
|
||||
#define sErrPop(X) SpkLogger::GetInstance()->Error(X,true)
|
||||
#define sCritical(X) SpkLogger::GetInstance()->Critical(X)
|
||||
#define sNotify(X)
|
||||
|
||||
#endif //_SPKLOGGING_H_
|
||||
78
inc/spkmainwindow.h
Normal file
78
inc/spkmainwindow.h
Normal file
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// Created by rigoligo on 2021/5/9.
|
||||
//
|
||||
|
||||
#ifndef _SPKMAINWINDOW_H_
|
||||
#define _SPKMAINWINDOW_H_
|
||||
|
||||
#include "spkwindow.h"
|
||||
#include <QTextEdit>
|
||||
#include <QStackedWidget>
|
||||
#include <QButtonGroup>
|
||||
#include <QJsonObject>
|
||||
#include "spkpageqsstest.h"
|
||||
|
||||
namespace SpkUi
|
||||
{
|
||||
class SpkCategoryButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SpkCategoryButton(QWidget *parent = nullptr);
|
||||
void SetIcon(QPixmap);
|
||||
void SetText(QString);
|
||||
static constexpr int Spacing = 8;
|
||||
private:
|
||||
QHBoxLayout *mLayout;
|
||||
QLabel *mIcon, *mText;
|
||||
};
|
||||
class SpkCategorySelector : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SpkCategorySelector(QWidget *parent = nullptr);
|
||||
|
||||
void AddButton(QString aBtnText, int aCategoryId = 0, QPixmap *aBtnIcon = nullptr);
|
||||
void DeleteAllButtons();
|
||||
|
||||
signals:
|
||||
void CategorySelected(int);
|
||||
|
||||
private:
|
||||
QVBoxLayout *mBtnLayout;
|
||||
QButtonGroup *mGroup;
|
||||
QList<SpkCategoryButton*> mBtnList;
|
||||
};
|
||||
|
||||
class SpkMainWidget : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SpkMainWidget(QWidget *parent = nullptr);
|
||||
|
||||
QHBoxLayout *HorizontalDivide;
|
||||
SpkCategorySelector *CategoryWidget;
|
||||
QVBoxLayout *VLayCategoryButtons,
|
||||
*VLayMain;
|
||||
SpkTitleBar *TitleBar;
|
||||
|
||||
QStackedWidget *Pager;
|
||||
|
||||
//Pages
|
||||
SpkPageQssTest *PageQssTest;
|
||||
};
|
||||
}
|
||||
|
||||
class SpkMainWindow : public SpkWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
SpkUi::SpkMainWidget *ui;
|
||||
|
||||
public:
|
||||
SpkMainWindow(QWidget *parent = nullptr);
|
||||
|
||||
void PopulateCategories(QJsonObject);
|
||||
};
|
||||
|
||||
#endif //_SPKMAINWINDOW_H_
|
||||
22
inc/spkmsgbox.h
Normal file
22
inc/spkmsgbox.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef SPKMSGBOX_H
|
||||
#define SPKMSGBOX_H
|
||||
|
||||
#include <QStyle>
|
||||
#include <QMessageBox>
|
||||
#include "spkdialog.h"
|
||||
|
||||
class SpkMsgBox : public SpkDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SpkMsgBox();
|
||||
static int StaticExec(QString msg, QString title, QMessageBox::Icon = QMessageBox::NoIcon,
|
||||
QMessageBox::StandardButtons = QMessageBox::Ok, QString extra = "");
|
||||
private:
|
||||
static void AddButtons(SpkMsgBox *me, QMessageBox::StandardButtons b);
|
||||
QList<QMessageBox::StandardButton> mButtonList;
|
||||
static constexpr QSize IconSize {48, 48};
|
||||
static constexpr int Margin = 10;
|
||||
};
|
||||
|
||||
#endif // SPKMSGBOX_H
|
||||
44
inc/spkpageqsstest.h
Normal file
44
inc/spkpageqsstest.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef SPKPAGEQSSTEST_H
|
||||
#define SPKPAGEQSSTEST_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QSplitter>
|
||||
#include <QPushButton>
|
||||
#include <QRadioButton>
|
||||
#include <QCheckBox>
|
||||
#include <QGroupBox>
|
||||
#include <QTextEdit>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QSlider>
|
||||
namespace SpkUi
|
||||
{
|
||||
class SpkPageQssTest : public QSplitter
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SpkPageQssTest(QWidget *parent = nullptr);
|
||||
QWidget *WidL, *WidR;
|
||||
QVBoxLayout *VLayWidgets,
|
||||
*VLayBtn,
|
||||
*VLayInput;
|
||||
QHBoxLayout *HLay4Slider,
|
||||
*HLayInputBtns;
|
||||
QTextEdit *TextStylesheet;
|
||||
QPushButton *BtnApply;
|
||||
QPushButton *BtnFetch;
|
||||
|
||||
QPushButton *Btn;
|
||||
QCheckBox *Chk;
|
||||
QRadioButton *Rad;
|
||||
QGroupBox *Group;
|
||||
QSlider *SlideH;
|
||||
QSlider *SlideV;
|
||||
|
||||
public slots:
|
||||
void SetStylesheet();
|
||||
void FetchStylesheet();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SPKPAGEQSSTEST_H
|
||||
34
inc/spkstore.h
Normal file
34
inc/spkstore.h
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// Created by rigoligo on 2021/5/12.
|
||||
//
|
||||
|
||||
#ifndef _SPKSTORE_H_
|
||||
#define _SPKSTORE_H_
|
||||
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include "spklogging.h"
|
||||
#include "spkmainwindow.h"
|
||||
|
||||
/**
|
||||
* @brief SpkStore class is the core of the store client side program, it is constructed first and
|
||||
* handling all processing after the launch. All client side data should be held by it,
|
||||
* including preferences class, category names, request URLs, downloads status, packaging
|
||||
* backend interfaces and so on.
|
||||
*/
|
||||
class SpkStore : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SpkStore *Instance;
|
||||
SpkStore(bool aCli, QString &aLogPath);
|
||||
~SpkStore();
|
||||
|
||||
|
||||
private:
|
||||
SpkLogger *mLogger;
|
||||
SpkMainWindow *mMainWindow;
|
||||
|
||||
};
|
||||
|
||||
#endif //_SPKSTORE_H_
|
||||
74
inc/spktitlebar.h
Normal file
74
inc/spktitlebar.h
Normal file
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// Created by rigoligo on 2021/5/8.
|
||||
//
|
||||
|
||||
#ifndef _SPKTITLEBAR_H_
|
||||
#define _SPKTITLEBAR_H_
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QBrush>
|
||||
#include <QPushButton>
|
||||
#include <QMainWindow>
|
||||
|
||||
namespace SpkUi
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class SpkWindow;
|
||||
|
||||
class SpkTitleBarDefaultButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SpkTitleBarDefaultButton();
|
||||
enum OperationButton { Minimize = 1, MaximizeRestore = 2, Close = 4, Restore = 3 };
|
||||
void SetRole(OperationButton);
|
||||
constexpr static int ButtonWidth = 60;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
private:
|
||||
OperationButton Role;
|
||||
void PaintSymbol(QPainter &);
|
||||
};
|
||||
|
||||
class SpkTitleBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class SpkWindow;
|
||||
public:
|
||||
SpkTitleBar(QWidget *parent = nullptr);
|
||||
~SpkTitleBar();
|
||||
using OperationButton = SpkTitleBarDefaultButton::OperationButton;
|
||||
void SetOperationButton(OperationButton);
|
||||
|
||||
void SetIcon(QPixmap &p) { mIcon.setPixmap(p); };
|
||||
void SetTitle(QString t) { mTitle.setText(t); };
|
||||
QString GetTitle() { return mTitle.text(); };
|
||||
void SetUseIcon(bool t) { mIcon.setVisible(t); };
|
||||
void SetLinkedWindow(QMainWindow *w) { mLinkedWindow = w; };
|
||||
|
||||
QHBoxLayout &GetLeftUserSpace() { return mUserSpaceL; };
|
||||
QHBoxLayout &GetRightUserSpace() { return mUserSpaceR; };
|
||||
protected:
|
||||
bool event(QEvent*) override;
|
||||
|
||||
private:
|
||||
QLabel mIcon;
|
||||
QLabel mTitle;
|
||||
QMainWindow *mLinkedWindow;
|
||||
QHBoxLayout mMainLayout, mUserSpaceL, mUserSpaceR;
|
||||
SpkTitleBarDefaultButton mBtnMin, mBtnMaxRestore, mBtnClose;
|
||||
|
||||
private slots:
|
||||
void CloseWindow();
|
||||
void MinimizeWindow();
|
||||
void MaximizeRestoreWindow();
|
||||
};
|
||||
|
||||
#endif //_SPKTITLEBAR_H_
|
||||
38
inc/spkui_general.h
Normal file
38
inc/spkui_general.h
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// Created by rigoligo on 2021/5/8.
|
||||
//
|
||||
|
||||
#ifndef _SPKUI_GENERAL_H_
|
||||
#define _SPKUI_GENERAL_H_
|
||||
|
||||
#include <QString>
|
||||
#include <QSize>
|
||||
#include <QColor>
|
||||
|
||||
namespace SpkUi
|
||||
{
|
||||
constexpr int StackTraceArraySize = 64;
|
||||
constexpr const char * const StoreIconName = "spark-store";
|
||||
|
||||
extern QString StylesheetLight, StylesheetDark, *CurrentStylesheet;
|
||||
extern QColor ColorLine, ColorBack;
|
||||
extern QSize PrimaryScreenSize;
|
||||
enum SpkUiStyle { Light, Dark };
|
||||
enum SpkButtonStyle { Normal = 0, Recommend, Warn };
|
||||
|
||||
namespace Priv
|
||||
{
|
||||
extern bool CrashHandlerActivated;
|
||||
}
|
||||
|
||||
void Initialize();
|
||||
void GuessAppropriateTheme();
|
||||
void PrepareForDeepinDesktop();
|
||||
bool CheckIsDeepinDesktop();
|
||||
|
||||
void CrashSignalHandler(int);
|
||||
|
||||
void SetGlobalStyle(SpkUiStyle);
|
||||
};
|
||||
|
||||
#endif //_SPKUI_GENERAL_H_
|
||||
35
inc/spkuimsg.h
Normal file
35
inc/spkuimsg.h
Normal file
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Created by rigoligo on 2021/5/9.
|
||||
//
|
||||
|
||||
#ifndef _SPKUIMSG_H_
|
||||
#define _SPKUIMSG_H_
|
||||
|
||||
#pragma push_macro("signals")
|
||||
#undef signals
|
||||
#include <libnotify/notify.h>
|
||||
#define signals DUMMY
|
||||
#pragma pop_macro("signals")
|
||||
|
||||
#include <QString>
|
||||
#include <QObject>
|
||||
#include "spkui_general.h"
|
||||
|
||||
class SpkUiMessage : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static void SendDesktopNotification(QString aMsg,
|
||||
const char * const aIcon = SpkUi::StoreIconName);
|
||||
static void SendStoreNotification(QString);
|
||||
static void SetDesktopNotifyTimeout(int ms);
|
||||
|
||||
private:
|
||||
static NotifyNotification *_notify;
|
||||
static int mTimeoutDesktop;
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif //_SPKUIMSG_H_
|
||||
67
inc/spkwindow.h
Normal file
67
inc/spkwindow.h
Normal file
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// Created by rigoligo on 2021/5/8.
|
||||
//
|
||||
|
||||
#ifndef _SPKWINDOW_H_
|
||||
#define _SPKWINDOW_H_
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QFrame>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QCloseEvent>
|
||||
#include "spktitlebar.h"
|
||||
|
||||
class SpkWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum SpkWindowStyle { Dark, Light };
|
||||
|
||||
private:
|
||||
QWidget *mCentralWidget, *mUserCentralWidget;
|
||||
QVBoxLayout *mMainVLayout;
|
||||
SpkTitleBar *mTitleBarComponent;
|
||||
int mCornerRadius;
|
||||
bool mMoving, mResizing, mMaximized, mResizable;
|
||||
Qt::Edges mEdgesBeingResized;
|
||||
bool (*mCloseHook)(void);
|
||||
|
||||
static constexpr int BorderWidth = 10;
|
||||
|
||||
public:
|
||||
SpkWindow(QWidget *parent = nullptr);
|
||||
~SpkWindow() override;
|
||||
void SetCentralWidget(QWidget *);
|
||||
bool GetUseTitleBar();
|
||||
bool GetResizable() { return mResizable; };
|
||||
void SetCloseHook(bool(*f)(void));
|
||||
|
||||
public slots:
|
||||
void SetCornerRadius(int);
|
||||
void SetWindowTheme(SpkWindowStyle);
|
||||
void SetUseTitleBar(bool);
|
||||
void SetResizable(bool a) { mResizable = a; };
|
||||
void SetCentralMargin(int, int, int, int);
|
||||
void ClearCloseHook();
|
||||
void RecalculateSize();
|
||||
SpkTitleBar *GetTitleBar();
|
||||
SpkTitleBar *SetTitleBar(SpkTitleBar*, bool replace = false);
|
||||
|
||||
signals:
|
||||
void Closed();
|
||||
|
||||
protected:
|
||||
bool event(QEvent *) override;
|
||||
Qt::Edges DetectEdgeOnThis(QPoint);
|
||||
void SetMouseCursor(Qt::Edges);
|
||||
void ResizeWindowByCursor(QPoint);
|
||||
void closeEvent(QCloseEvent *) override;
|
||||
|
||||
private:
|
||||
void PopulateUi();
|
||||
};
|
||||
|
||||
#endif //_SPKWINDOW_H_
|
||||
240
inc/xcb/xcbint.h
Normal file
240
inc/xcb/xcbint.h
Normal file
@@ -0,0 +1,240 @@
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Bart Massey and Jamey Sharp.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the names of the authors or their
|
||||
* institutions shall not be used in advertising or otherwise to promote the
|
||||
* sale, use or other dealings in this Software without prior written
|
||||
* authorization from the authors.
|
||||
*/
|
||||
|
||||
#ifndef __XCBINT_H
|
||||
#define __XCBINT_H
|
||||
|
||||
#include "bigreq.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_HAS_VISIBILITY
|
||||
#pragma GCC visibility push(hidden)
|
||||
#endif
|
||||
|
||||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) 0 /* Compatibility with older compilers. */
|
||||
#endif
|
||||
|
||||
#if __has_attribute(fallthrough)
|
||||
# define XCB_ALLOW_FALLTHRU __attribute__ ((fallthrough));
|
||||
#else
|
||||
# define XCB_ALLOW_FALLTHRU /* FALLTHRU */
|
||||
#endif
|
||||
|
||||
enum workarounds {
|
||||
WORKAROUND_NONE,
|
||||
WORKAROUND_GLX_GET_FB_CONFIGS_BUG,
|
||||
WORKAROUND_EXTERNAL_SOCKET_OWNER
|
||||
};
|
||||
|
||||
enum lazy_reply_tag
|
||||
{
|
||||
LAZY_NONE = 0,
|
||||
LAZY_COOKIE,
|
||||
LAZY_FORCED
|
||||
};
|
||||
|
||||
#define XCB_PAD(i) (-(i) & 3)
|
||||
|
||||
#define XCB_SEQUENCE_COMPARE(a,op,b) ((int64_t) ((a) - (b)) op 0)
|
||||
|
||||
#ifndef offsetof
|
||||
#define offsetof(type,member) ((size_t) &((type *)0)->member)
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x,y) ((x) < (y) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#define container_of(pointer,type,member) ((type *)(((char *)(pointer)) - offsetof(type, member)))
|
||||
|
||||
/* xcb_list.c */
|
||||
|
||||
typedef void (*xcb_list_free_func_t)(void *);
|
||||
|
||||
typedef struct _xcb_map _xcb_map;
|
||||
|
||||
_xcb_map *_xcb_map_new(void);
|
||||
void _xcb_map_delete(_xcb_map *q, xcb_list_free_func_t do_free);
|
||||
int _xcb_map_put(_xcb_map *q, unsigned int key, void *data);
|
||||
void *_xcb_map_remove(_xcb_map *q, unsigned int key);
|
||||
|
||||
|
||||
/* xcb_out.c */
|
||||
|
||||
#if HAVE_SENDMSG
|
||||
#define XCB_MAX_PASS_FD 16
|
||||
|
||||
typedef struct _xcb_fd {
|
||||
int fd[XCB_MAX_PASS_FD];
|
||||
int nfd;
|
||||
int ifd;
|
||||
} _xcb_fd;
|
||||
#endif
|
||||
|
||||
typedef struct _xcb_out {
|
||||
pthread_cond_t cond;
|
||||
int writing;
|
||||
|
||||
pthread_cond_t socket_cond;
|
||||
void (*return_socket)(void *closure);
|
||||
void *socket_closure;
|
||||
int socket_moving;
|
||||
|
||||
char queue[XCB_QUEUE_BUFFER_SIZE];
|
||||
int queue_len;
|
||||
|
||||
uint64_t request;
|
||||
uint64_t request_written;
|
||||
uint64_t total_written;
|
||||
|
||||
pthread_mutex_t reqlenlock;
|
||||
enum lazy_reply_tag maximum_request_length_tag;
|
||||
union {
|
||||
xcb_big_requests_enable_cookie_t cookie;
|
||||
uint32_t value;
|
||||
} maximum_request_length;
|
||||
#if HAVE_SENDMSG
|
||||
_xcb_fd out_fd;
|
||||
#endif
|
||||
} _xcb_out;
|
||||
|
||||
int _xcb_out_init(_xcb_out *out);
|
||||
void _xcb_out_destroy(_xcb_out *out);
|
||||
|
||||
int _xcb_out_send(xcb_connection_t *c, struct iovec *vector, int count);
|
||||
void _xcb_out_send_sync(xcb_connection_t *c);
|
||||
int _xcb_out_flush_to(xcb_connection_t *c, uint64_t request);
|
||||
|
||||
|
||||
/* xcb_in.c */
|
||||
|
||||
typedef struct _xcb_in {
|
||||
pthread_cond_t event_cond;
|
||||
int reading;
|
||||
|
||||
char queue[4096];
|
||||
int queue_len;
|
||||
|
||||
uint64_t request_expected;
|
||||
uint64_t request_read;
|
||||
uint64_t request_completed;
|
||||
uint64_t total_read;
|
||||
struct reply_list *current_reply;
|
||||
struct reply_list **current_reply_tail;
|
||||
|
||||
_xcb_map *replies;
|
||||
struct event_list *events;
|
||||
struct event_list **events_tail;
|
||||
struct reader_list *readers;
|
||||
struct special_list *special_waiters;
|
||||
|
||||
struct pending_reply *pending_replies;
|
||||
struct pending_reply **pending_replies_tail;
|
||||
#if HAVE_SENDMSG
|
||||
_xcb_fd in_fd;
|
||||
#endif
|
||||
struct xcb_special_event *special_events;
|
||||
} _xcb_in;
|
||||
|
||||
int _xcb_in_init(_xcb_in *in);
|
||||
void _xcb_in_destroy(_xcb_in *in);
|
||||
|
||||
void _xcb_in_wake_up_next_reader(xcb_connection_t *c);
|
||||
|
||||
int _xcb_in_expect_reply(xcb_connection_t *c, uint64_t request, enum workarounds workaround, int flags);
|
||||
void _xcb_in_replies_done(xcb_connection_t *c);
|
||||
|
||||
int _xcb_in_read(xcb_connection_t *c);
|
||||
int _xcb_in_read_block(xcb_connection_t *c, void *buf, int nread);
|
||||
|
||||
|
||||
/* xcb_xid.c */
|
||||
|
||||
typedef struct _xcb_xid {
|
||||
pthread_mutex_t lock;
|
||||
uint32_t last;
|
||||
uint32_t base;
|
||||
uint32_t max;
|
||||
uint32_t inc;
|
||||
} _xcb_xid;
|
||||
|
||||
int _xcb_xid_init(xcb_connection_t *c);
|
||||
void _xcb_xid_destroy(xcb_connection_t *c);
|
||||
|
||||
|
||||
/* xcb_ext.c */
|
||||
|
||||
typedef struct _xcb_ext {
|
||||
pthread_mutex_t lock;
|
||||
struct lazyreply *extensions;
|
||||
int extensions_size;
|
||||
} _xcb_ext;
|
||||
|
||||
int _xcb_ext_init(xcb_connection_t *c);
|
||||
void _xcb_ext_destroy(xcb_connection_t *c);
|
||||
|
||||
|
||||
/* xcb_conn.c */
|
||||
|
||||
struct xcb_connection_t {
|
||||
/* This must be the first field; see _xcb_conn_ret_error(). */
|
||||
int has_error;
|
||||
|
||||
/* constant data */
|
||||
xcb_setup_t *setup;
|
||||
int fd;
|
||||
|
||||
/* I/O data */
|
||||
pthread_mutex_t iolock;
|
||||
_xcb_in in;
|
||||
_xcb_out out;
|
||||
|
||||
/* misc data */
|
||||
_xcb_ext ext;
|
||||
_xcb_xid xid;
|
||||
};
|
||||
|
||||
void _xcb_conn_shutdown(xcb_connection_t *c, int err);
|
||||
|
||||
xcb_connection_t *_xcb_conn_ret_error(int err);
|
||||
|
||||
int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count);
|
||||
|
||||
|
||||
/* xcb_auth.c */
|
||||
|
||||
int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display);
|
||||
|
||||
#ifdef GCC_HAS_VISIBILITY
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user