mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge pull request #12660 from jordan-woyak/hide-makepkg
Hide branch name from title bar when there are no commits ahead of master.
This commit is contained in:
commit
1805f6e381
@ -18,6 +18,10 @@ if(GIT_FOUND)
|
||||
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
|
||||
OUTPUT_VARIABLE DOLPHIN_WC_BRANCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
# defines DOLPHIN_WC_COMMITS_AHEAD_MASTER
|
||||
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD ^master
|
||||
OUTPUT_VARIABLE DOLPHIN_WC_COMMITS_AHEAD_MASTER
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
|
||||
# version number
|
||||
@ -35,12 +39,7 @@ if(NOT DOLPHIN_WC_REVISION)
|
||||
set(DOLPHIN_WC_DESCRIBE "${DOLPHIN_VERSION_MAJOR}.${DOLPHIN_VERSION_MINOR}")
|
||||
set(DOLPHIN_WC_REVISION "${DOLPHIN_WC_DESCRIBE} (no further info)")
|
||||
set(DOLPHIN_WC_BRANCH "master")
|
||||
endif()
|
||||
|
||||
if(DOLPHIN_WC_BRANCH STREQUAL "master" OR DOLPHIN_WC_BRANCH STREQUAL "stable")
|
||||
set(DOLPHIN_WC_IS_STABLE "1")
|
||||
else()
|
||||
set(DOLPHIN_WC_IS_STABLE "0")
|
||||
set(DOLPHIN_WC_COMMITS_AHEAD_MASTER 0)
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
|
@ -20,7 +20,8 @@ namespace Common
|
||||
const std::string& GetScmRevStr()
|
||||
{
|
||||
static const std::string scm_rev_str = "Dolphin "
|
||||
#if !SCM_IS_MASTER
|
||||
// Note this macro can be empty if the master branch does not exist.
|
||||
#if 1 - SCM_COMMITS_AHEAD_MASTER - 1 != 0
|
||||
"[" SCM_BRANCH_STR "] "
|
||||
#endif
|
||||
|
||||
@ -74,4 +75,10 @@ const std::string& GetNetplayDolphinVer()
|
||||
return netplay_dolphin_ver;
|
||||
}
|
||||
|
||||
int GetScmCommitsAheadMaster()
|
||||
{
|
||||
// Note this macro can be empty if the master branch does not exist.
|
||||
return SCM_COMMITS_AHEAD_MASTER + 0;
|
||||
}
|
||||
|
||||
} // namespace Common
|
||||
|
@ -14,4 +14,5 @@ const std::string& GetScmRevGitStr();
|
||||
const std::string& GetScmDistributorStr();
|
||||
const std::string& GetScmUpdateTrackStr();
|
||||
const std::string& GetNetplayDolphinVer();
|
||||
int GetScmCommitsAheadMaster();
|
||||
} // namespace Common
|
||||
|
@ -5,6 +5,7 @@ var outfile = "./scmrev.h";
|
||||
var cmd_revision = " rev-parse HEAD";
|
||||
var cmd_describe = " describe --always --long --dirty";
|
||||
var cmd_branch = " rev-parse --abbrev-ref HEAD";
|
||||
var cmd_commits_ahead = " rev-list --count HEAD ^master";
|
||||
|
||||
function GetGitExe()
|
||||
{
|
||||
@ -76,7 +77,7 @@ var gitexe = GetGitExe();
|
||||
var revision = GetFirstStdOutLine(gitexe + cmd_revision);
|
||||
var describe = GetFirstStdOutLine(gitexe + cmd_describe);
|
||||
var branch = GetFirstStdOutLine(gitexe + cmd_branch);
|
||||
var isStable = +("master" == branch || "stable" == branch);
|
||||
var commits_ahead = GetFirstStdOutLine(gitexe + cmd_commits_ahead);
|
||||
|
||||
// Get environment information.
|
||||
var distributor = wshShell.ExpandEnvironmentStrings("%DOLPHIN_DISTRIBUTOR%");
|
||||
@ -91,7 +92,7 @@ var out_contents =
|
||||
"#define SCM_REV_STR \"" + revision + "\"\n" +
|
||||
"#define SCM_DESC_STR \"" + describe + "\"\n" +
|
||||
"#define SCM_BRANCH_STR \"" + branch + "\"\n" +
|
||||
"#define SCM_IS_MASTER " + isStable + "\n" +
|
||||
"#define SCM_COMMITS_AHEAD_MASTER " + commits_ahead + "\n" +
|
||||
"#define SCM_DISTRIBUTOR_STR \"" + distributor + "\"\n" +
|
||||
"#define SCM_UPDATE_TRACK_STR \"" + default_update_track + "\"\n";
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define SCM_REV_STR "${DOLPHIN_WC_REVISION}"
|
||||
#define SCM_DESC_STR "${DOLPHIN_WC_DESCRIBE}"
|
||||
#define SCM_BRANCH_STR "${DOLPHIN_WC_BRANCH}"
|
||||
#define SCM_IS_MASTER ${DOLPHIN_WC_IS_STABLE}
|
||||
#define SCM_COMMITS_AHEAD_MASTER ${DOLPHIN_WC_COMMITS_AHEAD_MASTER}
|
||||
#define SCM_DISTRIBUTOR_STR "${DISTRIBUTOR}"
|
||||
#define SCM_UPDATE_TRACK_STR "${DOLPHIN_DEFAULT_UPDATE_TRACK}"
|
||||
|
@ -17,6 +17,16 @@ AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent)
|
||||
setWindowTitle(tr("About Dolphin"));
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
QString branch_str = QString::fromStdString(Common::GetScmBranchStr());
|
||||
const int commits_ahead = Common::GetScmCommitsAheadMaster();
|
||||
if (commits_ahead > 0)
|
||||
{
|
||||
branch_str = tr("%1 (%2)").arg(
|
||||
branch_str,
|
||||
// i18n: A positive number of version control commits made compared to some named branch
|
||||
tr("%1 commit(s) ahead of %2").arg(commits_ahead).arg(QStringLiteral("master")));
|
||||
}
|
||||
|
||||
const QString text =
|
||||
QStringLiteral(R"(
|
||||
<p style='font-size:38pt; font-weight:400;'>Dolphin</p>
|
||||
@ -50,7 +60,7 @@ AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent)
|
||||
QString::fromUtf8(Common::GetScmDescStr().c_str()))
|
||||
.replace(QStringLiteral("%BRANCH%"),
|
||||
// i18n: "Branch" means the version control term, not a literal tree branch.
|
||||
tr("Branch: %1").arg(QString::fromUtf8(Common::GetScmBranchStr().c_str())))
|
||||
tr("Branch: %1").arg(branch_str))
|
||||
.replace(QStringLiteral("%REVISION%"),
|
||||
tr("Revision: %1").arg(QString::fromUtf8(Common::GetScmRevGitStr().c_str())))
|
||||
.replace(QStringLiteral("%QT_VERSION%"),
|
||||
|
Loading…
Reference in New Issue
Block a user