mirror of
https://github.com/PurpleI2P/i2pd
synced 2025-10-05 23:52:50 +02:00
Initial Haiku UI added
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2024, The PurpleI2P Project
|
||||
* Copyright (c) 2013-2025, The PurpleI2P Project
|
||||
*
|
||||
* This file is part of Purple i2pd project and licensed under BSD3
|
||||
*
|
||||
@@ -118,8 +118,8 @@ namespace util
|
||||
if (logclftime)
|
||||
i2p::log::Logger().SetTimeFormat ("[%d/%b/%Y:%H:%M:%S %z]");
|
||||
|
||||
#ifdef WIN32_APP
|
||||
// Win32 app with GUI supports only logging to file
|
||||
#if defined(WIN32_APP) || defined(__HAIKU__)
|
||||
// Win32 app with GUI or Haiku supports only logging to file
|
||||
logs = "file";
|
||||
#else
|
||||
if (isDaemon && (logs == "" || logs == "stdout"))
|
||||
|
@@ -98,7 +98,6 @@ namespace util
|
||||
}
|
||||
};
|
||||
#else // Unix-like systems, including Linux
|
||||
#define Daemon i2p::util::DaemonUnix::Instance()
|
||||
class DaemonUnix : public Daemon_Singleton
|
||||
{
|
||||
public:
|
||||
@@ -122,6 +121,24 @@ namespace util
|
||||
|
||||
int gracefulShutdownInterval; // in seconds
|
||||
};
|
||||
#if !defined(__HAIKU__)
|
||||
#define Daemon i2p::util::DaemonUnix::Instance()
|
||||
#else
|
||||
class DaemonHaiku: public DaemonUnix
|
||||
{
|
||||
public:
|
||||
|
||||
static DaemonHaiku& Instance ()
|
||||
{
|
||||
static DaemonHaiku instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void run ();
|
||||
};
|
||||
#define Daemon i2p::util::DaemonHaiku::Instance()
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
67
daemon/HaikuDaemon.cpp
Normal file
67
daemon/HaikuDaemon.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2025, The PurpleI2P Project
|
||||
*
|
||||
* This file is part of Purple i2pd project and licensed under BSD3
|
||||
*
|
||||
* See full license text in LICENSE file at top of project tree
|
||||
*/
|
||||
|
||||
#if defined(__HAIKU__)
|
||||
|
||||
#include "Daemon.h"
|
||||
|
||||
#include <MenuItem.h>
|
||||
#include <MenuBar.h>
|
||||
#include <Window.h>
|
||||
#include <Application.h>
|
||||
|
||||
class MainWindow: public BWindow
|
||||
{
|
||||
public:
|
||||
MainWindow ();
|
||||
};
|
||||
|
||||
class I2PApp: public BApplication
|
||||
{
|
||||
public:
|
||||
I2PApp ();
|
||||
};
|
||||
|
||||
MainWindow::MainWindow ():
|
||||
BWindow (BRect(100, 100, 500, 400), "i2pd", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE)
|
||||
{
|
||||
auto r = Bounds (); r.bottom = 20;
|
||||
auto menuBar = new BMenuBar (r, "menubar");
|
||||
AddChild (menuBar);
|
||||
auto runMenu = new BMenu ("Run");
|
||||
runMenu->AddItem (new BMenuItem ("Quit", new BMessage (B_QUIT_REQUESTED), 'Q'));
|
||||
menuBar->AddItem (runMenu);
|
||||
}
|
||||
|
||||
I2PApp::I2PApp (): BApplication("application/x-vnd.purplei2p-i2pd")
|
||||
{
|
||||
auto mainWindow = new MainWindow ();
|
||||
mainWindow->Show ();
|
||||
}
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
namespace util
|
||||
{
|
||||
void DaemonHaiku::run ()
|
||||
{
|
||||
if (isDaemon)
|
||||
DaemonUnix::run ();
|
||||
else
|
||||
{
|
||||
I2PApp app;
|
||||
app.Run ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user