Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: follow system config #170

Merged
merged 7 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Upstream-Contact: haifeng.chen <[email protected]>
Source:

# README
Files: README.md CHANGELOG.md README.zh_CN.md calendar-client/README.md
Files: README.md CHANGELOG.md README.zh_CN.md calendar-client/README.md docs/*
Copyright: None
License: CC-BY-4.0

Expand Down
3 changes: 3 additions & 0 deletions calendar-client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ find_package(DtkWidget REQUIRED)
find_package(DtkGui REQUIRED)
find_package(Qt5Network REQUIRED)

set_source_files_properties(src/dbus/org.deepin.dde.ControlCenter.xml PROPERTIES CLASSNAME ControlCenterProxy)
qt5_add_dbus_interface(Calendar_SRC src/dbus/org.deepin.dde.ControlCenter.xml controlCenterProxy)

include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
# Tell CMake to create the executable
add_executable(${PROJECT_NAME} ${Calendar_SRC} ${APP_QRC})
Expand Down
30 changes: 24 additions & 6 deletions calendar-client/src/dataManage/accountmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,6 @@ void AccountManager::uploadNetWorkAccountData(CallbackFunc callback)
m_dbusRequest->uploadNetWorkAccountData();
}

void AccountManager::setCalendarGeneralSettings(DCalendarGeneralSettings::Ptr ptr, CallbackFunc callback)
{
m_dbusRequest->setCallbackFunc(callback);
m_dbusRequest->setCalendarGeneralSettings(ptr);
}

void AccountManager::setFirstDayofWeek(int value)
{
m_settings->setFirstDayOfWeek(static_cast<Qt::DayOfWeek>(value));
Expand All @@ -178,6 +172,30 @@ void AccountManager::setTimeFormatType(int value)
m_dbusRequest->setTimeFormatType(value);
}

// 设置一周首日来源
void AccountManager::setFirstDayofWeekSource(DCalendarGeneralSettings::GeneralSettingSource value)
{
m_dbusRequest->setFirstDayofWeekSource(value);
};

// 设置时间显示格式来源
void AccountManager::setTimeFormatTypeSource(DCalendarGeneralSettings::GeneralSettingSource value)
{
m_dbusRequest->setTimeFormatTypeSource(value);
};

// 获取一周首日来源
DCalendarGeneralSettings::GeneralSettingSource AccountManager::getFirstDayofWeekSource()
{
return m_dbusRequest->getFirstDayofWeekSource();
};

// 获取时间显示格式来源
DCalendarGeneralSettings::GeneralSettingSource AccountManager::getTimeFormatTypeSource()
{
return m_dbusRequest->getTimeFormatTypeSource();
};

/**
* @brief login
* 帐户登录
Expand Down
12 changes: 9 additions & 3 deletions calendar-client/src/dataManage/accountmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "dbus/dbusaccountmanagerrequest.h"
#include "accountitem.h"
#include "dcalendargeneralsettings.h"

//所有帐户管理类
class AccountManager : public QObject
Expand All @@ -33,13 +34,18 @@ class AccountManager : public QObject
//更新网络帐户数据
void uploadNetWorkAccountData(CallbackFunc callback = nullptr);

//设置通用设置
void setCalendarGeneralSettings(DCalendarGeneralSettings::Ptr ptr, CallbackFunc callback = nullptr);

//设置一周首日
void setFirstDayofWeek(int);
//设置时间显示格式
void setTimeFormatType(int);
// 设置一周首日来源
void setFirstDayofWeekSource(DCalendarGeneralSettings::GeneralSettingSource);
// 设置时间显示格式来源
void setTimeFormatTypeSource(DCalendarGeneralSettings::GeneralSettingSource);
// 获取一周首日来源
DCalendarGeneralSettings::GeneralSettingSource getFirstDayofWeekSource();
// 获取时间显示格式来源
DCalendarGeneralSettings::GeneralSettingSource getTimeFormatTypeSource();
//帐户登录
void login();
//帐户登出
Expand Down
73 changes: 61 additions & 12 deletions calendar-client/src/dbus/dbusaccountmanagerrequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "dbusaccountmanagerrequest.h"
#include "commondef.h"
#include "dcalendargeneralsettings.h"
#include <QDBusInterface>
#include <QDebug>

Expand Down Expand Up @@ -33,6 +34,66 @@ void DbusAccountManagerRequest::setTimeFormatType(int value)
interface.setProperty("timeFormatType", QVariant(value));
}

/**
* @brief setFirstDayofWeekSource
* 设置一周首日来源
*/
void DbusAccountManagerRequest::setFirstDayofWeekSource(DCalendarGeneralSettings::GeneralSettingSource value)
{
QDBusInterface interface(this->service(), this->path(), this->interface(), QDBusConnection::sessionBus(), this);
interface.setProperty("firstDayOfWeekSource", QVariant(value));
}

