uses document border, easier to grab
This commit is contained in:
parent
38e8c87118
commit
2df9419ce2
6 changed files with 72 additions and 51 deletions
BIN
.genio
BIN
.genio
Binary file not shown.
4
App.cpp
4
App.cpp
|
@ -16,6 +16,8 @@ const char *kApplicationSignature = "application/x-vnd.SLema-DumBer";
|
||||||
|
|
||||||
App::App() : BApplication(kApplicationSignature) {
|
App::App() : BApplication(kApplicationSignature) {
|
||||||
MainWindow *m = new MainWindow();
|
MainWindow *m = new MainWindow();
|
||||||
|
m->SetLook(B_DOCUMENT_WINDOW_LOOK);
|
||||||
|
m->SetFeel(B_NORMAL_WINDOW_FEEL);
|
||||||
mainWindow = m;
|
mainWindow = m;
|
||||||
mainWindow->Show();
|
mainWindow->Show();
|
||||||
}
|
}
|
||||||
|
@ -31,7 +33,7 @@ void App::AboutRequested() {
|
||||||
BAboutWindow *about = new BAboutWindow(B_TRANSLATE_SYSTEM_NAME("DumBer"),
|
BAboutWindow *about = new BAboutWindow(B_TRANSLATE_SYSTEM_NAME("DumBer"),
|
||||||
kApplicationSignature);
|
kApplicationSignature);
|
||||||
about->AddDescription(B_TRANSLATE("about_body"));
|
about->AddDescription(B_TRANSLATE("about_body"));
|
||||||
about->AddCopyright(2024-2025, "Santiago Lema");
|
about->AddCopyright(2025, "Santiago Lema");
|
||||||
about->AddText("e-mail me at haiku@lema.org");
|
about->AddText("e-mail me at haiku@lema.org");
|
||||||
about->AddText("or find me on the fediverse as\n@santi@go.lema.org");
|
about->AddText("or find me on the fediverse as\n@santi@go.lema.org");
|
||||||
|
|
||||||
|
|
|
@ -122,12 +122,12 @@ void Conversation::MessageReceived(BMessage *message) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// printf("full Reply as text:%s",body.text.value().String());
|
printf("full Reply as text:%s",body.text.value().String());
|
||||||
json parsed = json::parse(body.text.value().String());
|
json parsed = json::parse(body.text.value().String());
|
||||||
printf("Parsed..\n");
|
printf("Parsed..\n");
|
||||||
|
|
||||||
std::string objType = parsed["object"];
|
std::string objType = parsed["object"];
|
||||||
printf("Reply of type object :%s\n", objType.c_str());
|
// printf("Reply of type object :%s\n", objType.c_str());
|
||||||
|
|
||||||
if (objType == "list") {
|
if (objType == "list") {
|
||||||
// printf("full Reply as text:%s",body.text.value().String());
|
// printf("full Reply as text:%s",body.text.value().String());
|
||||||
|
|
BIN
DumBer
BIN
DumBer
Binary file not shown.
110
MainWindow.cpp
110
MainWindow.cpp
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
|
||||||
|
|
||||||
static int progressAnim = 0;
|
static int progressAnim = 0;
|
||||||
static int progressColor = 0;
|
static int progressColor = 0;
|
||||||
static bool progressColorUp = false;
|
static bool progressColorUp = false;
|
||||||
|
@ -17,6 +18,7 @@ static bool progressColorUp = false;
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <MimeType.h>
|
#include <MimeType.h>
|
||||||
|
#include <Resources.h>
|
||||||
#include <ScrollView.h>
|
#include <ScrollView.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
#include <TranslationUtils.h>
|
#include <TranslationUtils.h>
|
||||||
|
@ -25,7 +27,10 @@ static bool progressColorUp = false;
|
||||||
#include <MessageRunner.h>
|
#include <MessageRunner.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
|
#include <Path.h>
|
||||||
|
|
||||||
#include "Conversation.h"
|
#include "Conversation.h"
|
||||||
|
#include <FindDirectory.h>
|
||||||
|
|
||||||
#undef B_TRANSLATION_CONTEXT
|
#undef B_TRANSLATION_CONTEXT
|
||||||
#define B_TRANSLATION_CONTEXT "Window"
|
#define B_TRANSLATION_CONTEXT "Window"
|
||||||
|
@ -106,9 +111,23 @@ MainWindow::MainWindow()
|
||||||
_answerView->SetFlags(_answerView->Flags() | B_FULL_UPDATE_ON_RESIZE);
|
_answerView->SetFlags(_answerView->Flags() | B_FULL_UPDATE_ON_RESIZE);
|
||||||
_answerScrollView->SetFlags(_answerView->Flags() | B_FULL_UPDATE_ON_RESIZE);
|
_answerScrollView->SetFlags(_answerView->Flags() | B_FULL_UPDATE_ON_RESIZE);
|
||||||
|
|
||||||
|
/*
|
||||||
|
BView *imageView = new BView("icon_view", B_WILL_DRAW | B_FOLLOW_NONE);
|
||||||
|
imageView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
|
BBitmap* oneImage = BTranslationUtils::GetBitmap('RAWT', 77, NULL);
|
||||||
|
imageView->SetViewColor(ui_color(B_CONTROL_BORDER_COLOR));
|
||||||
|
|
||||||
|
if (oneImage) {
|
||||||
|
imageView->SetViewBitmap(oneImage,B_FOLLOW_LEFT_TOP, B_TILE_BITMAP);
|
||||||
|
printf("Image loaded!\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("Image NOT loaded!\n");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
// BView *imageView = new BView("icon_view", B_WILL_DRAW | B_FOLLOW_NONE);
|
|
||||||
// imageView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
|
||||||
|
|
||||||
BStringView *headerQuestion =
|
BStringView *headerQuestion =
|
||||||
new BStringView("questionLabel", "Your question: ");
|
new BStringView("questionLabel", "Your question: ");
|
||||||
|
@ -119,67 +138,62 @@ rgb_color colorQuestion = {100, 100,150, 255};
|
||||||
|
|
||||||
//high color = txt
|
//high color = txt
|
||||||
headerQuestion->SetHighColor(colorQuestion);
|
headerQuestion->SetHighColor(colorQuestion);
|
||||||
headerAnswer->SetHighColor(colorQuestion);
|
headerAnswer->SetHighColor(colorQuestion);
|
||||||
|
|
||||||
|
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||||
|
|
||||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
.AddGlue(0.1)
|
||||||
|
.Add(headerQuestion)
|
||||||
|
.AddGroup(B_HORIZONTAL, 0, 1)
|
||||||
|
|
||||||
|
.Add(_inputField)
|
||||||
|
.AddGlue(0.01)
|
||||||
|
// .Add(imageView)
|
||||||
|
|
||||||
.AddGlue(0.1)
|
.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING, 0)
|
||||||
.Add(headerQuestion)
|
|
||||||
.AddGroup(B_HORIZONTAL, 0, 1)
|
|
||||||
|
|
||||||
.Add(_inputField)
|
|
||||||
.AddGlue(0.01)
|
|
||||||
|
|
||||||
.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING, 0)
|
|
||||||
|
|
||||||
|
|
||||||
. AddGroup(B_HORIZONTAL, 0)
|
|
||||||
.Add(_infoConversation).AddGlue(0.1)
|
|
||||||
.End()
|
|
||||||
. AddGroup(B_HORIZONTAL, 0)
|
|
||||||
.Add(_modelField).AddGlue(0.1)
|
|
||||||
.End()
|
|
||||||
. AddGroup(B_HORIZONTAL, 0)
|
|
||||||
.Add(_sendButton).AddGlue(0.1)
|
|
||||||
.End()
|
|
||||||
|
|
||||||
|
|
||||||
.End()
|
|
||||||
|
|
||||||
|
|
||||||
.End()
|
|
||||||
|
|
||||||
.AddGlue(0.1)
|
.AddGroup(B_HORIZONTAL, 0)
|
||||||
.Add(headerAnswer)
|
.Add(_infoConversation)
|
||||||
.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING, 1.0)
|
.AddGlue(0.1)
|
||||||
|
.End()
|
||||||
|
.AddGroup(B_HORIZONTAL, 0)
|
||||||
|
.Add(_modelField)
|
||||||
|
.AddGlue(0.1)
|
||||||
|
.End()
|
||||||
|
.AddGroup(B_HORIZONTAL, 0)
|
||||||
|
.Add(_sendButton)
|
||||||
|
.AddGlue(0.1)
|
||||||
|
.End()
|
||||||
|
|
||||||
.Add(_answerScrollView, 1)
|
.End()
|
||||||
.Add(_progress,0.1)
|
|
||||||
.Add(_infoView,0.1)
|
|
||||||
.End()
|
|
||||||
.SetInsets(6,6, 6, 6)
|
|
||||||
|
|
||||||
|
.End()
|
||||||
|
|
||||||
|
.AddGlue(0.1)
|
||||||
.End();
|
.Add(headerAnswer)
|
||||||
|
.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING, 1.0)
|
||||||
|
|
||||||
// Loop Just to animate progress in Bar
|
.Add(_answerScrollView, 1)
|
||||||
BMessageRunner *runner = new BMessageRunner(this, // target BHandler
|
.Add(_progress, 0.1)
|
||||||
new BMessage(kPulse),
|
.Add(_infoView, 0.1)
|
||||||
100000 // interval in μs (0 ms)
|
.End()
|
||||||
|
.SetInsets(6, 6, 6, 6)
|
||||||
|
|
||||||
|
.End();
|
||||||
|
|
||||||
|
// Loop Just to animate progress in Bar
|
||||||
|
BMessageRunner *runner = new BMessageRunner(this, // target BHandler
|
||||||
|
new BMessage(kPulse),
|
||||||
|
100000 // interval in μs (0 ms)
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
updateHistoryInfo();
|
||||||
|
|
||||||
updateHistoryInfo();
|
PostMessage(kCheckKey);
|
||||||
|
|
||||||
PostMessage(kCheckKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::checkValidKey() {
|
void MainWindow::checkValidKey() {
|
||||||
|
|
||||||
if (!_conversation->validKey) {
|
if (!_conversation->validKey) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ resource app_version {
|
||||||
short_info = "A simple native Haiku client for ChatGPT",
|
short_info = "A simple native Haiku client for ChatGPT",
|
||||||
long_info = "A simple native Haiku client for ChatGPT that uses simple text and very little memory. It requires having your own API Key."
|
long_info = "A simple native Haiku client for ChatGPT that uses simple text and very little memory. It requires having your own API Key."
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
resource vector_icon {
|
resource vector_icon {
|
||||||
$"6E6369660804016B0500020006023CADEB3D1051BD10513CADEB4C3551C6C7FF"
|
$"6E6369660804016B0500020006023CADEB3D1051BD10513CADEB4C3551C6C7FF"
|
||||||
|
@ -44,3 +45,7 @@ resource vector_icon {
|
||||||
$"0A030103000A040104000A050105000A0600000A01001001178400040A070000"
|
$"0A030103000A040104000A050105000A0600000A01001001178400040A070000"
|
||||||
$"0A04010600"
|
$"0A04010600"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue