build(debian): 1.3.1.0-ok3

This commit is contained in:
jiangdingyuan 2023-03-23 15:37:08 +08:00
parent 5ab5bdcc99
commit 28040949c7
16 changed files with 188 additions and 9 deletions

22
common/base_info.cpp Normal file
View File

@ -0,0 +1,22 @@
#include "base_info.h"
BaseInfo::BaseInfo()
{
init();
}
BaseInfo::~BaseInfo()
{
}
void BaseInfo::init()
{
appDisplayName = tr("Printer");
}
QString BaseInfo::getAppDisplayName()
{
return appDisplayName;
}

23
common/base_info.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef BASEINFO_H
#define BASEINFO_H
#include <QObject>
#include <QString>
#include "singleton.h"
class BaseInfo : public QObject,
public Singleton<BaseInfo>
{
Q_OBJECT
friend class Singleton<BaseInfo>;
private:
BaseInfo();
~BaseInfo() override;
void init();
QString getAppDisplayName();
private:
QString appDisplayName;
};
#endif // BASEINFO_H

9
debian/changelog vendored
View File

@ -1,3 +1,12 @@
kylin-printer (1.3.1.0-ok3) yangtze; urgency=medium
* BUG 无
* 需求号:无
* 其他改动说明同步主线1.3.1.1-0k0.1tablet4版本
* 其他改动影响域:无
-- jiangdingyuan <jiangdingyuan@kylinos.cn> Thu, 23 Mar 2023 15:35:32 +0800
kylin-printer (1.3.1.0-ok2) yangtze; urgency=medium
* BUG 无

View File

@ -27,6 +27,7 @@
#include "pop_window_manager.h"
#include "information_collector.h"
#include "windowmanage.hpp"
#include "base_info.h"
void addTrans()
{
@ -103,14 +104,17 @@ int main(int argc, char *argv[])
return 0;
}
app.setApplicationVersion(PROJECT_VERSION);
app.setWindowIcon(QIcon::fromTheme("kylin-printer"));
if(!GsettingsMonitor::getInstance()->gsettingsCheck())
{
app.setProperty("noChangeSystemFontSize",true);
}
addTrans();
BaseInfo::instance();
app.setApplicationName(BaseInfo::instance().getAppDisplayName());
app.setApplicationVersion(PROJECT_VERSION);
app.setWindowIcon(QIcon::fromTheme("kylin-printer"));
/* 最小化拉起 */
app.setActivationWindow(MainWindow::getInstance());

View File

