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) { | ||||
|   MainWindow *m = new MainWindow(); | ||||
|   m->SetLook(B_DOCUMENT_WINDOW_LOOK); | ||||
|   m->SetFeel(B_NORMAL_WINDOW_FEEL); | ||||
|   mainWindow = m; | ||||
|   mainWindow->Show(); | ||||
| } | ||||
|  | @ -31,7 +33,7 @@ void App::AboutRequested() { | |||
|   BAboutWindow *about = new BAboutWindow(B_TRANSLATE_SYSTEM_NAME("DumBer"), | ||||
|                                          kApplicationSignature); | ||||
|   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("or find me on the fediverse as\n@santi@go.lema.org"); | ||||
| 
 | ||||
|  |  | |||
|  | @ -122,12 +122,12 @@ void Conversation::MessageReceived(BMessage *message) { | |||
| 	   | ||||
|         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()); | ||||
|           printf("Parsed..\n"); | ||||
| 
 | ||||
|           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") { | ||||
|             // printf("full Reply as text:%s",body.text.value().String());
 | ||||
|  |  | |||
							
								
								
									
										
											BIN
										
									
								
								DumBer
									
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								DumBer
									
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										122
									
								
								MainWindow.cpp
									
										
									
									
									
								
							
							
						
						
									
										122
									
								
								MainWindow.cpp
									
										
									
									
									
								
							|  | @ -5,6 +5,7 @@ | |||
| 
 | ||||
| #include "MainWindow.h" | ||||
| 
 | ||||
| 
 | ||||
| static int progressAnim = 0; | ||||
| static int progressColor = 0; | ||||
| static bool progressColorUp = false; | ||||
|  | @ -17,6 +18,7 @@ static bool progressColorUp = false; | |||
| #include <Menu.h> | ||||
| #include <MenuBar.h> | ||||
| #include <MimeType.h> | ||||
| #include <Resources.h> | ||||
| #include <ScrollView.h> | ||||
| #include <StringView.h> | ||||
| #include <TranslationUtils.h> | ||||
|  | @ -25,7 +27,10 @@ static bool progressColorUp = false; | |||
| #include <MessageRunner.h> | ||||
| #include <View.h> | ||||
| 
 | ||||
| #include <Path.h> | ||||
| 
 | ||||
| #include "Conversation.h" | ||||
| #include <FindDirectory.h>  | ||||
| 
 | ||||
| #undef B_TRANSLATION_CONTEXT | ||||
| #define B_TRANSLATION_CONTEXT "Window" | ||||
|  | @ -106,9 +111,23 @@ MainWindow::MainWindow() | |||
| 	_answerView->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 = | ||||
|       new BStringView("questionLabel", "Your question: "); | ||||
|  | @ -121,65 +140,60 @@ rgb_color colorQuestion = {100, 100,150, 255}; | |||
| headerQuestion->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)
 | ||||
| 
 | ||||
|     .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) | ||||
|     .Add(headerAnswer) | ||||
|     .AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING, 1.0) | ||||
| 
 | ||||
|     .Add(_answerScrollView, 1) | ||||
|     .Add(_progress, 0.1) | ||||
|     .Add(_infoView, 0.1) | ||||
|     .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)
 | ||||
| 		 | ||||
| 
 | ||||
| 	      .AddGlue(0.1) | ||||
| 	      .Add(headerQuestion) | ||||
|           .AddGroup(B_HORIZONTAL, 0, 1) | ||||
| ); | ||||
| 
 | ||||
|                      .Add(_inputField) | ||||
| 					 .AddGlue(0.01) | ||||
| updateHistoryInfo(); | ||||
| 
 | ||||
| 					 .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) | ||||
| 			  .Add(headerAnswer) | ||||
|           .AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING, 1.0) | ||||
| 
 | ||||
| 			  .Add(_answerScrollView, 1) | ||||
| 			  .Add(_progress,0.1) | ||||
| 			  .Add(_infoView,0.1) | ||||
| 		  .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(); | ||||
| 
 | ||||
|   PostMessage(kCheckKey); | ||||
| PostMessage(kCheckKey); | ||||
| } | ||||
| 
 | ||||
| 		 | ||||
| void MainWindow::checkValidKey() { | ||||
| 
 | ||||
|   if (!_conversation->validKey) { | ||||
|  |  | |||
|  | @ -17,6 +17,7 @@ resource app_version { | |||
| 	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 { | ||||
| 	$"6E6369660804016B0500020006023CADEB3D1051BD10513CADEB4C3551C6C7FF" | ||||
| 	$"00FFDB97FFFCAF29020006023A647ABA3F0A3A3F0A3A647AC92D47CA165100FF" | ||||
|  | @ -44,3 +45,7 @@ resource vector_icon { | |||
| 	$"0A030103000A040104000A050105000A0600000A01001001178400040A070000" | ||||
| 	$"0A04010600" | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue