67 lines
1.6 KiB
C++
67 lines
1.6 KiB
C++
/*
|
|
* 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>
|
|
#include <TextControl.h>
|
|
#include <TextView.h>
|
|
#include <StatusBar.h>
|
|
#include <Window.h>
|
|
#include <String.h>
|
|
|
|
|
|
|
|
//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"
|
|
#include "/boot/system/develop/headers/private/netservices2/HttpFields.h"
|
|
#include "/boot/system/develop/headers/private/netservices2/ErrorsExt.h"
|
|
|
|
//From private headers !
|
|
//#include <NetServicesDefs.h>
|
|
//#include <HttpSession.h>
|
|
//#include <HttpSession.h>
|
|
//#include <HttpRequest.h>
|
|
//#include <HttpResult.h>
|
|
//#include <ErrorsExt.h>
|
|
|
|
|
|
using namespace BPrivate::Network;
|
|
|
|
class MainWindow : public BWindow {
|
|
public:
|
|
MainWindow();
|
|
virtual ~MainWindow();
|
|
|
|
virtual void MessageReceived(BMessage *msg);
|
|
|
|
void sendQuery();
|
|
BString ReadOpenAIKey();
|
|
|
|
private:
|
|
|
|
|
|
BString _apiKey;
|
|
BHttpSession _sharedSession = BHttpSession ();
|
|
|
|
std::optional<BHttpResult> _lastResult;
|
|
|
|
BMenuBar *_BuildMenu();
|
|
BTextView * _answerView;
|
|
BTextView * _infoView;
|
|
BTextControl* _inputField;
|
|
BStatusBar* _progress;
|
|
|
|
BMenuItem *fSaveMenuItem;
|
|
};
|
|
|
|
#endif
|