/**
* @brief setTimeFormatTypeSource
* 设置时间显示格式来源
*/
void DbusAccountManagerRequest::setTimeFormatTypeSource(DCalendarGeneralSettings::GeneralSettingSource value)
{
QDBusInterface interface(this->service(), this->path(), this->interface(), QDBusConnection::sessionBus(), this);
interface.setProperty("timeFormatTypeSource", QVariant(value));
}

/**
* @brief getFirstDayofWeekSource
* 获取一周首日来源
*/
DCalendarGeneralSettings::GeneralSettingSource DbusAccountManagerRequest::getFirstDayofWeekSource()
{
QDBusInterface interface(this->service(),
this->path(),
this->interface(),
QDBusConnection::sessionBus(),
this);
bool ok;
auto val = interface.property("firstDayOfWeekSource").toInt(&ok);
if (ok) {
return static_cast<DCalendarGeneralSettings::GeneralSettingSource>(val);
} else {
return DCalendarGeneralSettings::Source_Database;
}
}

/**
* @brief getTimeFormatTypeSource
* 获取时间显示格式来源
*/
DCalendarGeneralSettings::GeneralSettingSource DbusAccountManagerRequest::getTimeFormatTypeSource()
{
QDBusInterface interface(this->service(),
this->path(),
this->interface(),
QDBusConnection::sessionBus(),
this);
bool ok;
auto val = interface.property("timeFormatTypeSource").toInt(&ok);
if (ok) {
return static_cast<DCalendarGeneralSettings::GeneralSettingSource>(val);
} else {
return DCalendarGeneralSettings::Source_Database;
}
}

/**
* @brief DbusAccountManagerRequest::getAccountList
* 请求帐户列表
Expand Down Expand Up @@ -70,18 +131,6 @@ void DbusAccountManagerRequest::getCalendarGeneralSettings()
asyncCall("getCalendarGeneralSettings");
}

/**
* @brief DbusAccountManagerRequest::setCalendarGeneralSettings
* 设置通用设置
* @param ptr 通用设置
*/
void DbusAccountManagerRequest::setCalendarGeneralSettings(DCalendarGeneralSettings::Ptr ptr)
{
QString jsonStr;
DCalendarGeneralSettings::toJsonString(ptr, jsonStr);
asyncCall("setCalendarGeneralSettings", QVariant(jsonStr));
}

/**
* @brief DbusAccountManagerRequest::login
* 帐户登录
Expand Down
10 changes: 8 additions & 2 deletions calendar-client/src/dbus/dbusaccountmanagerrequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ class DbusAccountManagerRequest : public DbusRequestBase
void setFirstDayofWeek(int);
//设置时间显示格式
void setTimeFormatType(int);
// 设置一周首日来源
void setFirstDayofWeekSource(DCalendarGeneralSettings::GeneralSettingSource);
// 设置时间显示格式来源
void setTimeFormatTypeSource(DCalendarGeneralSettings::GeneralSettingSource);
// 获取一周首日来源
DCalendarGeneralSettings::GeneralSettingSource getFirstDayofWeekSource();
// 获取时间显示格式来源
DCalendarGeneralSettings::GeneralSettingSource getTimeFormatTypeSource();

//获取帐户列表
void getAccountList();
Expand All @@ -29,8 +37,6 @@ class DbusAccountManagerRequest : public DbusRequestBase
void uploadNetWorkAccountData();
//获取通用设置
void getCalendarGeneralSettings();
//设置通用设置
void setCalendarGeneralSettings(DCalendarGeneralSettings::Ptr ptr);
//
void clientIsShow(bool isShow);
//获取是否支持云同步
Expand Down
7 changes: 7 additions & 0 deletions calendar-client/src/dbus/org.deepin.dde.ControlCenter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<node>
<interface name="org.deepin.dde.ControlCenter1">
<method name="ShowPage">
<arg name="url" type="s" direction="in"/>
</method>
</interface>
</node>
Loading
Loading