summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Base/res/welcome.txt64
-rw-r--r--Base/usr/share/man/man5/Welcome.md46
-rwxr-xr-xMeta/build-root-filesystem.sh1
-rw-r--r--Userland/Applications/CMakeLists.txt1
-rw-r--r--Userland/Applications/Welcome/BackgroundWidget.cpp52
-rw-r--r--Userland/Applications/Welcome/BackgroundWidget.h41
-rw-r--r--Userland/Applications/Welcome/CMakeLists.txt9
-rw-r--r--Userland/Applications/Welcome/TextWidget.cpp140
-rw-r--r--Userland/Applications/Welcome/TextWidget.h65
-rw-r--r--Userland/Applications/Welcome/UnuncheckableButton.cpp35
-rw-r--r--Userland/Applications/Welcome/UnuncheckableButton.h40
-rw-r--r--Userland/Applications/Welcome/main.cpp234
12 files changed, 0 insertions, 728 deletions
diff --git a/Base/res/welcome.txt b/Base/res/welcome.txt
deleted file mode 100644
index 410b3755d7..0000000000
--- a/Base/res/welcome.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-* Welcome
-$ /res/icons/16x16/ladybug.png
-> Welcome, friends, to SerenityOS!
-Welcome to the exciting new world of Serenity, where the year is 1998 and the
-leading OS vendor has decided to merge their flagship product with a Unix-like
-kernel.
-
-Sit back and relax as you take a brief tour of the options available on this
-screen.
-
-If you want to explore an option, just click it.
-
-* Registration
-$ /res/icons/16x16/book.png
-> Register now!
-Registering your copy of Serenity opens the doors to full integration of
-Serenity into your life, your being, and your soul.
-
-By registering Serenity, you enter into the draw to win a lifetime supply of
-milk, delivered fresh each day by a mystical horse wearing a full tuxedo.
-
-To register, simply write your contact details on a piece of paper and hold it
-up to your monitor.
-
-* Internet
-$ /res/icons/16x16/filetype-html.png
-> Connect to the Internet!
-On the Internet, you can correspond through electronic mail (e-mail), get the
-latest news and financial information, and visit Web sites around the world,
-most of which will make you really angry.
-
-Serenity includes several internet applications, such as an IRC (Internet relay
-chat) client, WWW browser, telnet server, and basic utilities like ping.
-
-Come chat with us today! How bad can it be?
-
-* Fun & Games
-$ /res/icons/16x16/app-snake.png
-> Play some games!
-Serenity includes several games built right into the base system. These include
-the classic game Snake and the anti-productivity mainstay Minesweeper.
-
-With a little extra effort, you can even play the original id Software hit DOOM,
-albeit without sound. No sound just means you won't alert your boss, so it's
-more of a feature than a limitation.
-
-* Development
-$ /res/icons/16x16/app-hack-studio.png
-> Develop new applications!
-Serenity includes several development tools to enable you to create new
-applications for Serenity. You can build a new graphical tool, craft a new
-server, hack on a kernel, hammer the browser... the possibilities are endless!
-
-This is all possibly by using HackStudio, Terminal, and the (optional) GNU tools.
-
-* Multimedia
-$ /res/icons/16x16/audio-volume-medium.png
-> Draw while playing your favorite songs!
-Serenity includes the Piano, which allows you to create your own tunes by
-simply pressing keys on the keyboard. You can pick the wavetype, octave, and
-more! Serenity also has SoundPlayer, which lets you play WAV files.
-
-Serenity also has PixelPaint, which is a layered bitmap editor. Draw with the
-pencil and change colors. Try drawing shapes! Can't do that in GIMP!
diff --git a/Base/usr/share/man/man5/Welcome.md b/Base/usr/share/man/man5/Welcome.md
deleted file mode 100644
index 5c553b976e..0000000000
--- a/Base/usr/share/man/man5/Welcome.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# Name
-Welcome - list of entries for the Welcome program
-
-# Synopsis
-`/res/welcome.txt`
-
-# Description
-Welcome's configuration file specifies the information that Welcome should show
-to new users to onboard them with the SerenityOS system. It is based on a simple
-line-by-line format.
-
-**All lines must be less than 4096 bytes in length.**
-
-# Contents
-The file consists of lines, where each line has two parts: a one-character
-specifier `$spec`, to indicate the type of line, and the remainder of the line
-`$rem`. The remainder may have a space removed from the beginning, meaning that
-you can use (for example) `* title` instead of `*title`.
-
-## Line Types
-Each line may be one of the following types:
-
-* `*` (menu item) - Finishes the previous page (if applicable) and starts a new page, identified in the menu as `$rem`.
-* `$` (icon) - Specifies the path to a PNG file to be used as the icon for the entry. The icon will always be displayed as 16x16.
-* `>` (title) - Specifies the title that will be displayed in bold above the text. The icon will be displayed to the left, if there is one.
-* `#` (comment) - Ignored.
-
-## Content
-All lines that are not one of the special types are considered content. These
-lines are merged together unless separated by a blank line.
-
-## Examples
-```
-# Create a new page 'Welcome'
-* Welcome
-# Set the icon to the Serenity ladybug
-$ /res/icons/16x16/ladybug.png
-# Set the page title to 'SerenityOS is great!'
-> SerenityOS is great!
-
-# Content goes here.
-SerenityOS is a project that was started by @awesomekling.
-Look, this will be put after that text!
-
-And this is a new paragraph! :D
-```
diff --git a/Meta/build-root-filesystem.sh b/Meta/build-root-filesystem.sh
index 977dff253b..339de30812 100755
--- a/Meta/build-root-filesystem.sh
+++ b/Meta/build-root-filesystem.sh
@@ -110,7 +110,6 @@ ln -s /bin/Browser mnt/home/anon/Desktop/
ln -s /bin/TextEditor mnt/home/anon/Desktop/
ln -s /bin/Help mnt/home/anon/Desktop/
ln -s /home/anon mnt/home/anon/Desktop/Home
-ln -s /bin/Welcome mnt/home/anon/Desktop/
echo "done"
printf "installing shortcuts... "
diff --git a/Userland/Applications/CMakeLists.txt b/Userland/Applications/CMakeLists.txt
index c89932e292..3713e43d80 100644
--- a/Userland/Applications/CMakeLists.txt
+++ b/Userland/Applications/CMakeLists.txt
@@ -24,4 +24,3 @@ add_subdirectory(SystemMonitor)
add_subdirectory(ThemeEditor)
add_subdirectory(Terminal)
add_subdirectory(TextEditor)
-add_subdirectory(Welcome)
diff --git a/Userland/Applications/Welcome/BackgroundWidget.cpp b/Userland/Applications/Welcome/BackgroundWidget.cpp
deleted file mode 100644
index c64f2fc93b..0000000000
--- a/Userland/Applications/Welcome/BackgroundWidget.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2020, the SerenityOS developers.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "BackgroundWidget.h"
-#include <LibGUI/Painter.h>
-#include <LibGfx/Color.h>
-#include <LibGfx/Palette.h>
-
-BackgroundWidget::BackgroundWidget()
-{
-}
-
-BackgroundWidget::~BackgroundWidget()
-{
-}
-
-void BackgroundWidget::paint_event(GUI::PaintEvent& event)
-{
- GUI::Frame::paint_event(event);
-
- GUI::Painter painter(*this);
- painter.add_clip_rect(event.rect());
- painter.fill_rect_with_gradient(event.rect(), Color::from_rgb(0xccdddd), Color::from_rgb(0xdcdcde));
-}
-
-void BackgroundWidget::resize_event(GUI::ResizeEvent& event)
-{
- GUI::Widget::resize_event(event);
-}
diff --git a/Userland/Applications/Welcome/BackgroundWidget.h b/Userland/Applications/Welcome/BackgroundWidget.h
deleted file mode 100644
index fea3871edc..0000000000
--- a/Userland/Applications/Welcome/BackgroundWidget.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2020, the SerenityOS developers.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <LibGUI/Frame.h>
-
-class BackgroundWidget : public GUI::Frame {
- C_OBJECT(BackgroundWidget)
-public:
- virtual ~BackgroundWidget() override;
-
-private:
- BackgroundWidget();
-
- virtual void paint_event(GUI::PaintEvent&) override;
- virtual void resize_event(GUI::ResizeEvent&) override;
-};
diff --git a/Userland/Applications/Welcome/CMakeLists.txt b/Userland/Applications/Welcome/CMakeLists.txt
deleted file mode 100644
index e9d1ef3380..0000000000
--- a/Userland/Applications/Welcome/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-set(SOURCES
- BackgroundWidget.cpp
- main.cpp
- TextWidget.cpp
- UnuncheckableButton.cpp
-)
-
-serenity_bin(Welcome)
-target_link_libraries(Welcome LibGUI)
diff --git a/Userland/Applications/Welcome/TextWidget.cpp b/Userland/Applications/Welcome/TextWidget.cpp
deleted file mode 100644
index 263d4514f8..0000000000
--- a/Userland/Applications/Welcome/TextWidget.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "TextWidget.h"
-#include <AK/Optional.h>
-#include <AK/String.h>
-#include <AK/StringBuilder.h>
-#include <AK/Vector.h>
-#include <LibGUI/Painter.h>
-#include <LibGfx/Font.h>
-#include <LibGfx/Palette.h>
-
-TextWidget::TextWidget(const StringView& text)
- : m_text(text)
-{
- set_frame_thickness(0);
- set_frame_shadow(Gfx::FrameShadow::Plain);
- set_frame_shape(Gfx::FrameShape::NoFrame);
-}
-
-TextWidget::~TextWidget()
-{
-}
-
-void TextWidget::set_text(const StringView& text)
-{
- if (text == m_text)
- return;
- m_text = text;
- wrap_and_set_height();
- update();
-}
-
-void TextWidget::paint_event(GUI::PaintEvent& event)
-{
- GUI::Frame::paint_event(event);
-
- GUI::Painter painter(*this);
- painter.add_clip_rect(event.rect());
-
- int indent = 0;
- if (frame_thickness() > 0)
- indent = font().glyph_width('x') / 2;
-
- for (size_t i = 0; i < m_lines.size(); i++) {
- auto& line = m_lines[i];
-
- auto text_rect = frame_inner_rect();
- text_rect.move_by(indent, i * m_line_height);
- if (!line.is_empty())
- text_rect.set_width(text_rect.width() - indent * 2);
-
- if (is_enabled()) {
- painter.draw_text(text_rect, line, m_text_alignment, palette().color(foreground_role()), Gfx::TextElision::None);
- } else {
- painter.draw_text(text_rect.translated(1, 1), line, font(), text_alignment(), Color::White, Gfx::TextElision::Right);
- painter.draw_text(text_rect, line, font(), text_alignment(), Color::from_rgb(0x808080), Gfx::TextElision::Right);
- }
- }
-}
-
-void TextWidget::resize_event(GUI::ResizeEvent& event)
-{
- wrap_and_set_height();
- GUI::Widget::resize_event(event);
-}
-
-void TextWidget::wrap_and_set_height()
-{
- Vector<String> words;
- Optional<size_t> start;
- for (size_t i = 0; i < m_text.length(); i++) {
- auto ch = m_text[i];
-
- if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n') {
- if (start.has_value())
- words.append(m_text.substring(start.value(), i - start.value()));
- start.clear();
- } else if (!start.has_value()) {
- start = i;
- }
- }
- if (start.has_value())
- words.append(m_text.substring(start.value(), m_text.length() - start.value()));
-
- auto rect = frame_inner_rect();
- if (frame_thickness() > 0)
- rect.set_width(rect.width() - font().glyph_width('x'));
-
- StringBuilder builder;
- Vector<String> lines;
- int line_width = 0;
- for (auto& word : words) {
- int word_width = font().width(word);
- if (line_width != 0)
- word_width += font().glyph_width('x');
-
- if (line_width + word_width > rect.width()) {
- lines.append(builder.to_string());
- builder.clear();
- line_width = 0;
- }
-
- if (line_width != 0)
- builder.append(' ');
- builder.append(word);
- line_width += word_width;
- }
- auto last_line = builder.to_string();
- if (!last_line.is_empty()) {
- lines.append(last_line);
- }
-
- m_lines = lines;
-
- set_fixed_height(m_lines.size() * m_line_height + frame_thickness() * 2);
-}
diff --git a/Userland/Applications/Welcome/TextWidget.h b/Userland/Applications/Welcome/TextWidget.h
deleted file mode 100644
index c4353096ff..0000000000
--- a/Userland/Applications/Welcome/TextWidget.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <AK/String.h>
-#include <AK/Vector.h>
-#include <LibGUI/Frame.h>
-#include <LibGfx/TextAlignment.h>
-
-class TextWidget : public GUI::Frame {
- C_OBJECT(TextWidget);
-
-public:
- virtual ~TextWidget() override;
-
- String text() const { return m_text; }
- void set_text(const StringView&);
-
- Gfx::TextAlignment text_alignment() const { return m_text_alignment; }
- void set_text_alignment(Gfx::TextAlignment text_alignment) { m_text_alignment = text_alignment; }
-
- bool should_wrap() const { return m_should_wrap; }
- void set_should_wrap(bool should_wrap) { m_should_wrap = should_wrap; }
-
- int line_height() const { return m_line_height; }
- void set_line_height(int line_height) { m_line_height = line_height; }
-
- void wrap_and_set_height();
-
-private:
- explicit TextWidget(const StringView& text = {});
-
- virtual void paint_event(GUI::PaintEvent&) override;
- virtual void resize_event(GUI::ResizeEvent&) override;
-
- String m_text;
- Vector<String> m_lines;
- Gfx::TextAlignment m_text_alignment { Gfx::TextAlignment::Center };
- bool m_should_wrap { false };
- int m_line_height { 0 };
-};
diff --git a/Userland/Applications/Welcome/UnuncheckableButton.cpp b/Userland/Applications/Welcome/UnuncheckableButton.cpp
deleted file mode 100644
index 29194fff81..0000000000
--- a/Userland/Applications/Welcome/UnuncheckableButton.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2020, the SerenityOS developers.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "UnuncheckableButton.h"
-
-UnuncheckableButton::UnuncheckableButton()
-{
-}
-
-UnuncheckableButton::~UnuncheckableButton()
-{
-}
diff --git a/Userland/Applications/Welcome/UnuncheckableButton.h b/Userland/Applications/Welcome/UnuncheckableButton.h
deleted file mode 100644
index b91a41ef9c..0000000000
--- a/Userland/Applications/Welcome/UnuncheckableButton.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2020, the SerenityOS developers.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <LibGUI/Button.h>
-
-class UnuncheckableButton : public GUI::Button {
- C_OBJECT(UnuncheckableButton)
-public:
- virtual ~UnuncheckableButton() override;
-
- virtual bool is_uncheckable() const override { return false; }
-
-private:
- UnuncheckableButton();
-};
diff --git a/Userland/Applications/Welcome/main.cpp b/Userland/Applications/Welcome/main.cpp
deleted file mode 100644
index f907f8d3e7..0000000000
--- a/Userland/Applications/Welcome/main.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "BackgroundWidget.h"
-#include "TextWidget.h"
-#include "UnuncheckableButton.h"
-#include <AK/ByteBuffer.h>
-#include <AK/Optional.h>
-#include <AK/String.h>
-#include <AK/StringBuilder.h>
-#include <AK/Vector.h>
-#include <LibCore/File.h>
-#include <LibGUI/Application.h>
-#include <LibGUI/BoxLayout.h>
-#include <LibGUI/Button.h>
-#include <LibGUI/ImageWidget.h>
-#include <LibGUI/Label.h>
-#include <LibGUI/MessageBox.h>
-#include <LibGUI/StackWidget.h>
-#include <LibGUI/Window.h>
-#include <LibGfx/Bitmap.h>
-#include <LibGfx/Font.h>
-#include <LibGfx/FontDatabase.h>
-#include <stdio.h>
-#include <unistd.h>
-
-struct ContentPage {
- String menu_name;
- String title;
- String icon = String::empty();
- Vector<String> content;
-};
-
-static Optional<Vector<ContentPage>> parse_welcome_file(const String& path)
-{
- auto file = Core::File::construct(path);
- if (!file->open(Core::IODevice::ReadOnly))
- return {};
-
- Vector<ContentPage> pages;
- StringBuilder current_output_line;
- bool started = false;
- ContentPage current;
- while (file->can_read_line()) {
- auto line = file->read_line();
- if (line.is_empty()) {
- if (!current_output_line.to_string().is_empty())
- current.content.append(current_output_line.to_string());
- current_output_line.clear();
- continue;
- }
- switch (line[0]) {
- case '*':
- dbgln("menu_item line:\t{}", line);
- if (started)
- pages.append(current);
- else
- started = true;
-
- current = {};
- current.menu_name = line.substring(2, line.length() - 2);
- break;
- case '$':
- dbgln("icon line: \t{}", line);
- current.icon = line.substring(2, line.length() - 2);
- break;
- case '>':
- dbgln("title line:\t{}", line);
- current.title = line.substring(2, line.length() - 2);
- break;
- case '#':
- dbgln("comment line:\t{}", line);
- break;
- default:
- dbgln("content line:\t", line);
- if (current_output_line.length() != 0)
- current_output_line.append(' ');
- current_output_line.append(line);
- break;
- }
- }
-
- if (started) {
- current.content.append(current_output_line.to_string());
- pages.append(current);
- }
-
- return pages;
-}
-
-int main(int argc, char** argv)
-{
- if (pledge("stdio recvfd sendfd rpath unix cpath fattr", nullptr) < 0) {
- perror("pledge");
- return 1;
- }
-
- auto app = GUI::Application::construct(argc, argv);
-
- if (pledge("stdio recvfd sendfd rpath", nullptr) < 0) {
- perror("pledge");
- return 1;
- }
-
- if (unveil("/res", "r") < 0) {
- perror("unveil");
- return 1;
- }
-
- unveil(nullptr, nullptr);
-
- Optional<Vector<ContentPage>> _pages = parse_welcome_file("/res/welcome.txt");
- if (!_pages.has_value()) {
- GUI::MessageBox::show(nullptr, "Could not open Welcome file.", "Welcome", GUI::MessageBox::Type::Error);
- return 1;
- }
- auto pages = _pages.value();
-
- auto window = GUI::Window::construct();
- window->set_title("Welcome");
- window->resize(640, 360);
- window->center_on_screen();
-
- auto& background = window->set_main_widget<BackgroundWidget>();
- background.set_fill_with_background_color(false);
- background.set_layout<GUI::VerticalBoxLayout>();
- background.layout()->set_margins({ 16, 8, 16, 8 });
- background.layout()->set_spacing(8);
-
- //
- // header
- //
-
- auto& header = background.add<GUI::Label>();
- header.set_font(Gfx::Font::load_from_file("/res/fonts/PebbletonBold14.font"));
- header.set_text("Welcome to SerenityOS!");
- header.set_text_alignment(Gfx::TextAlignment::CenterLeft);
- header.set_fixed_height(30);
-
- //
- // main section
- //
-
- auto& main_section = background.add<GUI::Widget>();
- main_section.set_layout<GUI::HorizontalBoxLayout>();
- main_section.layout()->set_margins({ 0, 0, 0, 0 });
- main_section.layout()->set_spacing(8);
-
- auto& menu = main_section.add<GUI::Widget>();
- menu.set_layout<GUI::VerticalBoxLayout>();
- menu.layout()->set_margins({ 0, 0, 0, 0 });
- menu.layout()->set_spacing(4);
- menu.set_fixed_width(100);
-
- auto& stack = main_section.add<GUI::StackWidget>();
-
- bool first = true;
- for (auto& page : pages) {
- auto& content = stack.add<GUI::Widget>();
- content.set_layout<GUI::VerticalBoxLayout>();
- content.layout()->set_margins({ 0, 0, 0, 0 });
- content.layout()->set_spacing(8);
-
- auto& title_box = content.add<GUI::Widget>();
- title_box.set_layout<GUI::HorizontalBoxLayout>();
- title_box.layout()->set_spacing(4);
- title_box.set_fixed_height(16);
-
- if (!page.icon.is_empty()) {
- auto& icon = title_box.add<GUI::ImageWidget>();
- icon.set_fixed_size(16, 16);
- icon.load_from_file(page.icon);
- }
-
- auto& content_title = title_box.add<GUI::Label>();
- content_title.set_font(Gfx::FontDatabase::default_bold_font());
- content_title.set_text(page.title);
- content_title.set_text_alignment(Gfx::TextAlignment::CenterLeft);
- content_title.set_fixed_height(10);
-
- for (auto& paragraph : page.content) {
- auto& content_text = content.add<TextWidget>();
- content_text.set_font(Gfx::FontDatabase::default_font());
- content_text.set_text(paragraph);
- content_text.set_text_alignment(Gfx::TextAlignment::TopLeft);
- content_text.set_line_height(12);
- content_text.wrap_and_set_height();
- }
-
- auto& menu_option = menu.add<UnuncheckableButton>();
- menu_option.set_font(Gfx::FontDatabase::default_font());
- menu_option.set_text(page.menu_name);
- menu_option.set_text_alignment(Gfx::TextAlignment::CenterLeft);
- menu_option.set_fixed_height(20);
- menu_option.set_checkable(true);
- menu_option.set_exclusive(true);
-
- if (first)
- menu_option.set_checked(true);
-
- menu_option.on_click = [content = &content, &stack](auto) {
- stack.set_active_widget(content);
- content->invalidate_layout();
- };
-
- first = false;
- }
-
- window->show();
- return app->exec();
-}