Skip to content

Galactic-FaaS/fortran-forge

 
 

Repository files navigation

ForGE Qt - Comprehensive Application Framework for Fortran

License: GPL v3 Fortran Status Version

ForGE Qt is a comprehensive, Qt-equivalent application framework for Fortran, providing everything from GUI widgets to networking, database access, and threading - all with a Fortran-native API.

🌟 The Fortran Version of Qt

ForGE Qt aims to bring Qt-level functionality to Fortran applications, including:

  • 50+ Widget Types (20 implemented, more coming)
  • Signals & Slots - Qt-style event handling ✅
  • QString & Containers - Advanced data structures ✅
  • Networking - HTTP client, TCP/UDP sockets ✅ API
  • Threading - QThread, mutexes, semaphores ✅ API
  • JSON/XML - Modern data formats ✅ API
  • Multi-Platform - Windows ✅, Linux (planned), macOS (planned), Platform-Agnostic ✅
  • ForgeML - Declarative UI language (planned)
  • Visual Designer - GUI builder tool (planned)

🌟 Features

  • Modern Fortran: Built with Fortran 2008/2018 features (OOP, abstract interfaces, submodules)
  • Cross-Platform: Runs on Linux, Windows, and macOS
  • Multiple Backends: Pluggable backend system (Custom GUI, Platform-Agnostic, Windows ✅, Linux/macOS planned)
  • Clean API: Intuitive, object-oriented interface with builder pattern support
  • Event-Driven: Comprehensive event handling system with Qt-style Signals & Slots
  • Flexible Layouts: Grid, Box, and Stack layout managers
  • Rich Widgets: 20+ widget types including buttons, checkboxes, comboboxes, menus, and more
  • Modern Build Systems: Support for both fpm and CMake
  • Well Documented: Extensive inline documentation and examples
  • Qt-Equivalent: Signals & Slots, QString, QList, QMap, networking, threading APIs

🚀 Quick Start

Installation

Using Fortran Package Manager (fpm)

# Clone the repository
git clone https://github.com/Galactic-FaaS/fortran-forge.git
cd fortran-forge

# Build with fpm
fpm build

# Run an example
fpm run --example hello_world

Using CMake

# Clone the repository
git clone https://github.com/Galactic-FaaS/fortran-forge.git
cd fortran-forge

# Configure and build
mkdir build
cd build
cmake ..
cmake --build .

# Run an example
./hello_world

Basic Usage

program my_gui_app
    use forge_qt
    implicit none

    type(QApplication) :: app
    type(QPushButton) :: button
    type(forge_connection) :: conn

    ! Initialize application
    call app%init()

    ! Create a button with Qt-style signals
    button = QPushButton()
    call button%set_label("Click Me!")

    ! Connect signal to slot
    conn = button%clicked%connect(on_button_clicked)

    ! Run the event loop
    call app%run()

contains
    subroutine on_button_clicked()
        print *, "Button was clicked!"
    end subroutine

end program my_gui_app

📚 Documentation

🏗️ Project Structure

fortran-forge/
├── src/                    # Library source code
│   ├── core/              # Core utilities
│   │   ├── forge_string_utils.f90  # QString implementation
│   │   ├── forge_containers.f90    # QList, QMap, QStack, QQueue
│   │   └── forge_json.f90          # JSON support
│   ├── gui/widgets/       # Widget implementations (20+ types)
│   │   ├── forge_checkbox.f90
│   │   ├── forge_combobox.f90
│   │   └── ... (18 more widgets)
│   ├── network/           # Networking stack
│   │   ├── forge_socket.f90        # TCP/UDP sockets
│   │   └── forge_http.f90          # HTTP client
│   ├── concurrent/        # Threading support
│   │   └── forge_thread.f90        # QThread, QMutex
│   ├── backends/custom/   # Custom GUI backend
│   │   ├── forge_platform_windows.f90  # Win32 integration ✅
│   │   ├── forge_platform_null.f90     # Platform-agnostic ✅
│   │   └── forge_rendering.f90         # Cairo 2D graphics
│   ├── forge_signals.f90  # Qt-style signals & slots ⭐
│   ├── forge_qt.f90       # Unified Qt module ⭐
│   └── ... (8 core modules)
├── examples/              # Example applications (7 working)
├── test/                  # Test suite (2 test files)
├── docs/                  # Documentation (16 files)
├── fpm.toml              # FPM manifest
└── CMakeLists.txt        # CMake configuration

🎨 Available Widgets

Basic Widgets (6)

  • Window: Main application window with title, size, position control
  • Button: Clickable buttons with event handlers
  • Label: Static text display
  • Entry: Single-line text input
  • TextView: Multi-line text editor
  • ProgressBar: Visual progress indicator

Input Widgets (5)

  • CheckBox: Check/uncheck with tristate support
  • RadioButton: Mutually exclusive selection with button groups
  • ComboBox: Dropdown selection with editable option
  • SpinBox: Integer/double numeric input with increment/decrement
  • Slider: Value selection slider (horizontal/vertical)

