Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
443dd5d
Merge pull request #10 from iberikofer/main
iberikofer Nov 12, 2026
e7d8d03
feat(desktop): add web design tokens, Geist fonts and icon set
immmn Nov 12, 2026
d5d8792
feat(desktop): add reusable QML component library
immmn Nov 12, 2026
90b9c6c
feat(desktop): add view models for the application screens
immmn Nov 12, 2026
4620849
feat(desktop): port dashboard, interview, report, admin and sign-in s…
immmn Nov 12, 2026
8a239a6
feat(desktop): rebuild app shell with navbar, status banner and landi…
immmn Nov 12, 2026
bf91ac8
test(desktop): cover UI view models, list models and form validation
immmn Nov 13, 2026
2f704fe
refactor(desktop): rename setter parameters that shadowed accessors
immmn Nov 13, 2026
678bee3
refactor(desktop): remake the UI as a desktop app instead of a ported…
immmn Nov 13, 2026
a1480ff
refactor(desktop): drop the website leftovers from sign-in, tooltips …
immmn Nov 16, 2026
b80251b
fix(desktop): make the offline demo report on the interview that was …
immmn Nov 16, 2026
daa1c57
feat(desktop): let a deleted question be undone before it leaves the …
immmn Nov 16, 2026
d503e6c
fix(desktop): name the demo accounts and tidy sign-in and question ba…
immmn Nov 16, 2026
72d7e5b
fix(desktop): polish focus, selection and alignment across the screens
immmn Nov 16, 2026
a14c96d
fix(desktop): show an error when a server interview's report cannot b…
immmn Nov 16, 2026
fe115a9
fix(desktop): send a deleted question to the server before the window…
immmn Nov 16, 2026
1a40e2a
feat(desktop): bring back the start-up splash with its progress line
immmn Nov 16, 2026
948fc0b
fix(desktop): polish the start-up splash
immmn Nov 16, 2026
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
117 changes: 115 additions & 2 deletions apps/desktop/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,38 @@ else()
endif()
endif()

# Screen view models and list models of the UI layer. Shared by the app and
# the test target.
set(DESKTOP_UI_VIEWMODEL_SOURCES
src/viewmodels/AdminViewModel.cpp
src/viewmodels/BackendStatusViewModel.cpp
src/viewmodels/ChatViewModel.cpp
src/viewmodels/DashboardViewModel.cpp
src/viewmodels/DemoData.cpp
src/viewmodels/FormValidator.cpp
src/viewmodels/InterviewListModel.cpp
src/viewmodels/MessageListModel.cpp
src/viewmodels/QuestionListModel.cpp
src/viewmodels/ReportViewModel.cpp
src/viewmodels/SettingsViewModel.cpp
src/viewmodels/SetupViewModel.cpp
)
set(DESKTOP_UI_VIEWMODEL_HEADERS
include/viewmodels/AdminViewModel.hpp
include/viewmodels/BackendStatusViewModel.hpp
include/viewmodels/ChatViewModel.hpp
include/viewmodels/DashboardViewModel.hpp
include/viewmodels/DemoData.hpp
include/viewmodels/FormValidator.hpp
include/viewmodels/InterviewListModel.hpp
include/viewmodels/MessageListModel.hpp
include/viewmodels/QuestionListModel.hpp
include/viewmodels/ReportViewModel.hpp
include/viewmodels/SettingsViewModel.hpp
include/viewmodels/SetupViewModel.hpp
include/viewmodels/ViewModelSupport.hpp
)