@ -417,11 +417,11 @@ void UkuiPrinterManager::getPrintQueue(QString printerName, UkuiQueueStatus stat
job.jobState = jobs[i].state;
// 时间可能为0 就会显示成1970xxx
if (jobs[i].completed_time)
job.completeTime = QDateTime::fromTime_t(jobs[i].completed_time);
job.completeTime = jobs[i].completed_time;
if (jobs[i].creation_time)
job.createTime = QDateTime::fromTime_t(jobs[i].creation_time);
job.createTime = jobs[i].creation_time;
if (jobs[i].processing_time)
job.processingTime = QDateTime::fromTime_t(jobs[i].processing_time);
job.processingTime = jobs[i].processing_time;
if (jobs[i].state == IPP_JSTATE_PROCESSING) {
job.status = UkuiQueueStatus::UKUI_PRINTER_QUEUE_ACTIVE;
} else if (jobs[i].state == IPP_JSTATE_COMPLETED) {

View File

@ -39,9 +39,9 @@ struct PrintJob {
QString title;
UkuiQueueStatus status;
int jobState;
QDateTime createTime;
QDateTime completeTime;
QDateTime processingTime;
time_t createTime;
time_t completeTime;
time_t processingTime;
int size;
bool preserved;
};

View File

@ -257,6 +257,14 @@
<translation></translation>
</message>
</context>
<context>
<name>BaseInfo</name>
<message>
<location filename="../common/base_info.cpp" line="20"/>
<source>Printer</source>
<translation></translation>
</message>
</context>
<context>
<name>BaseNotifyDialog</name>
<message>

View File

@ -200,6 +200,14 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>BaseInfo</name>
<message>
<location filename="../common/base_info.cpp" line="20"/>
<source>Printer</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>BaseNotifyDialog</name>
<message>

View File

@ -225,6 +225,14 @@
<translation>желі</translation>
</message>
</context>
<context>
<name>BaseInfo</name>
<message>
<location filename="../common/base_info.cpp" line="20"/>
<source>Printer</source>
<translation>Принтер</translation>
</message>
</context>
<context>
<name>BaseNotifyDialog</name>
<message>

View File

@ -225,6 +225,14 @@
<translation>тармак</translation>
</message>
</context>
<context>
<name>BaseInfo</name>
<message>
<location filename="../common/base_info.cpp" line="20"/>
<source>Printer</source>
<translation>Принтер</translation>
</message>
</context>
<context>
<name>BaseNotifyDialog</name>
<message>

View File

@ -225,6 +225,14 @@
<translation>сеть</translation>
</message>
</context>
<context>
<name>BaseInfo</name>
<message>
<location filename="../common/base_info.cpp" line="20"/>
<source>Printer</source>
<translation>Принтер</translation>
</message>
</context>
<context>
<name>BaseNotifyDialog</name>
<message>

View File

@ -225,6 +225,14 @@
<translation>تور</translation>
</message>
</context>
<context>
<name>BaseInfo</name>
<message>
<location filename="../common/base_info.cpp" line="20"/>
<source>Printer</source>
<translation>پرىنتېرلاش</translation>
</message>
</context>
<context>
<name>BaseNotifyDialog</name>
<message>

View File

@ -253,6 +253,14 @@
<translation></translation>
</message>
</context>
<context>
<name>BaseInfo</name>
<message>
<location filename="../common/base_info.cpp" line="20"/>
<source>Printer</source>
<translation></translation>
</message>
</context>
<context>
<name>BaseNotifyDialog</name>
<message>

View File

@ -4,6 +4,7 @@
#include <QFontDatabase>
#include <QFont>
#include "global_variable.h"
#include <QDateTime>
const double SYSTEM_DEFAULT_FONT_SIZE = 11;
const double SYSTEM_DEFAULT_FONT_SIZE_PIXELS = 9;
@ -80,9 +81,62 @@ void GsettingsMonitor::initGsettings()
}
});
if(QGSettings::isSchemaInstalled(PANEL_CONTROL_IN_CALENDAR)) {
m_calendarSettings = new QGSettings(PANEL_CONTROL_IN_CALENDAR);
connect(m_calendarSettings, &QGSettings::changed, this, [=] (const QString &key){
if(key == "date" || key == "hoursystem") {
sysDateStyleGet();
}
});
sysDateStyleGet();
}
return ;
}
QString GsettingsMonitor::sysDateStyleGet()
{
if(!QGSettings::isSchemaInstalled(PANEL_CONTROL_IN_CALENDAR)) {
return m_timeStyle;
}
QString tmpDate;
if(m_calendarSettings->get("date").toString() == "cn"){
tmpDate = "yyyy/MM/dd dddd";
} else {
tmpDate = "yyyy-MM-dd dddd";
}
QLocale locale = (QLocale::system().name() == "zh_CN" ? (QLocale::Chinese) : (QLocale::English));
QString tmpTime;
QString timemodel = m_calendarSettings->get("hoursystem").toString();
if(timemodel == "12") {
if(locale.language() == QLocale::English){
tmpTime = "hh:mm:ss A";
} else {
tmpTime = "A hh:mm:ss";
}
} else {
tmpTime = "hh:mm:ss";
}
QString tmpTimeStyle = tmpDate + " " + tmpTime;
if (tmpTimeStyle != m_timeStyle) {
m_timeStyle = tmpTimeStyle;
sysDateStyleUpdate(m_timeStyle);
}
return m_timeStyle;
}
QString GsettingsMonitor::sysDateStyleGet(time_t time)
{
if (m_timeStyle.isEmpty()) {
return QDateTime::fromTime_t(time).toString();
}
return QDateTime::fromTime_t(time).toString(m_timeStyle);
}
QFont GsettingsMonitor::getFontSize()
{
//启动时设置字号

View File

@ -21,12 +21,16 @@ private:
const char *KYLIN_PRINTER_IP = "ip";
const char *KYLIN_PRINTER_PRINTERS = "printers";
const char *PANEL_CONTROL_IN_CALENDAR = "org.ukui.control-center.panel.plugins";
public:
static GsettingsMonitor* getInstance();
bool gsettingsCheck();
QFont getFontSize();
int sysTransparencyGet();
QString sysStyleNameGet();
QString sysDateStyleGet();
QString sysDateStyleGet(time_t time);
QString apiServerAddressGet();
QByteArray printerDevicesGet();
@ -37,6 +41,7 @@ signals:
QFont sysFontSizeUpdate(QFont currentFont);
void sysTransparencyUpdate(int transparency);
void sysStyleNameUpdate(const QString &styleName);
void sysDateStyleUpdate(const QString &dateStyle);
void printerDevicesUpdate(const QByteArray &devices);
void apiServerAddressUpdate(const QString &host);
@ -56,7 +61,9 @@ private:
QGSettings *m_ukuiStyle;
QGSettings *m_kylinPrinterSettings;
QGSettings *m_calendarSettings;
QString m_timeStyle = QString();
int m_menuTrans = -1;
QString m_styleName = QString();
QByteArray m_devices = QByteArray();

View File

@ -8,6 +8,7 @@
#include "size_para.h"
#include "custom_list_view.h"
#include "job_manager_window.h"
#include "gsettings_monitor.h"
JobManagerModel::JobManagerModel(QStandardItemModel *parent)
: QStandardItemModel(parent)
@ -40,7 +41,7 @@ bool JobManagerModel::addJob(const PrintJob &job)
this->setData(index(0, i++), getJobTitleTranslation(job.title));
this->setData(index(0, i++), job.printerName);
this->setData(index(0, i++), QString::number(job.size)+"kb");
this->setData(index(0, i++), job.createTime);
this->setData(index(0, i++), GsettingsMonitor::getInstance()->sysDateStyleGet(job.createTime));
this->setData(index(0, i++), jobStatusStrList.at(job.jobState));
return true;
}
@ -250,6 +251,9 @@ void JobManagerWindow::initUi()
void JobManagerWindow::initConnect()
{
connect(m_view.get(), &QTableView::customContextMenuRequested, this, &JobManagerWindow::ShowContextMenu);
connect(GsettingsMonitor::getInstance(), &GsettingsMonitor::sysDateStyleUpdate, this, [=](){
updateModel(false);
});
}
void JobManagerWindow::initMenu()