#2813 Origin import dialog. Add text '+ xxx more files' if number of origin files exceedes 4

This commit is contained in:
Bjørn Erik Jensen 2018-04-30 11:26:31 +02:00
parent 39cfc687bd
commit b34deb1038
2 changed files with 26 additions and 1 deletions

View File

@ -476,15 +476,23 @@ void RicSummaryCaseRestartDialog::updateFileListWidget(QGridLayout* gridLayout,
delete item;
}
if (m_fileLists[listIndex].empty())
if (m_fileLists[listIndex].empty())
{
QWidget* parent = gridLayout->parentWidget();
if (parent) parent->setVisible(false);
}
int maxFilesToDisplay = 4;
int currFiles = 0;
for (const auto& fileInfo : m_fileLists[listIndex])
{
appendFileInfoToGridLayout(gridLayout, fileInfo.first, fileInfo.second);
if (++currFiles == maxFilesToDisplay)
{
size_t remainingFileCount = m_fileLists[listIndex].size() - maxFilesToDisplay;
appendTextToGridLayout(gridLayout, QString("+ %1 more files").arg(remainingFileCount));
break;
}
}
}
@ -518,6 +526,22 @@ void RicSummaryCaseRestartDialog::appendFileInfoToGridLayout(QGridLayout* gridLa
fileNameLabel->setToolTip(fullPathFileName);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSummaryCaseRestartDialog::appendTextToGridLayout(QGridLayout* gridLayout, const QString& text)
{
CVF_ASSERT(gridLayout);
int rowCount = gridLayout->rowCount();
QLabel* textLabel = new QLabel();
textLabel->setText(text);
textLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
gridLayout->addWidget(textLabel, rowCount, 0, 1, 2);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -77,6 +77,7 @@ public:
private:
void updateFileListWidget(QGridLayout* gridLayout, int listIndex);
void appendFileInfoToGridLayout(QGridLayout* gridLayout, const RifRestartFileInfo& fileInfo, const QString& fullPathFileName);
void appendTextToGridLayout(QGridLayout* gridLayout, const QString& text);
RifRestartFileInfo getFileInfo(const QString& summaryHeaderFile);
void displayWarningsIfAny(const QStringList& warnings);
QString fullFileName(const QString& shortOrFullFileName);