Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wxFormBuilder project #72

Merged
merged 26 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f674e09
Initial wxFormBuilder project with only MainFrame implemented.
krazkidd Aug 10, 2024
bb30266
Add initial wxFormBuilder-generated files.
krazkidd Aug 10, 2024
0310935
Add wxFormBuilder files to CMake project.
krazkidd Aug 10, 2024
c9269c2
Clean up base MainFrame config.
krazkidd Aug 11, 2024
84c86ad
Remove positions grid in favor of old PortfolioPanel as a custom cont…
krazkidd Aug 11, 2024
0b81d54
Derive MainFrame class from new base MainFrame class.
krazkidd Aug 11, 2024
d67ffeb
Add wxFormBuilder-generated code to VS Code Intellisense.
krazkidd Aug 11, 2024
4d5d81f
Fix runtime issue with control hierarchy.
krazkidd Aug 11, 2024
521a4bf
Remove broken balance field (for now) because the custom PortfolioPan…
krazkidd Aug 11, 2024
77ba031
Don't hardcode main frame title.
krazkidd Aug 11, 2024
780a0e6
Add base LoginDialog to wxFormBuilder project.
krazkidd Aug 11, 2024
68287c8
Remove superfluous panel from LoginDialog.
krazkidd Aug 11, 2024
bf42798
Add ExchangeAnnouncementsDialog to wxFormBuilder project.
krazkidd Aug 11, 2024
f690680
Add ExchangeStatusDialog to wxFormBuilder project.
krazkidd Aug 11, 2024
293c56a
Add ExchangeScheduleDialog to wxFormBuilderProject.
krazkidd Aug 11, 2024
c002935
Remove hard-coded title for ExchangeStatusDialog.
krazkidd Aug 11, 2024
0c45a63
Cleanup.
krazkidd Aug 11, 2024
ce1c14a
Cleanup.
krazkidd Aug 11, 2024
453f07e
Center align standard buttons.
krazkidd Aug 11, 2024
d6c120b
Add note in README about wxFormBuilder.
krazkidd Aug 11, 2024
56317eb
Cleanup.
krazkidd Aug 11, 2024
e550cd8
Add new wxFormBuilder project for custom control.
krazkidd Aug 11, 2024
6dda770
Base PortfolioPanel on new wxFormBuilder-generated type.
krazkidd Aug 11, 2024
1145656
Merge BalancePanel component into PortfolioPanel.
krazkidd Aug 11, 2024
a29305b
Merge EventPositionPanel and MarketPositionPanel components into Port…
krazkidd Aug 11, 2024
311dc13
Cleanup.
krazkidd Aug 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"name": "Linux",
"includePath": [
"${workspaceFolder}/include/**",
"${workspaceFolder}/src/wxfb/**",
"${workspaceFolder}/build/vcpkg_installed/x64-linux/include/**",
"/usr/lib/x86_64-linux-gnu/wx/include/gtk3-unicode-3.2",
"/usr/include/wx-3.2"
Expand Down
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ vcpkg is designed to statically compile programs and makes it difficult to rely

However, a number of build tools are required to be present on the system. A `Dockerfile` documents which packages must be installed to acquire the necessary tools on a Debian-based system. You may install these directly or use the Docker-based build.

### Design Tools

This project makes use of [wxFormBuilder](https://github.com/wxFormBuilder/wxFormBuilder) for rapid UI iteration. The project file and generated classes can be found under `src/wxfb`.

## Build Steps

> [!NOTE]
Expand Down Expand Up @@ -99,16 +103,6 @@ For subsequent builds, vcpkg will make use of the binary cache under `$(pwd)/bui
> [!WARNING]
> This is the default vcpkg binary cache directory for this project. If your host system is Debian 12 (Bookworm), it should be safe to bind-mount this directory and share installed dependencies with the container. Users on other systems wishing to build with and without Docker may want to bind-mount to a different host directory (although builds targeting different system triplets can coexist).

## Design Tools

This project is **not yet** making use of wxWidgets' XRC support. In the future, one of the following design tools will be recommended for work on the kdeck project:

* codeblocks
* codelite
* wxglade

**Suggestions are welcome.**

## Kalshi API

Kalshi provides a [REST API](https://trading-api.readme.io/reference/getting-started) for getting portfolio information and making trades, among other things. kdeck uses the [Oat++](https://oatpp.io/) library to make API requests[^1].
Expand Down
26 changes: 0 additions & 26 deletions include/ui/BalancePanel.hpp

This file was deleted.

25 changes: 0 additions & 25 deletions include/ui/EventPositionPanel.hpp

This file was deleted.

12 changes: 4 additions & 8 deletions include/ui/ExchangeAnnouncementsDialog.hpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
#ifndef EXCHANGEANNOUNCEMENTDIALOG_HPP

Check notice on line 1 in include/ui/ExchangeAnnouncementsDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

Run clang-format on include/ui/ExchangeAnnouncementsDialog.hpp

File include/ui/ExchangeAnnouncementsDialog.hpp does not conform to LLVM style guidelines. (lines 8, 9, 10, 12, 13, 14, 15, 17, 19)
#define EXCHANGEANNOUNCEMENTDIALOG_HPP

#include <wx/wx.h>

Check failure on line 4 in include/ui/ExchangeAnnouncementsDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/ExchangeAnnouncementsDialog.hpp:4:10 [clang-diagnostic-error]

'wx/wx.h' file not found

#include "App.h" // wxfb

namespace kdeck
{
class Api;

class ExchangeAnnouncementsDialog : public wxDialog
class ExchangeAnnouncementsDialog : public wxfb::ExchangeAnnouncementsDialog
{
public:
ExchangeAnnouncementsDialog(wxWindow* parent, wxWindowID winid = wxID_ANY, const wxString &title = "Exchange Announcements");
ExchangeAnnouncementsDialog(wxWindow* parent, wxWindowID winid = wxID_ANY);

void UpdateStuff(Api* api);

private:
wxBoxSizer* boxSizer;

// init
void Setup();
};
}

Expand Down
20 changes: 4 additions & 16 deletions include/ui/ExchangeScheduleDialog.hpp
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
#ifndef EXCHANGESCHEDULEDIALOG_HPP

Check notice on line 1 in include/ui/ExchangeScheduleDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

Run clang-format on include/ui/ExchangeScheduleDialog.hpp

File include/ui/ExchangeScheduleDialog.hpp does not conform to LLVM style guidelines. (lines 8, 9, 10, 12, 13, 14, 15, 17, 19)
#define EXCHANGESCHEDULEDIALOG_HPP

#include <wx/wx.h>

Check failure on line 4 in include/ui/ExchangeScheduleDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/ExchangeScheduleDialog.hpp:4:10 [clang-diagnostic-error]

'wx/wx.h' file not found

#include "App.h" // wxfb

namespace kdeck
{
class Api;

class ExchangeScheduleDialog : public wxDialog
class ExchangeScheduleDialog : public wxfb::ExchangeScheduleDialog
{
public:
ExchangeScheduleDialog(wxWindow* parent, wxWindowID winid = wxID_ANY, const wxString &title = "Exchange Schedule");
ExchangeScheduleDialog(wxWindow* parent, wxWindowID winid = wxID_ANY);

void UpdateStuff(Api* api);

private:
wxStaticText* lblSundaySchedule;
wxStaticText* lblMondaySchedule;
wxStaticText* lblTuesdaySchedule;
wxStaticText* lblWednesdaySchedule;
wxStaticText* lblThursdaySchedule;
wxStaticText* lblFridaySchedule;
wxStaticText* lblSaturdaySchedule;

wxBoxSizer* boxSizer;

// init
void Setup();
};
}

Expand Down
13 changes: 4 additions & 9 deletions include/ui/ExchangeStatusDialog.hpp
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
#ifndef EXCHANGESTATUSDIALOG_HPP

Check notice on line 1 in include/ui/ExchangeStatusDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

Run clang-format on include/ui/ExchangeStatusDialog.hpp

File include/ui/ExchangeStatusDialog.hpp does not conform to LLVM style guidelines. (lines 8, 9, 10, 12, 13, 14, 15, 17, 19)
#define EXCHANGESTATUSDIALOG_HPP

#include <wx/wx.h>

Check failure on line 4 in include/ui/ExchangeStatusDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/ExchangeStatusDialog.hpp:4:10 [clang-diagnostic-error]

'wx/wx.h' file not found

#include "App.h" // wxfb

namespace kdeck
{
class Api;

class ExchangeStatusDialog : public wxDialog
class ExchangeStatusDialog : public wxfb::ExchangeStatusDialog
{
public:
ExchangeStatusDialog(wxWindow* parent, wxWindowID winid = wxID_ANY, const wxString &title = "Exchange Status");
ExchangeStatusDialog(wxWindow* parent, wxWindowID winid = wxID_ANY);

void UpdateStuff(Api* api);

private:
wxStaticText* lblExchangeStatus;
wxStaticText* lblTradingStatus;

// init
void Setup();
};
}

Expand Down
14 changes: 4 additions & 10 deletions include/ui/LoginDialog.hpp
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
#ifndef LOGINDIALOG_HPP

Check notice on line 1 in include/ui/LoginDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

Run clang-format on include/ui/LoginDialog.hpp

File include/ui/LoginDialog.hpp does not conform to LLVM style guidelines. (lines 8, 9, 10, 12, 13, 14, 15, 17, 19, 20, 22, 24)
#define LOGINDIALOG_HPP

#include <wx/wx.h>

Check failure on line 4 in include/ui/LoginDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/LoginDialog.hpp:4:10 [clang-diagnostic-error]

'wx/wx.h' file not found

#include "App.h" // wxfb

namespace kdeck
{
class Config;

class LoginDialog : public wxDialog
class LoginDialog : public wxfb::LoginDialog
{
public:
LoginDialog(wxWindow* parent, wxWindowID winid = wxID_ANY, const wxString &title = "Login");
LoginDialog(wxWindow* parent, wxWindowID winid = wxID_ANY);

void UpdateStuff(const Config* config);

std::string GetEmail() const;

Check warning on line 19 in include/ui/LoginDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/LoginDialog.hpp:19:21 [modernize-use-trailing-return-type]

use a trailing return type for this function
std::string GetPassword() const;

Check warning on line 20 in include/ui/LoginDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/LoginDialog.hpp:20:21 [modernize-use-trailing-return-type]

use a trailing return type for this function

bool GetRememberMe() const;

Check warning on line 22 in include/ui/LoginDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/LoginDialog.hpp:22:14 [modernize-use-trailing-return-type]

use a trailing return type for this function

private:
wxTextCtrl* txtEmail;
wxTextCtrl* txtPassword;
wxCheckBox* chkRememberMe;

// init
void Setup();
};
}

Expand Down
28 changes: 7 additions & 21 deletions include/ui/MainFrame.hpp
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
#ifndef MAINFRAME_HPP

Check notice on line 1 in include/ui/MainFrame.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

Run clang-format on include/ui/MainFrame.hpp

File include/ui/MainFrame.hpp does not conform to LLVM style guidelines. (lines 8, 12, 13, 14, 15, 16, 17, 19, 21, 22, 23, 24, 26, 28, 29, 31, 32, 33, 34, 35, 36, 38, 40, 41, 42, 43, 44, 45, 47)
#define MAINFRAME_HPP

#include <wx/wx.h>

Check failure on line 4 in include/ui/MainFrame.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/MainFrame.hpp:4:10 [clang-diagnostic-error]

'wx/wx.h' file not found

#include "App.h" // wxfb

#include "app_config.hpp"
#include "api/Api.hpp"
#include "config/Config.hpp"

namespace kdeck
{
class PortfolioPanel;

enum
{
ID_Login = wxID_HIGHEST + 1,
ID_Logout = wxID_HIGHEST + 2,
ID_Exchange_Announcements = wxID_HIGHEST + 3,
ID_Exchange_Schedule = wxID_HIGHEST + 4,
ID_Exchange_Status = wxID_HIGHEST + 5,
ID_View_ShowClosedPositions = wxID_HIGHEST + 6,
};

class MainFrame : public wxFrame
class MainFrame : public wxfb::MainFrame
{
public:
MainFrame(wxWindow* parent = nullptr, wxWindowID winid = wxID_ANY, const wxString &title = std::string{kProjectName});
Expand All @@ -33,11 +23,7 @@
Config config;
Api api;

wxMenuItem *mnuLogin;
wxMenuItem *mnuLogout;
wxMenuItem *mnuShowClosedPositions;

PortfolioPanel* pnlPortfolio;
bool isLoginDialogShownOnce = false;

// init
void Setup();
Expand All @@ -54,9 +40,9 @@
// event handlers
void OnLoginOrLogout(wxCommandEvent& event);
void OnApiError(wxCommandEvent& event);
void OnIdleRunOnce(wxIdleEvent& event);
void OnMenuItemSelected(wxCommandEvent& event);
void OnClose(wxCloseEvent& event);
void OnShow(wxShowEvent &event) override;
void OnMenuItemSelected(wxCommandEvent& event) override;
void OnClose(wxCloseEvent& event) override;
};
}

Expand Down
25 changes: 0 additions & 25 deletions include/ui/MarketPositionPanel.hpp

This file was deleted.

12 changes: 3 additions & 9 deletions include/ui/PortfolioPanel.hpp
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
#ifndef PORTFOLIOPANEL_HPP

Check notice on line 1 in include/ui/PortfolioPanel.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

Run clang-format on include/ui/PortfolioPanel.hpp

File include/ui/PortfolioPanel.hpp does not conform to LLVM style guidelines. (lines 8, 9, 10, 11, 13, 14, 15, 16, 18, 20)
#define PORTFOLIOPANEL_HPP

#include <wx/wx.h>

Check failure on line 4 in include/ui/PortfolioPanel.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/PortfolioPanel.hpp:4:10 [clang-diagnostic-error]

'wx/wx.h' file not found

#include "PortfolioPanel.h" // wxfb

namespace kdeck
{
class Api;
class BalancePanel;
class Config;

class PortfolioPanel : public wxScrolledWindow
class PortfolioPanel : public wxfb::PortfolioPanel
{
public:
PortfolioPanel(wxWindow* parent, wxWindowID winid = wxID_ANY);

void UpdateStuff(const Config* config, Api* api);

private:
BalancePanel* pnlBalance;
wxPanel* pnlPositions;

// init
void Setup();
};
}

Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ target_link_libraries(${PROJECT_NAME}
add_subdirectory(api)
add_subdirectory(config)
add_subdirectory(ui)
add_subdirectory(wxfb)
59 changes: 0 additions & 59 deletions src/ui/BalancePanel.cpp

This file was deleted.

Loading
Loading