Skip to content

Commit

Permalink
fix: fleming定制默认存储压缩方式优先
Browse files Browse the repository at this point in the history
fleming定制默认存储压缩方式优先

Log: fleming定制默认存储压缩方式优先
  • Loading branch information
myk1343 committed Oct 29, 2024
1 parent f9c58e8 commit 3ca51be
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/source/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3327,7 +3327,7 @@ void MainWindow::slotFinishCalculateSize(qint64 size, QString strArchiveFullPath
{
if (StartupType::ST_Compresstozip7z == m_eStartupType) {
#ifdef DTKCORE_CLASS_DConfigFile
if(m_pCompressSettingPage->property("devName").toString().contains("PGUX", Qt::CaseInsensitive)) {
if(m_pCompressSettingPage->isOrderMode()) {
DConfig *dconfig = DConfig::create("org.deepin.compressor","org.deepin.compressor.method");
if(strArchiveFullPath.endsWith("7z")) {
if(dconfig && dconfig->isValid() && dconfig->keyList().contains("special7zCompressor")){
Expand Down
14 changes: 9 additions & 5 deletions src/source/page/compresssettingpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void CompressSettingPage::refreshMenu()
}
}
#ifdef DTKCORE_CLASS_DConfigFile
if(m_isPanguX) {
if(m_isOrderMode) {
DConfig *dconfig = (DConfig *)m_dconfig;
int nCompType = -1;
if(dconfig && dconfig->isValid() && dconfig->keyList().contains("specialCompressorType")){
Expand Down Expand Up @@ -467,7 +467,7 @@ void CompressSettingPage::setSplitEnabled(bool bEnabled)
void CompressSettingPage::refreshCompressLevel(const QString &strType)
{
#ifdef DTKCORE_CLASS_DConfigFile
if(m_isPanguX) {
if(m_isOrderMode) {
// 其余格式支持设置压缩方式
// 设置压缩方式可用
m_pCompressLevelCmb->setEnabled(true);
Expand Down Expand Up @@ -698,8 +698,7 @@ void CompressSettingPage::initConfig()
QStringList lines = result.split('\n');
for (const QString &line : lines) {
if (line.contains("String 4", Qt::CaseInsensitive)) {
m_isPanguX = line.contains("PGUX", Qt::CaseInsensitive);
setProperty("devName", line);
m_isOrderMode = line.contains("PGUX", Qt::CaseInsensitive) || line.contains("FXK11", Qt::CaseInsensitive);

Check warning on line 701 in src/source/page/compresssettingpage.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Consider using std::accumulate algorithm instead of a raw loop.
}
}
process.close();
Expand Down Expand Up @@ -812,7 +811,7 @@ void CompressSettingPage::slotAdvancedEnabled(bool bEnabled)
if (m_pCompressTypeLbl->text() == "tar.gz") {
m_pCpuCmb->setCurrentIndex(m_pCpuCmb->count() - 1);
#ifdef DTKCORE_CLASS_DConfigFile
if(m_isPanguX) {
if(m_isOrderMode) {
DConfig *dconfig = (DConfig *)m_dconfig;
if(dconfig && dconfig->isValid() && dconfig->keyList().contains("specialCpuTarGzCompressor")){
int nCpu = dconfig->value("specialCpuTarGzCompressor").toInt();
Expand Down Expand Up @@ -1005,6 +1004,11 @@ bool CompressSettingPage::eventFilter(QObject *watched, QEvent *event)
}
}

bool CompressSettingPage::isOrderMode()
{
return m_isOrderMode;
}

TypeLabel *CompressSettingPage::getClickLbl() const
{
return m_pClickLbl;
Expand Down
7 changes: 6 additions & 1 deletion src/source/page/compresssettingpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ class CompressSettingPage : public DWidget
* @return
*/
bool eventFilter(QObject *watched, QEvent *event) override;
/**
* @brief 是否定制模式
* @return
*/
bool isOrderMode();

private:
/**
Expand Down Expand Up @@ -259,7 +264,7 @@ private slots:

QScrollArea *m_pRightScroll = nullptr;
void *m_dconfig = nullptr; //读取dconfig配置
bool m_isPanguX = false; //是否pangux系统
bool m_isOrderMode = false; //是否定制模式存储压缩方式优先
};

#endif // COMPRESSSETTINGPAGE_H

0 comments on commit 3ca51be

Please sign in to comment.