Container Widgets (3)

  • GroupBox: Titled frame for grouping controls
  • TabWidget: Tabbed interface for multiple pages
  • ScrollArea: Scrollable container for large content

Menu System (3)

  • MenuBar: Application menu bar
  • Menu: Popup menus with submenus
  • Action: Menu items with shortcuts and checkable states

Item Views (2)

  • ListView: Model-view list widget
  • ListWidget: Simple list widget

Dialogs (1)

  • MessageBox: Standard dialogs (Information, Warning, Error, Question)

Other (1)

  • StatusBar: Status messages and widget display
  • Separator: Visual divider (horizontal/vertical)

Total: 20 widget types implemented!

📦 Examples

Hello World

fpm run --example hello_world

Creates a simple window with a label.

Button Demo

fpm run --example button_demo

Demonstrates button creation and click event handling.

More Examples

  • custom_window - Native Win32 window creation
  • cairo_rendering - 2D graphics rendering with Cairo
  • interactive_button - Mouse interaction and hover states
  • signals_demo - Qt-style signals & slots demonstration
  • todo_app - Multi-widget application with signals
  • calculator - Full calculator with 20+ buttons

🔧 Build Requirements

Compiler

  • gfortran 9.0+ (recommended)
  • Intel Fortran (ifort/ifx)
  • NAG Fortran

Build Tools

  • fpm (Fortran Package Manager) - recommended, or
  • CMake 3.20+

Backend Dependencies (Optional)

Depending on which backend you use:

  • Custom Backend: Cairo 2D graphics library (for rendering)
  • Windows Backend: Win32 API (built-in to Windows)
  • Platform-Agnostic Backend: No dependencies (framebuffer-only)
  • Stub Backend: No dependencies (testing only)

🛠️ Current Status

Version: 1.0.0-qt-alpha

This is a complete modernization/rewrite of the original ForGE project into a Qt-equivalent framework. The current release includes:

✅ Implemented

  • Qt-Equivalent Core: Signals & Slots, QString, QList, QMap, QStack, QQueue
  • 20 Widget Types: Buttons, checkboxes, comboboxes, menus, dialogs, and more
  • Networking API: QTcpSocket, QUdpSocket, QHttpClient
  • Threading API: QThread, QMutex, QSemaphore, QWaitCondition
  • JSON Support: QJsonValue, QJsonObject, QJsonArray
  • Custom GUI Backend: Native Windows + Cairo 2D rendering
  • Platform-Agnostic Backend: Unique framebuffer-only option
  • Build Systems: fpm + CMake with CI/CD
  • 7 Working Examples: Including interactive GUIs
  • 2 Test Suites: Core functionality tests
  • 16 Documentation Files: Comprehensive guides

🚧 In Progress (Week 2)

  • JSON parser implementation (70% → 100%)
  • Socket implementation (Winsock2 integration)
  • HTTP client implementation
  • Additional widgets (30+ total)

📋 Planned (Months 2-24)

  • Linux/X11 backend
  • macOS/Cocoa backend
  • ForgeML declarative UI language
  • Visual Designer tool
  • Database drivers (SQLite, PostgreSQL)
  • SSL/TLS networking
  • Advanced graphics (scene graph, animation)
  • ForGE Qt 1.0.0 release

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Development Priorities

  1. Tcl/Tk backend implementation
  2. Additional widget types
  3. Layout manager functionality
  4. Test coverage
  5. Documentation improvements

📜 License

ForGE is released under the GNU General Public License v3.0 or later. See LICENSE for details.

📝 History

ForGE originated as a GTK2-based GUI library (v0.1 - v0.4.0) and has been completely modernized into ForGE Qt, a Qt-equivalent framework with:

  • Modern Fortran 2008/2018 features and OOP
  • Qt-style Signals & Slots event system
  • QString, QList, QMap, QStack, QQueue containers
  • 20+ widget types with Qt-equivalent APIs
  • Networking (QTcpSocket, QUdpSocket, QHttpClient)
  • Threading (QThread, QMutex, QSemaphore)
  • JSON support (QJsonValue, QJsonObject, QJsonArray)
  • Custom GUI backend with Cairo 2D rendering
  • Platform-agnostic backend (unique feature!)
  • Active development and comprehensive documentation

See CHANGELOG.md for version history.

🙏 Acknowledgments

  • Original ForGE project by John N. Shahbazian
  • gtk-fortran project for inspiration
  • Fortran-lang community for tools and support

📧 Contact


Note: ForGE Qt is under active development. The API may change as we implement and refine features. We're working towards a stable 1.0.0 release with full Qt-equivalent functionality across all platforms.

About

Forge is a framework for Fortran that is designed to make it simple to create a GUI

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Fortran 99.0%
  • Other 1.0%