Initial commit
This commit is contained in:
commit
6238a79854
10 files changed
+1680
No files matched your search
@@ -0,0 +1,155 @@
|
||||
#pragma once
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QSlider>
|
||||
#include <QProgressBar>
|
||||
#include <QLineEdit>
|
||||
#include <QListWidget>
|
||||
#include <QGroupBox>
|
||||
#include <QStatusBar>
|
||||
#include <QMenuBar>
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
#include <optional>
|
||||
#include <echoion/api.hpp>
|
||||
|
||||
namespace Echoion::Desktop {
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget* parent = nullptr);
|
||||
~MainWindow() override;
|
||||
|
||||
// Authentication
|
||||
void setAuthToken(const QString& token);
|
||||
void clearAuthToken();
|
||||
[[nodiscard]] bool isAuthenticated() const;
|
||||
|
||||
// State updates
|
||||
void onPlaybackStateChanged(const Api::PlaybackState& state);
|
||||
void onQueueUpdated(const std::vector<Api::QueueEntry>& queue);
|
||||
void onConnectionStatusChanged(bool connected);
|
||||
void onSearchResultsReceived(const Api::SearchResult& results);
|
||||
|
||||
signals:
|
||||
// Connection signals
|
||||
void loginRequested();
|
||||
void logoutRequested();
|
||||
|
||||
// Playback control signals
|
||||
void playRequested(const QString& query);
|
||||
void playFromQueueRequested(int index);
|
||||
void pauseRequested();
|
||||
void stopRequested();
|
||||
void resumeRequested();
|
||||
void skipRequested();
|
||||
void seekRequested(int positionMs);
|
||||
void volumeChangeRequested(int volume);
|
||||
void toggleShuffleRequested();
|
||||
void toggleRepeatRequested();
|
||||
|
||||
// Queue signals
|
||||
void clearQueueRequested();
|
||||
void removeFromQueueRequested(int index);
|
||||
void moveInQueueRequested(int from, int to);
|
||||
|
||||
// Search signals
|
||||
void searchRequested(const QString& query);
|
||||
void addSearchResultToQueueRequested(int index);
|
||||
|
||||
// System signals
|
||||
void reloadCoreRequested();
|
||||
void settingsRequested();
|
||||
|
||||
private slots:
|
||||
void onPlayClicked();
|
||||
void onPauseClicked();
|
||||
void onStopClicked();
|
||||
void onSkipClicked();
|
||||
void onVolumeChanged(int value);
|
||||
void onSeekSliderMoved(int value);
|
||||
void onSearchClicked();
|
||||
void onSearchResultDoubleClicked(QListWidgetItem* item);
|
||||
void onQueueItemDoubleClicked(QListWidgetItem* item);
|
||||
void onShuffleClicked();
|
||||
void onRepeatClicked();
|
||||
void onClearQueueClicked();
|
||||
void onRemoveFromQueueClicked();
|
||||
void onSettingsClicked();
|
||||
void onReloadClicked();
|
||||
void onLoginLogoutClicked();
|
||||
|
||||
private:
|
||||
void setupUi();
|
||||
void setupMenuBar();
|
||||
void setupPlaybackControls();
|
||||
void setupSearchPanel();
|
||||
void setupQueueView();
|
||||
void setupStatusBar();
|
||||
void updatePlaybackDisplay();
|
||||
void updateQueueDisplay();
|
||||
void updateButtonStates();
|
||||
|
||||
[[nodiscard]] QString formatDuration(std::chrono::milliseconds ms);
|
||||
|
||||
// Central widget
|
||||
QWidget* centralWidget_;
|
||||
QVBoxLayout* mainLayout_;
|
||||
|
||||
// Playback controls
|
||||
QLabel* nowPlayingLabel_;
|
||||
QLabel* artistLabel_;
|
||||
QProgressBar* progressBar_;
|
||||
QLabel* timeLabel_;
|
||||
QPushButton* playButton_;
|
||||
QPushButton* pauseButton_;
|
||||
QPushButton* stopButton_;
|
||||
QPushButton* skipButton_;
|
||||
QPushButton* shuffleButton_;
|
||||
QPushButton* repeatButton_;
|
||||
QSlider* volumeSlider_;
|
||||
QLabel* volumeLabel_;
|
||||
|
||||
// Search panel
|
||||
QLineEdit* searchEdit_;
|
||||
QPushButton* searchButton_;
|
||||
QListWidget* searchResults_;
|
||||
|
||||
// Queue view
|
||||
QListWidget* queueList_;
|
||||
QPushButton* clearQueueButton_;
|
||||
QPushButton* removeFromQueueButton_;
|
||||
|
||||
// Status bar
|
||||
QStatusBar* statusBar_;
|
||||
QLabel* connectionStatusLabel_;
|
||||
QLabel* authStatusLabel_;
|
||||
|
||||
// Menu actions
|
||||
QAction* loginAction_;
|
||||
QAction* logoutAction_;
|
||||
QAction* settingsAction_;
|
||||
QAction* reloadAction_;
|
||||
QAction* exitAction_;
|
||||
QAction* aboutAction_;
|
||||
|
||||
// State
|
||||
QTimer* updateTimer_;
|
||||
std::optional<QString> authToken_;
|
||||
Api::PlaybackState currentState_;
|
||||
std::vector<Api::QueueEntry> currentQueue_;
|
||||
bool connectedToCore_ = false;
|
||||
|
||||
// Buttons for login/logout
|
||||
QPushButton* loginLogoutButton_;
|
||||
};
|
||||
|
||||
} // namespace Echoion::Desktop
|
||||
Reference in new issue
Block a user