mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-10-17 09:10:21 +01:00
show some stats in the main window
Some checks are pending
Build Debian packages / bookworm (push) Waiting to run
Build Debian packages / bullseye (push) Waiting to run
Build Debian packages / trixie (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=no (push) Waiting to run
Build on OSX / With USE_UPNP=yes (push) Waiting to run
Build on Windows / ucrt-x86_64 (push) Waiting to run
Build on Windows / clang-x86_64 (push) Waiting to run
Build on Windows / i686 (push) Waiting to run
Build on Windows / x86_64 (push) Waiting to run
Build on Windows / CMake clang-x86_64 (push) Waiting to run
Build on Windows / CMake i686 (push) Waiting to run
Build on Windows / CMake ucrt-x86_64 (push) Waiting to run
Build on Windows / CMake x86_64 (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=no (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=yes (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Waiting to run
Build containers / Building container for linux/amd64 (push) Waiting to run
Build containers / Building container for linux/arm64 (push) Waiting to run
Build containers / Building container for linux/arm/v7 (push) Waiting to run
Build containers / Building container for linux/386 (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions
Some checks are pending
Build Debian packages / bookworm (push) Waiting to run
Build Debian packages / bullseye (push) Waiting to run
Build Debian packages / trixie (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=no (push) Waiting to run
Build on OSX / With USE_UPNP=yes (push) Waiting to run
Build on Windows / ucrt-x86_64 (push) Waiting to run
Build on Windows / clang-x86_64 (push) Waiting to run
Build on Windows / i686 (push) Waiting to run
Build on Windows / x86_64 (push) Waiting to run
Build on Windows / CMake clang-x86_64 (push) Waiting to run
Build on Windows / CMake i686 (push) Waiting to run
Build on Windows / CMake ucrt-x86_64 (push) Waiting to run
Build on Windows / CMake x86_64 (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=no (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=yes (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Waiting to run
Build containers / Building container for linux/amd64 (push) Waiting to run
Build containers / Building container for linux/arm64 (push) Waiting to run
Build containers / Building container for linux/arm/v7 (push) Waiting to run
Build containers / Building container for linux/386 (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions
This commit is contained in:
parent
5a5ba9be35
commit
ef90e978e7
1 changed files with 33 additions and 0 deletions
|
@ -12,6 +12,8 @@
|
|||
#include <string>
|
||||
#include <MenuItem.h>
|
||||
#include <MenuBar.h>
|
||||
#include <StringView.h>
|
||||
#include <Font.h>
|
||||
#include <MessageRunner.h>
|
||||
#include <Window.h>
|
||||
#include <Application.h>
|
||||
|
@ -29,6 +31,16 @@ constexpr int C_GRACEFUL_SHUTDOWN_UPDATE = 2;
|
|||
constexpr bigtime_t GRACEFUL_SHUTDOWN_UPDATE_INTERVAL = 1000*1000; // in microseconds
|
||||
constexpr int GRACEFUL_SHUTDOWN_UPDATE_COUNT = 600; // 10 minutes
|
||||
|
||||
class MainWindowView: public BStringView
|
||||
{
|
||||
public:
|
||||
MainWindowView (BRect r);
|
||||
|
||||
private:
|
||||
void Draw (BRect updateRect) override;
|
||||
|
||||
};
|
||||
|
||||
class MainWindow: public BWindow
|
||||
{
|
||||
public:
|
||||
|
@ -48,6 +60,24 @@ class I2PApp: public BApplication
|
|||
I2PApp ();
|
||||
};
|
||||
|
||||
MainWindowView::MainWindowView (BRect r):
|
||||
BStringView (r, nullptr, nullptr, B_FOLLOW_ALL, B_WILL_DRAW)
|
||||
{
|
||||
SetViewColor (255, 255, 255);
|
||||
SetHighColor (0xD4, 0x3B, 0x69);
|
||||
BFont font = *be_plain_font;
|
||||
font.SetSize (12);
|
||||
SetFont (&font);
|
||||
}
|
||||
|
||||
void MainWindowView::Draw (BRect updateRect)
|
||||
{
|
||||
std::stringstream s;
|
||||
i2p::util::PrintMainWindowText (s);
|
||||
SetText (s.str ().c_str ());
|
||||
BStringView::Draw (updateRect);
|
||||
}
|
||||
|
||||
MainWindow::MainWindow ():
|
||||
BWindow (BRect(100, 100, 500, 400), "i2pd " VERSION, B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE),
|
||||
m_Messenger (nullptr, this)
|
||||
|
@ -59,6 +89,9 @@ MainWindow::MainWindow ():
|
|||
runMenu->AddItem (new BMenuItem ("Graceful shutdown", new BMessage (M_GRACEFUL_SHUTDOWN), 'G'));
|
||||
runMenu->AddItem (new BMenuItem ("Quit", new BMessage (B_QUIT_REQUESTED), 'Q'));
|
||||
menuBar->AddItem (runMenu);
|
||||
r = Bounds (); r.left = 20; r.top = 21;
|
||||
auto view = new MainWindowView (r);
|
||||
AddChild (view);
|
||||
}
|
||||
|
||||
void MainWindow::MessageReceived (BMessage * msg)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue