Skip to content

Commit

Permalink
fix: adapt compact mode 2nd
Browse files Browse the repository at this point in the history
  • Loading branch information
starhcq committed Nov 12, 2024
1 parent 2f6e75a commit 705ecd0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
12 changes: 7 additions & 5 deletions src/src/ui/createTask/createtaskwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
#include "aria2rpcinterface.h"
#include "taskModel.h"

const int TEXT_URL_HEIGHT = 154;
const int TEXT_URL_HEIGHT_COMPACT = 173;
CreateTaskWidget::CreateTaskWidget(QWidget *parent)
: DDialog(parent)
, m_analysisUrl(new AnalysisUrl)
Expand Down Expand Up @@ -129,7 +131,7 @@ void CreateTaskWidget::initUi()
}

m_texturl->setPlaceholderText(tr("Enter download links or drag a torrent file here"));
m_texturl->setMinimumSize(QSize(500, 154));
m_texturl->setMinimumWidth(500);
m_texturl->setFont(font);
m_texturl->setWordWrapMode(QTextOption::NoWrap);
// m_texturl->document()->setMaximumBlockCount(60);
Expand Down Expand Up @@ -161,18 +163,18 @@ void CreateTaskWidget::initUi()
#ifdef DTKWIDGET_CLASS_DSizeMode
if (DGuiApplicationHelper::instance()->sizeMode() == DGuiApplicationHelper::NormalMode) {
m_tableView->verticalHeader()->setDefaultSectionSize(Global::tableView_NormalMode_Width);
m_texturl->setMinimumHeight(154);
m_texturl->setMinimumHeight(TEXT_URL_HEIGHT);
} else {
m_tableView->verticalHeader()->setDefaultSectionSize(Global::tableView_CompactMode_Width);
m_texturl->setMinimumHeight(184);
m_texturl->setMinimumHeight(TEXT_URL_HEIGHT_COMPACT);
}
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::sizeModeChanged, this, [=](DGuiApplicationHelper::SizeMode sizeMode) {
if (sizeMode == DGuiApplicationHelper::NormalMode) {
m_tableView->verticalHeader()->setDefaultSectionSize(Global::tableView_NormalMode_Width);
m_texturl->setMinimumHeight(154);
m_texturl->setMinimumHeight(TEXT_URL_HEIGHT);
} else {
m_tableView->verticalHeader()->setDefaultSectionSize(Global::tableView_CompactMode_Width);
m_texturl->setMinimumHeight(184);
m_texturl->setMinimumHeight(TEXT_URL_HEIGHT_COMPACT);
}
});
#else
Expand Down
8 changes: 4 additions & 4 deletions src/src/ui/mainFrame/mainframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ void MainFrame::init()
itemsize.setHeight(40);
m_LeftList->setItemSize(itemsize);
} else {
font.setPixelSize(12);
font.setPixelSize(14);
m_DownLoadingTableView->verticalHeader()->setDefaultSectionSize(Global::tableView_CompactMode_Width);
m_RecycleTableView->verticalHeader()->setDefaultSectionSize(Global::tableView_CompactMode_Width);
itemsize.setHeight(40 * Global::compactMode_ratio);
itemsize.setHeight(40 - 4);
m_LeftList->setItemSize(itemsize);
}
#else
Expand Down Expand Up @@ -271,11 +271,11 @@ void MainFrame::init()
itemsize.setHeight(40);
m_LeftList->setItemSize(itemsize);
} else {
font.setPixelSize(12);
font.setPixelSize(14);
m_DownLoadingTableView->verticalHeader()->setDefaultSectionSize(Global::tableView_CompactMode_Width);
m_RecycleTableView->verticalHeader()->setDefaultSectionSize(Global::tableView_CompactMode_Width);
m_LeftList->setItemSize(QSize(Global::tableView_CompactMode_Width, Global::tableView_CompactMode_Width));
itemsize.setHeight(40 * Global::compactMode_ratio);
itemsize.setHeight(40 - 4);
m_LeftList->setItemSize(itemsize);
}
m_DownloadingItem->setFont(font);
Expand Down

0 comments on commit 705ecd0

Please sign in to comment.