Skip to content

Commit

Permalink
Add current fractal info help menu
Browse files Browse the repository at this point in the history
  • Loading branch information
kanurag94 committed Aug 16, 2020
1 parent b10d226 commit 4ccb96b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define DOWNLOAD_URL "https://github.com/xaos-project/XaoS/releases"
#define FEEDBACK_URL "https://github.com/xaos-project/XaoS/issues"
#define FORUM_URL "https://groups.google.com/d/forum/xaos-users"
#define FRACTALINFO_URL "https://github.com/xaos-project/XaoS/wiki/Fractal-Types#"

// File locations
#define DATAPATH "/usr/share/XaoS"
Expand Down
20 changes: 20 additions & 0 deletions src/ui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,24 @@ static void ui_download(struct uih_context */*uih*/)
QDesktopServices::openUrl(QUrl(DOWNLOAD_URL));
}

static void ui_fractalinfo(struct uih_context *uih)
{
printf("%s", uih->fcontext->currentformula->shortname);
QString fractalname = uih->fcontext->currentformula->shortname;
for (auto c : fractalname) {
if(c >= '0' and c <= '9') {
fractalname.remove(c);
}
}
QMap<QString, QString> map;

// Dictionary of fractaltype and corresponding wiki hypertext link
map["mandel"] = "mandelbrot";
fractalname = map.find(fractalname) != map.end() ? map[fractalname] : fractalname;

QDesktopServices::openUrl(QUrl(FRACTALINFO_URL + fractalname));
}

static void ui_feedback(struct uih_context */*uih*/)
{
QDesktopServices::openUrl(QUrl(FEEDBACK_URL));
Expand Down Expand Up @@ -508,6 +526,8 @@ static void ui_registermenus_i18n(void)

MENUNOP_I("helpmenu", "h", TR("Menu", "Help"), "help", MENUFLAG_INCALC,
ui_help);
MENUNOP_I("helpmenu", NULL, TR("Menu", "Info on current fractal"), "fractalinfo",
MENUFLAG_INCALC, ui_fractalinfo);
MENUNOP_I("helpmenu", NULL, TR("Menu", "Send Feedback"), "feedback", MENUFLAG_INCALC,
ui_feedback);
MENUNOP_I("helpmenu", NULL, TR("Menu", "Get Updates"), "updates", MENUFLAG_INCALC,
Expand Down

0 comments on commit 4ccb96b

Please sign in to comment.