add_executable(DevDialogue
src/main.cpp

Expand Down Expand Up @@ -78,6 +110,8 @@ add_executable(DevDialogue
include/viewmodels/AuthViewModel.hpp
src/viewmodels/NavigationViewModel.cpp
include/viewmodels/NavigationViewModel.hpp
${DESKTOP_UI_VIEWMODEL_SOURCES}
${DESKTOP_UI_VIEWMODEL_HEADERS}
)

target_include_directories(DevDialogue PRIVATE
Expand Down Expand Up @@ -108,14 +142,86 @@ if(WIN32)
target_link_libraries(DevDialogue PRIVATE Crypt32 Advapi32)
endif()

# Application icon shown by Explorer and the taskbar (resources/app).
if(WIN32)
target_sources(DevDialogue PRIVATE resources/app/app-icon.rc)
endif()

# Design-token singletons (each file also declares `pragma Singleton`).
set_source_files_properties(
qml/styles/Theme.qml
qml/styles/Typography.qml
qml/styles/Icons.qml
qml/styles/I18n.qml
PROPERTIES QT_QML_SINGLETON_TYPE TRUE
)

# Bundled icon set (see resources/NOTICE.md).
file(GLOB DESKTOP_ICON_FILES
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
CONFIGURE_DEPENDS
resources/icons/*.svg
)

qt_add_qml_module(DevDialogue
URI "DevDialogue.App"
VERSION 1.0
QML_FILES
qml/Main.qml

# Design tokens
qml/styles/Theme.qml
qml/components/Navbar.qml
qml/views/LandingView.qml
qml/styles/Typography.qml
qml/styles/Icons.qml
qml/styles/I18n.qml

# Reusable components
qml/components/AlertBox.qml
qml/components/AppPage.qml
qml/components/AppText.qml
qml/components/AppToolTip.qml
qml/components/Badge.qml
qml/components/DarkCard.qml
qml/components/DarkTextArea.qml
qml/components/DarkTextField.qml
qml/components/GlowBlob.qml
qml/components/Icon.qml
qml/components/KpiTile.qml
qml/components/MessageBubble.qml
qml/components/ModalOverlay.qml
qml/components/MonoText.qml
qml/components/ProgressRing.qml
qml/components/PulseDot.qml
qml/components/ScoreGauge.qml
qml/components/SegmentedControl.qml
qml/components/SelectBox.qml
qml/components/SelectCard.qml
qml/components/Sidebar.qml
qml/components/SidebarItem.qml
qml/components/Skeleton.qml
qml/components/SoftGlow.qml
qml/components/Spinner.qml
qml/components/SplashOverlay.qml
qml/components/TactileButton.qml
qml/components/ThemedScrollBar.qml
qml/components/Toast.qml
qml/components/ToggleSwitch.qml
qml/components/UserAvatar.qml

# Screens
qml/views/LoginView.qml
qml/views/DashboardView.qml
qml/views/SetupView.qml
qml/views/ChatRoomView.qml
qml/views/ReportView.qml
qml/views/AdminView.qml
qml/views/AccountView.qml
RESOURCES
resources/fonts/Geist-Variable.ttf
resources/fonts/GeistMono-Variable.ttf
resources/app/app-icon.svg
resources/app/app-icon.png
${DESKTOP_ICON_FILES}
)

# ==========================================
Expand All @@ -132,6 +238,9 @@ if(GTest_FOUND)
tests/unit/TestSecureStorage.cpp
tests/unit/TestApiClient.cpp
tests/unit/TestAuthService.cpp
tests/unit/TestFormValidator.cpp
tests/unit/TestListModels.cpp
tests/unit/TestViewModels.cpp

# Headers for AUTOMOC
include/core/AppConfig.hpp
Expand All @@ -145,6 +254,8 @@ if(GTest_FOUND)
include/services/AuthService.hpp
include/services/InterviewService.hpp
include/services/AdminService.hpp
include/viewmodels/NavigationViewModel.hpp
${DESKTOP_UI_VIEWMODEL_HEADERS}

# Sources required for tests
src/core/AppConfig.cpp
Expand All @@ -154,6 +265,8 @@ if(GTest_FOUND)
src/services/AuthService.cpp
src/services/InterviewService.cpp
src/services/AdminService.cpp
src/viewmodels/NavigationViewModel.cpp
${DESKTOP_UI_VIEWMODEL_SOURCES}
)

target_include_directories(DevDialogueTests PRIVATE
Expand Down
130 changes: 130 additions & 0 deletions apps/desktop/include/viewmodels/AdminViewModel.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#pragma once

#include <QAbstractItemModel>
#include <QObject>
#include <QSet>
#include <QString>
#include <QTimer>
#include <memory>
#include <optional>
#include <vector>

#include "services/AdminService.hpp"
#include "services/AuthService.hpp"
#include "viewmodels/QuestionListModel.hpp"
#include "viewmodels/ViewModelSupport.hpp"

namespace devdialogue::viewmodels {

// Question bank administration (port of the data side of the web
// AdminPanel.tsx): filtered and paged question list, create, delete and the
// active / inactive switch.
class AdminViewModel : public QObject, public support::BackendAware {
Q_OBJECT
Q_PROPERTY(QAbstractItemModel* questions READ questions CONSTANT)
Q_PROPERTY(int questionCount READ questionCount NOTIFY questionsChanged)
Q_PROPERTY(bool loading READ loading NOTIFY loadingChanged)
Q_PROPERTY(bool isSubmitting READ isSubmitting NOTIFY submittingChanged)
Q_PROPERTY(bool isDemoData READ isDemoData NOTIFY questionsChanged)
// "" (all tracks) or a track id such as "frontend".
Q_PROPERTY(QString directionFilter READ directionFilter WRITE setDirectionFilter NOTIFY directionFilterChanged)
Q_PROPERTY(int page READ page NOTIFY pageChanged)
Q_PROPERTY(int totalPages READ totalPages NOTIFY pageChanged)
Q_PROPERTY(int totalCount READ totalCount NOTIFY pageChanged)
Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged)
// Language of the sample questions shown when the backend is unreachable.
Q_PROPERTY(QString uiLanguage READ uiLanguage WRITE setUiLanguage NOTIFY uiLanguageChanged)

public:
explicit AdminViewModel(std::shared_ptr<services::AdminService> adminService,
std::shared_ptr<services::AuthService> authService, QObject* parent = nullptr);
~AdminViewModel() override;

QAbstractItemModel* questions() { return &m_questions; }
int questionCount() const { return m_questions.count(); }
bool loading() const { return m_loading; }
bool isSubmitting() const { return m_isSubmitting; }
bool isDemoData() const { return m_isDemoData; }
QString directionFilter() const { return m_directionFilter; }
void setDirectionFilter(const QString& direction);
int page() const { return m_page; }
int totalPages() const { return m_totalPages; }
int totalCount() const { return m_totalCount; }
QString errorMessage() const { return m_errorMessage; }
QString uiLanguage() const { return m_uiLanguage; }
void setUiLanguage(const QString& language);

Q_INVOKABLE void refresh();
Q_INVOKABLE void nextPage();
Q_INVOKABLE void previousPage();

// Adds a question; emits questionCreated() when it is in the list.
Q_INVOKABLE void createQuestion(const QString& direction, const QString& level, const QString& topic,
const QString& questionText);
// Takes the question out of the list at once and emits questionDeleted();
// the server is told only when the undo window has passed.
Q_INVOKABLE void deleteQuestion(const QString& id);
// Puts the question that is waiting to be deleted back in its row.
Q_INVOKABLE void undoDelete();
// Sends the delete still waiting out its undo window now, e.g. when the
// window closes. Returns true while deletes are on their way to the
// server; deletesSettled() follows once they are all answered.
Q_INVOKABLE bool sendPendingDeletes();

// How long a deleted question can be restored (tests shorten it).
void setUndoWindow(int milliseconds) { m_undoTimer.setInterval(milliseconds); }
Q_INVOKABLE void setQuestionActive(const QString& id, bool active);

signals:
void questionsChanged();
void loadingChanged();
void submittingChanged();
void directionFilterChanged();
void pageChanged();
void errorMessageChanged();
void uiLanguageChanged();
void questionCreated();
void questionDeleted(const QString& topic);
// The server kept the question, so it is back in the list. reason is the
// server's message, empty when the server could not be reached.
void questionDeleteFailed(const QString& topic, const QString& reason);
// Every delete sent to the server has been answered.
void deletesSettled();

private:
struct PendingDelete {
int row;
models::QuestionBankItem item;
};

// Sends the delete that is waiting out its undo window, if any.
void commitPendingDelete();
void applyDemoQuestions();
void setLoading(bool value);
void setSubmitting(bool submitting);
void setErrorMessage(const QString& message);
void setPaging(int page, int totalPages, int totalCount);
// Keeps "N questions" in step with rows added or removed here.
void adjustTotalCount(int delta);

std::shared_ptr<services::AdminService> m_adminService;
std::shared_ptr<services::AuthService> m_authService;
QuestionListModel m_questions;
QTimer m_undoTimer;
std::optional<PendingDelete> m_pendingDelete;
// Deletes sent to the server and not answered yet; a page loaded
// meanwhile must not bring them back.
QSet<QString> m_deletingIds;
QString m_directionFilter;
QString m_errorMessage;
QString m_uiLanguage{QStringLiteral("en")};
int m_page{1};
int m_totalPages{1};
int m_totalCount{0};
int m_generation{0};
bool m_loading{false};
bool m_isSubmitting{false};
bool m_isDemoData{false};
};

} // namespace devdialogue::viewmodels
37 changes: 37 additions & 0 deletions apps/desktop/include/viewmodels/BackendStatusViewModel.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#pragma once

#include <QObject>
#include <memory>

#include "network/ApiClient.hpp"

namespace devdialogue::viewmodels {

// Backend connectivity state for the sidebar indicator and the account
// page. The online flag itself is owned by ApiClient; this class adds the
// on-demand check and its "checking" state.
class BackendStatusViewModel : public QObject {
Q_OBJECT
Q_PROPERTY(bool isOffline READ isOffline NOTIFY statusChanged)
Q_PROPERTY(bool isChecking READ isChecking NOTIFY checkingChanged)

public:
explicit BackendStatusViewModel(std::shared_ptr<network::ApiClient> apiClient, QObject* parent = nullptr);

bool isOffline() const;
bool isChecking() const { return m_isChecking; }

Q_INVOKABLE void checkHealth();

signals:
void statusChanged();
void checkingChanged();

private:
void setChecking(bool checking);

std::shared_ptr<network::ApiClient> m_apiClient;
bool m_isChecking{false};
};

} // namespace devdialogue::viewmodels
Loading
Loading