2024-09-29 17:58:05 -03:00
|
|
|
/*
|
|
|
|
* Copyright 2024, My Name <my@email.address>
|
|
|
|
* All rights reserved. Distributed under the terms of the MIT license.
|
|
|
|
*/
|
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
#include <MenuItem.h>
|
2024-09-30 03:17:31 -03:00
|
|
|
#include <TextControl.h>
|
|
|
|
#include <TextView.h>
|
|
|
|
#include <StatusBar.h>
|
2024-09-29 17:58:05 -03:00
|
|
|
#include <Window.h>
|
2025-05-07 02:33:01 -03:00
|
|
|
#include <String.h>
|
2024-09-29 17:58:05 -03:00
|
|
|
|
2025-05-06 23:26:01 -03:00
|
|
|
|
|
|
|
|
|
|
|
//NEED THIS IN MAKE FILE TO USE PRIVATE HEADERS
|
|
|
|
//CXXFLAGS = -std=c++17 -Wall -I/boot/system/develop/headers/private
|
|
|
|
|
|
|
|
|
|
|
|
//Build works but Genio doesn't see class definitions unless I use full path ?
|
|
|
|
#include "/boot/system/develop/headers/private/netservices2/NetServicesDefs.h"
|
|
|
|
#include "/boot/system/develop/headers/private/netservices2/HttpSession.h"
|
|
|
|
#include "/boot/system/develop/headers/private/netservices2/HttpRequest.h"
|
|
|
|
#include "/boot/system/develop/headers/private/netservices2/HttpResult.h"
|
2025-05-07 02:33:01 -03:00
|
|
|
#include "/boot/system/develop/headers/private/netservices2/HttpFields.h"
|
2025-05-06 23:26:01 -03:00
|
|
|
#include "/boot/system/develop/headers/private/netservices2/ErrorsExt.h"
|
2024-09-29 17:58:05 -03:00
|
|
|
|
2024-09-30 03:17:31 -03:00
|
|
|
//From private headers !
|
2025-05-06 23:26:01 -03:00
|
|
|
//#include <NetServicesDefs.h>
|
|
|
|
//#include <HttpSession.h>
|
|
|
|
//#include <HttpSession.h>
|
|
|
|
//#include <HttpRequest.h>
|
|
|
|
//#include <HttpResult.h>
|
2024-09-30 03:17:31 -03:00
|
|
|
//#include <ErrorsExt.h>
|
|
|
|
|
|
|
|
|
|
|
|
using namespace BPrivate::Network;
|
2025-05-07 00:28:10 -03:00
|
|
|
|
2024-09-30 03:17:31 -03:00
|
|
|
class MainWindow : public BWindow {
|
2024-09-29 17:58:05 -03:00
|
|
|
public:
|
2024-09-30 03:17:31 -03:00
|
|
|
MainWindow();
|
|
|
|
virtual ~MainWindow();
|
2024-09-29 17:58:05 -03:00
|
|
|
|
2024-09-30 03:17:31 -03:00
|
|
|
virtual void MessageReceived(BMessage *msg);
|
2024-09-29 17:58:05 -03:00
|
|
|
|
2024-09-30 03:17:31 -03:00
|
|
|
void sendQuery();
|
2025-05-07 02:33:01 -03:00
|
|
|
BString ReadOpenAIKey();
|
2024-09-29 17:58:05 -03:00
|
|
|
|
2024-09-30 03:17:31 -03:00
|
|
|
private:
|
2025-05-07 02:33:01 -03:00
|
|
|
|
|
|
|
|
|
|
|
BString _apiKey;
|
2025-05-06 23:26:01 -03:00
|
|
|
BHttpSession _sharedSession = BHttpSession ();
|
|
|
|
|
2025-05-07 00:28:10 -03:00
|
|
|
std::optional<BHttpResult> _lastResult;
|
2025-05-06 23:26:01 -03:00
|
|
|
|
2024-09-30 03:17:31 -03:00
|
|
|
BMenuBar *_BuildMenu();
|
|
|
|
BTextView * _answerView;
|
2025-05-06 23:26:01 -03:00
|
|
|
BTextView * _infoView;
|
2025-05-07 03:48:23 -03:00
|
|
|
BTextView* _inputField;
|
|
|
|
//BTextControl* _inputField;
|
2024-09-30 03:17:31 -03:00
|
|
|
BStatusBar* _progress;
|
2025-05-07 01:01:00 -03:00
|
|
|
|
2024-09-30 03:17:31 -03:00
|
|
|
BMenuItem *fSaveMenuItem;
|
2024-09-29 17:58:05 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|