e8857bcd by shady

Complete PySide6 migration: Replace tkinter with Qt

- Installed PySide6 6.10.1
- Implemented LoginDialog with QDialog (replaces LoginWindow)
- Implemented ImageGeneratorWindow with QMainWindow
- Implemented ImageGenerationWorker with QThread for async operations
- Preserved all functionality: authentication, image generation, config management
- Applied QSS styling for modern UI
- All Phase 1-3 tasks completed (coding)
- Phase 4 tasks (manual testing) ready for user
1 parent 6a204244
......@@ -2,71 +2,71 @@
## Pre-Migration Tasks
1. **Install PySide6 dependency**
- Add `PySide6>=6.6.0` to requirements (if exists) or install directly
- Run `pip install PySide6`
- **Validation**: `python -c "from PySide6.QtWidgets import QApplication; print('OK')"`
1. **[x] Install PySide6 dependency**
- [x] Add `PySide6>=6.6.0` to requirements (if exists) or install directly
- [x] Run `pip install PySide6`
- **Validation**: `python -c "from PySide6.QtWidgets import QApplication; print('OK')"`
2. **Backup current implementation**
- Create git commit of current tkinter version
- Tag as `before-qt-migration` for easy rollback
- **Validation**: `git log --oneline -1` shows commit
2. **[x] Backup current implementation**
- [x] Create git commit of current tkinter version
- [x] Tag as `before-qt-migration` for easy rollback
- **Validation**: `git log --oneline -1` shows commit
## Phase 1: LoginDialog Migration (Priority: Critical)
3. **Create LoginDialog class structure**
- Import PySide6 modules (QDialog, QVBoxLayout, QFormLayout, etc.)
- Define LoginDialog class inheriting from QDialog
- Move __init__ parameters from LoginWindow
- **Validation**: Class instantiates without errors
4. **Implement LoginDialog UI layout**
- Create QVBoxLayout as main layout
- Add title QLabel
- Create QFormLayout for username/password fields
- Add QLineEdit widgets for username and password
- Set password field to QLineEdit.Password mode
- **Validation**: Dialog shows with all fields visible
5. **Add checkbox row to LoginDialog**
- Create QHBoxLayout for checkboxes
- Add "记住用户名" QCheckBox
- Add "记住密码" QCheckBox
- Set initial checked states from parameters
- **Validation**: Checkboxes appear and can be toggled
6. **Add login button and error label**
- Create QPushButton with text "登录"
- Connect to on_login slot
- Add QLabel for error messages (initially hidden)
- **Validation**: Button appears and is clickable
7. **Apply LoginDialog styling**
- Create QSS stylesheet for dialog
- Style title, labels, input fields, button
- Match colors from original design (#ffffff, #007AFF, #fafafa, etc.)
- **Validation**: Dialog matches design mockup
8. **Implement password placeholder handling**
- Check if saved_password_hash exists
- If yes, set placeholder text "••••••••" with gray color
- Bind textChanged signal to clear placeholder
- **Validation**: Placeholder shows and clears on typing
9. **Implement authentication logic**
- Move database connection code to on_login method
- Use pymysql exactly as in tkinter version
- Handle success: set result variables, accept dialog
- Handle failure: show error in error_label
- **Validation**: Login succeeds with valid credentials, fails with invalid
10. **Implement dialog return values**
- Store success, authenticated_user, password_hash as instance variables
- Provide getter methods or properties
- Return QDialog.Accepted on success, QDialog.Rejected on cancel
- **Validation**: Calling code can access all return values
11. **Test LoginDialog on macOS**
3. **[x] Create LoginDialog class structure**
- [x] Import PySide6 modules (QDialog, QVBoxLayout, QFormLayout, etc.)
- [x] Define LoginDialog class inheriting from QDialog
- [x] Move __init__ parameters from LoginWindow
- **Validation**: Class instantiates without errors
4. **[x] Implement LoginDialog UI layout**
- [x] Create QVBoxLayout as main layout
- [x] Add title QLabel
- [x] Create QFormLayout for username/password fields
- [x] Add QLineEdit widgets for username and password
- [x] Set password field to QLineEdit.Password mode
- **Validation**: Dialog shows with all fields visible
5. **[x] Add checkbox row to LoginDialog**
- [x] Create QHBoxLayout for checkboxes
- [x] Add "记住用户名" QCheckBox
- [x] Add "记住密码" QCheckBox
- [x] Set initial checked states from parameters
- **Validation**: Checkboxes appear and can be toggled
6. **[x] Add login button and error label**
- [x] Create QPushButton with text "登录"
- [x] Connect to on_login slot
- [x] Add QLabel for error messages (initially hidden)
- **Validation**: Button appears and is clickable
7. **[x] Apply LoginDialog styling**
- [x] Create QSS stylesheet for dialog
- [x] Style title, labels, input fields, button
- [x] Match colors from original design (#ffffff, #007AFF, #fafafa, etc.)
- **Validation**: Dialog matches design mockup
8. **[x] Implement password placeholder handling**
- [x] Check if saved_password_hash exists
- [x] If yes, set placeholder text "••••••••" with gray color
- [x] Bind textChanged signal to clear placeholder
- **Validation**: Placeholder shows and clears on typing
9. **[x] Implement authentication logic**
- [x] Move database connection code to on_login method
- [x] Use pymysql exactly as in tkinter version
- [x] Handle success: set result variables, accept dialog
- [x] Handle failure: show error in error_label
- **Validation**: Login succeeds with valid credentials, fails with invalid
10. **[x] Implement dialog return values**
- [x] Store success, authenticated_user, password_hash as instance variables
- [x] Provide getter methods or properties
- [x] Return QDialog.Accepted on success, QDialog.Rejected on cancel
- **Validation**: Calling code can access all return values
11. **[ ] Test LoginDialog on macOS**
- Run application and verify dialog appears
- Verify all UI elements are visible (title, labels, inputs, button, checkboxes)
- Test typing in username field
......