mirror of
https://github.com/johndoe6345789/tustu.git
synced 2026-04-24 13:45:00 +00:00
QML Registration GUI
Modern QML-based user interface for the Registration Key Generator, based on the original Java Swing GUI (com/efiAnalytics/ui/dS.java).
Features
QML Implementation
- Main.qml - Main application window with tab navigation
- KeyGeneratorTab.qml - Reusable tab component for key generation (4/5/7/8-parameter variants)
- EmailParserTab.qml - Email parsing and generation functionality
- RegistrationDialog.qml - Registration dialog matching Java
dS.javadesign - main.py - Python backend connecting QML to registration algorithms
UI Components
Main Window
- Tab-based navigation (matches PyQt6 GUI structure)
- 5 tabs: 4-Parameter, 5-Parameter, 7-Parameter, 8-Parameter, Email Parser
- Modern Material Design color scheme
- Responsive layout
Key Generator Tabs
Based on Java Swing input panels from dS.java:
- Input fields for first name, last name, product, email
- Conditional fields (secret, month, year, serial) based on algorithm
- "Load Test Data" button (blue) - auto-populate with valid test data
- "Generate Key" button (green) - create registration key
- "Validate Key" button (orange) - verify key correctness
- Output area with monospace font
- Copy to clipboard functionality
Email Parser Tab
Based on Java "Paste Email" functionality from dS.java:
- Text area for pasting registration emails
- Parse button to extract fields from
[Registration]...[End Registration]format - Editable extracted fields (first name, last name, email, serial, key)
- "Load Test Data" button (purple) - generates complete valid registration
- "Generate Email Format" button (green) - creates formatted email text
- Validation support
Registration Dialog
Matches Java dS.java dialog structure:
- Radio buttons to switch between "Inputs" and "Paste Email" views
- CardLayout equivalent using QML StackLayout
- Edition selector (ComboBox)
- Registration information fields
- Email paste and parse functionality
- OK/Cancel standard dialog buttons
Architecture
QML Frontend
- Declarative UI using QtQuick 6.5
- Material Design styling
- Signal/slot connections to Python backend
- Responsive layouts with GridLayout, RowLayout, ColumnLayout
Python Backend (main.py)
RegistrationBackendclass exposes methods to QML- Uses
@pyqtSlotdecorators for QML-callable methods - Imports from
registration_gui.pyfor algorithm implementations - Signal emissions for async operations
Backend Methods
generateKey4Param()- 4-parameter algorithmgenerateKey5Param()- 5-parameter algorithmgenerateKey7Param()- 7-parameter algorithmgenerateKey8Param()- 8-parameter algorithmloadTestData()- Generate dummy test dataparseEmail()- Extract fields from email textgenerateEmailFormat()- Create formatted registration email
Running the QML GUI
# Install Qt6 for Python
pip install PyQt6
# Run the QML application
cd qml
python3 main.py
Comparison: Java Swing vs QML
Java Swing (Original)
// dS.java - Registration Dialog
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(0, 1, 3, 3));
ea firstNameField = new ea(this, "Registered First Name:", k.b());
panel.add(firstNameField);
QML (Modern)
// RegistrationDialog.qml
GridLayout {
columns: 2
Label { text: "Registered First Name:" }
TextField {
id: firstNameField
Layout.fillWidth: true
}
}
Advantages of QML
- Declarative Syntax - Easier to read and maintain than imperative Java Swing
- Modern Look - Material Design colors and styling
- Responsive - Automatic layout adjustment
- Animation Support - Built-in property animations
- Hardware Acceleration - Qt Quick Scene Graph for smooth rendering
- Cross-Platform - Same QML runs on Windows, macOS, Linux, mobile
- Separation of Concerns - UI in QML, logic in Python
- Hot Reload - Can reload QML without restarting (in development)
Java GUI Elements Mapped to QML
| Java Swing Component | QML Component | Location |
|---|---|---|
JDialog |
Dialog |
RegistrationDialog.qml |
JPanel |
Rectangle + Layout |
All files |
JTextField |
TextField |
KeyGeneratorTab.qml, etc. |
JTextArea / JTextPane |
TextArea / TextEdit |
EmailParserTab.qml |
JButton |
Button |
All files |
JRadioButton |
RadioButton |
RegistrationDialog.qml |
ButtonGroup |
ButtonGroup |
RegistrationDialog.qml |
JComboBox |
ComboBox |
KeyGeneratorTab.qml |
GridLayout |
GridLayout |
KeyGeneratorTab.qml |
BorderLayout |
ColumnLayout + anchors |
Main.qml |
CardLayout |
StackLayout |
RegistrationDialog.qml |
JScrollPane |
ScrollView |
EmailParserTab.qml |
GroupBox (titled border) |
GroupBox |
All tabs |
File Structure
qml/
├── Main.qml # Main application window
├── KeyGeneratorTab.qml # Reusable key generation tab
├── EmailParserTab.qml # Email parsing/generation tab
├── RegistrationDialog.qml # Registration dialog (matches dS.java)
├── main.py # Python backend + QML loader
└── README.md # This file
Next Steps
To fully connect the QML UI to the Python backend:
- Implement Backend Calls - Connect QML button clicks to Python slots
- Add Clipboard Support - Use
QClipboardfor copy/paste - Error Handling - Display validation errors in QML dialogs
- Styling - Add custom Material Design theme
- Animations - Add smooth transitions between tabs
- Testing - Create QML test cases
Color Scheme
primaryColor: "#4CAF50" // Green - Generate buttons
accentColor: "#2196F3" // Blue - Load Test Data
warningColor: "#FF9800" // Orange - Validate buttons
errorColor: "#f44336" // Red - Errors
backgroundColor: "#f5f5f5" // Light gray
cardColor: "#ffffff" // White
Dependencies
- Python 3.6+
- PyQt6 6.5.0+
- Qt 6.5+ (included with PyQt6)
- registration_gui.py (from parent directory)
License
Same as parent project - for educational and testing purposes.