/* * Copyright 2024, My Name * All rights reserved. Distributed under the terms of the MIT license. */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include #include #include #include #include #include #include #include #include #include "Conversation.h" static const uint32 kCheckKey = 'chkk'; static const uint32 kMsgNewFile = 'fnew'; static const uint32 kMsgOpenFile = 'fopn'; static const uint32 kMsgSaveFile = 'fsav'; static const uint32 kModelSelected = 'msel'; static const uint32 kViewJSON = 'vjso'; static const uint32 kPulse = 'plse'; static const uint32 kSendPrompt = 'kspt'; static const uint32 kQuestionChanged = 'kqch'; class MainWindow : public BWindow { public: MainWindow(); virtual ~MainWindow(); virtual void MessageReceived(BMessage *msg); // Overriding FrameResized to receive notifications on resize void FrameResized(float newWidth, float newHeight) override { //printf("Window resized to: Width = %f, Height = %f\n", newWidth, newHeight); // Resize the scroll view if necessary, otherwise we lose scroll ability } Conversation *_conversation = new Conversation(this); void checkValidKey(); void updateHistoryInfo(); private: std::string lastJSON; void ShowMissingKeyAlertAndQuit(); void SelectModelByName(const char *targetLabel); bool waitMode = false; BMenuBar *_BuildMenu(); BTextView *_answerView; BScrollView *_answerScrollView; BTextView *_infoConversation; BTextView *_infoView; BTextView *_inputField; BStatusBar *_progress; BMenuField *_modelField; BPopUpMenu *_modelMenu; BButton *_sendButton; // BMenuItem *fSaveMenuItem; }; #endif