summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin/Makefile.mingw32.in1
-rw-r--r--plugingui/Makefile.am1
-rw-r--r--plugingui/abouttab.cc96
-rw-r--r--plugingui/abouttab.h58
-rw-r--r--plugingui/mainwindow.cc52
-rw-r--r--plugingui/mainwindow.h14
6 files changed, 160 insertions, 62 deletions
diff --git a/plugin/Makefile.mingw32.in b/plugin/Makefile.mingw32.in
index ffdb28b..5f588f9 100644
--- a/plugin/Makefile.mingw32.in
+++ b/plugin/Makefile.mingw32.in
@@ -47,6 +47,7 @@ DG_CFLAGS = -I@top_srcdir@ -I@top_srcdir@/include -I@top_srcdir@/src \
# -DDISABLE_HUGIN
GUI_SRC = \
+ @top_srcdir@/plugingui/abouttab.cc \
@top_srcdir@/plugingui/button.cc \
@top_srcdir@/plugingui/button_base.cc \
@top_srcdir@/plugingui/checkbox.cc \
diff --git a/plugingui/Makefile.am b/plugingui/Makefile.am
index 2be22fb..f6bd705 100644
--- a/plugingui/Makefile.am
+++ b/plugingui/Makefile.am
@@ -47,6 +47,7 @@ libdggui_la_LIBADD = \
# If you add a file here, remember to add it to plugin/Makefile.mingw32.in
nodist_libdggui_la_SOURCES = \
+ abouttab.cc \
button.cc \
button_base.cc \
checkbox.cc \
diff --git a/plugingui/abouttab.cc b/plugingui/abouttab.cc
new file mode 100644
index 0000000..ffbe12a
--- /dev/null
+++ b/plugingui/abouttab.cc
@@ -0,0 +1,96 @@
+/* -*- Mode: c++ -*- */
+/***************************************************************************
+ * abouttab.cc
+ *
+ * Fri Apr 21 18:51:13 CEST 2017
+ * Copyright 2017 André Nusser
+ * andre.nusser@googlemail.com
+ ****************************************************************************/
+
+/*
+ * This file is part of DrumGizmo.
+ *
+ * DrumGizmo is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * DrumGizmo is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with DrumGizmo; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+#include "abouttab.h"
+
+#include <version.h>
+
+#include "utf8.h"
+
+namespace GUI
+{
+
+AboutTab::AboutTab(Widget* parent)
+ : Widget(parent)
+{
+ text_edit.setText(getAboutText());
+ text_edit.setReadOnly(true);
+ text_edit.resize(width() - 2*margin, height() - 2*margin);
+ text_edit.move(margin, margin);
+}
+
+void AboutTab::resize(std::size_t width, std::size_t height)
+{
+ Widget::resize(width, height);
+ text_edit.resize(width - 2*margin, height - 2*margin);
+}
+
+std::string AboutTab::getAboutText()
+{
+ std::string about_text;
+
+ // About
+ about_text.append(
+ "=============\n"
+ " About\n"
+ "=============\n"
+ "\n");
+ about_text.append(about.data());
+
+ // Version
+ about_text.append(
+ "\n"
+ "\n"
+ "=============\n"
+ " Version\n"
+ "=============\n"
+ "\n");
+ about_text.append(std::string(VERSION) + "\n");
+
+ // Authors
+ about_text.append(
+ "\n"
+ "\n"
+ "=============\n"
+ " Authors\n"
+ "=============\n"
+ "\n");
+ about_text.append(UTF8().toLatin1(authors.data()));
+
+ // GPL
+ about_text.append(
+ "\n"
+ "\n"
+ "=============\n"
+ " License\n"
+ "=============\n"
+ "\n");
+ about_text.append(gpl.data());
+
+ return about_text;
+}
+
+} // GUI::
diff --git a/plugingui/abouttab.h b/plugingui/abouttab.h
new file mode 100644
index 0000000..556b5bb
--- /dev/null
+++ b/plugingui/abouttab.h
@@ -0,0 +1,58 @@
+/* -*- Mode: c++ -*- */
+/***************************************************************************
+ * abouttab.h
+ *
+ * Fri Apr 21 18:51:13 CEST 2017
+ * Copyright 2017 André Nusser
+ * andre.nusser@googlemail.com
+ ****************************************************************************/
+
+/*
+ * This file is part of DrumGizmo.
+ *
+ * DrumGizmo is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * DrumGizmo is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with DrumGizmo; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+#pragma once
+
+#include "widget.h"
+#include "resource.h"
+#include "textedit.h"
+
+#include <string>
+
+namespace GUI
+{
+
+class AboutTab
+ : public Widget
+{
+public:
+ AboutTab(Widget* parent);
+
+ // From Widget:
+ void resize(std::size_t width, std::size_t height) override;
+
+private:
+ std::string getAboutText();
+
+ TextEdit text_edit{this};
+ std::size_t margin{10};
+
+ Resource about{":../ABOUT"};
+ Resource authors{":../AUTHORS"};
+ Resource gpl{":../COPYING"};
+};
+
+} // GUI::
diff --git a/plugingui/mainwindow.cc b/plugingui/mainwindow.cc
index c8cfb71..071bafe 100644
--- a/plugingui/mainwindow.cc
+++ b/plugingui/mainwindow.cc
@@ -30,7 +30,6 @@
#include <version.h>
#include "painter.h"
-#include "utf8.h"
#include <string>
@@ -50,12 +49,8 @@ MainWindow::MainWindow(Settings& settings, void* native_window)
setCaption("DrumGizmo v" VERSION);
tabs.move(16, 0); // x-offset to make room for the left side bar.
-
tabs.addTab("Main", &main_tab);
- tabs.addTab("About", &about_text_field);
-
- about_text_field.setText(getAboutText());
- about_text_field.setReadOnly(true);
+ tabs.addTab("About", &about_tab);
}
MainWindow::~MainWindow()
@@ -129,49 +124,4 @@ void MainWindow::closeEventHandler()
closing = true;
}
-std::string MainWindow::getAboutText()
-{
- std::string about_text;
-
- // About
- about_text.append(
- "=============\n"
- " About\n"
- "=============\n"
- "\n");
- about_text.append(about.data());
-
- // Version
- about_text.append(
- "\n"
- "\n"
- "=============\n"
- " Version\n"
- "=============\n"
- "\n");
- about_text.append(std::string(VERSION) + "\n");
-
- // Authors
- about_text.append(
- "\n"
- "\n"
- "=============\n"
- " Authors\n"
- "=============\n"
- "\n");
- about_text.append(UTF8().toLatin1(authors.data()));
-
- // GPL
- about_text.append(
- "\n"
- "\n"
- "=============\n"
- " License\n"
- "=============\n"
- "\n");
- about_text.append(gpl.data());
-
- return about_text;
-}
-
} // GUI::
diff --git a/plugingui/mainwindow.h b/plugingui/mainwindow.h
index cd2eb1f..7f95794 100644
--- a/plugingui/mainwindow.h
+++ b/plugingui/mainwindow.h
@@ -28,9 +28,8 @@
#include <settings.h>
-#include "frame.h"
+#include "abouttab.h"
#include "image.h"
-#include "textedit.h"
#include "tabwidget.h"
#include "texturedbox.h"
#include "window.h"
@@ -62,15 +61,12 @@ private:
// From Widget
void repaintEvent(RepaintEvent* repaintEvent) override final;
- std::string getAboutText();
-
- TabWidget tabs{this};
-
Config config;
SettingsNotifier settings_notifier;
+ TabWidget tabs{this};
MainTab main_tab;
- TextEdit about_text_field{&tabs};
+ AboutTab about_tab{&tabs};
Image back{":resources/bg.png"};
Image logo{":resources/logo.png"};
@@ -87,10 +83,6 @@ private:
bool closing{false};
- Resource about{":../ABOUT"};
- Resource authors{":../AUTHORS"};
- Resource gpl{":../COPYING"};
-
Font font;
};