Skip to content

Commit

Permalink
feat: add list of contributors in 'About Grabber' window
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Jul 30, 2022
1 parent 98c5b37 commit 156d4a1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
9 changes: 9 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ if(USE_QSCINTILLA)
endif()
endif()

find_program(JQ_EXISTS "jq")
if(JQ_EXISTS)
execute_process(COMMAND jq -r "[.contributors[].login] | @tsv" "${CMAKE_CURRENT_LIST_DIR}/../../.all-contributorsrc" OUTPUT_VARIABLE CONTRIBUTORS)
string(STRIP "${CONTRIBUTORS}" CONTRIBUTORS)
else()
message(WARNING "No contributors list passed and 'jq' not found")
endif()
add_definitions(-DCONTRIBUTORS="${CONTRIBUTORS}")

# Input
file(GLOB SOURCES
"src/main/main.cpp"
Expand Down
9 changes: 8 additions & 1 deletion src/gui/src/about-window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ AboutWindow::AboutWindow(const QString &version, QWidget *parent)
ui->labelCurrent->setText(labelVersion);

ui->labelCreator->setText(ui->labelCreator->text().replace("{website}", PROJECT_WEBSITE_URL));
setFixedSize(400, 228);

// List contributors
const QString contributors = QString(CONTRIBUTORS).replace('\t', ", ");
ui->labelContributors->setText(ui->labelContributors->text().replace("{contributors}", contributors));

setFixedSize(600, heightForWidth(600));

connect(&m_updater, &ProgramUpdater::finished, this, &AboutWindow::finished);
m_updater.checkForUpdates();
Expand All @@ -37,4 +42,6 @@ void AboutWindow::finished(const QString &newVersion, bool available)
{
const QString msg = available ? tr("A new version is available: %1").arg(newVersion) : tr("Grabber is up to date");
ui->labelMessage->setText("<p style=\"font-size:8pt; font-style:italic; color:#808080;\">" + msg + "</p>");

setFixedSize(600, heightForWidth(600));
}
16 changes: 13 additions & 3 deletions src/gui/src/about-window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>272</height>
<width>600</width>
<height>295</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -74,7 +74,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelThanks">
<property name="text">
<string>Special thanks to all contributors for their help improving the program over the years, be it by providing to the code, translations, or reporting issues and suggesting new features.</string>
</property>
Expand All @@ -83,6 +83,16 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelContributors">
<property name="text">
<string>&lt;u&gt;Contributors:&lt;/u&gt; {contributors}</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
Expand Down

0 comments on commit 156d4a1

Please sign in to comment.