fix: don't compile swp files & feat: add connection middleman
This commit is contained in:
parent
52a92b1065
commit
258d520ede
6 changed files with 58 additions and 14 deletions
2
Makefile
2
Makefile
|
@ -5,7 +5,7 @@ FLAGS=-lbe -std=c++20 -lstdc++
|
|||
all: build
|
||||
|
||||
build:
|
||||
$(CPP) $(shell find ./src | grep cpp) -o $(BINARY) $(FLAGS)
|
||||
$(CPP) $(shell find ./src | grep cpp | grep -v swp) -o $(BINARY) $(FLAGS)
|
||||
test: build
|
||||
./renga
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
App::App(void) : BApplication(kSignature)
|
||||
{
|
||||
MainWindow *mainWindow = new MainWindow();
|
||||
MainWindow *mainWindow = new MainWindow(this);
|
||||
mainWindow->Show();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,12 +17,13 @@
|
|||
#include <GridLayoutBuilder.h>
|
||||
#include <Button.h>
|
||||
#include <cstdio>
|
||||
#include "Contacts.h"
|
||||
#include <TextControl.h>
|
||||
#include "Middleman.h"
|
||||
|
||||
MainWindow::MainWindow(void)
|
||||
MainWindow::MainWindow(App *app)
|
||||
: BWindow(BRect(100, 100, 500, 400), "Renga", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE)
|
||||
{
|
||||
Application = app;
|
||||
// parent layout (defines the entire window layout)
|
||||
BGroupLayout *pGroup = new BGroupLayout(B_HORIZONTAL);
|
||||
SetLayout(pGroup);
|
||||
|
@ -47,17 +48,17 @@ MainWindow::MainWindow(void)
|
|||
BButton *connectButton = new BButton(Frame(), "connect", "Connect!", new BMessage(msgConnectButtonClicked));
|
||||
connectButton->SetTarget(this);
|
||||
|
||||
BTextControl *jidInput = new BTextControl("jidinput", "JID:", "Placeholder", NULL);
|
||||
BTextControl *pwInput = new BTextControl("pwinput", "Password:", "Placeholder", NULL);
|
||||
JidInputBox = new BTextControl("jidinput", "JID:", NULL, NULL);
|
||||
PwInputBox = new BTextControl("pwinput", "Password:", NULL, NULL);
|
||||
|
||||
pwInput->TextView()->HideTyping(true);
|
||||
PwInputBox->TextView()->HideTyping(true);
|
||||
|
||||
jidInput->SetExplicitSize(BSize(200,23));
|
||||
pwInput->SetExplicitSize(BSize(200,23));
|
||||
JidInputBox->SetExplicitSize(BSize(200,23));
|
||||
PwInputBox->SetExplicitSize(BSize(200,23));
|
||||
|
||||
uiElems->AddView(banner, 0, 0);
|
||||
uiElems->AddView(jidInput, 0, 1);
|
||||
uiElems->AddView(pwInput, 0, 2);
|
||||
uiElems->AddView(JidInputBox, 0, 1);
|
||||
uiElems->AddView(PwInputBox, 0, 2);
|
||||
uiElems->AddView(connectButton, 0, 3);
|
||||
uiElems->SetMinRowHeight(3, 75);
|
||||
uiElems->SetMinRowHeight(0, 25);
|
||||
|
@ -74,8 +75,9 @@ void MainWindow::MessageReceived(BMessage *msg)
|
|||
printf("Connect button clicked...\n");
|
||||
|
||||
Hide();
|
||||
Contacts *contacts = new Contacts();
|
||||
contacts->Show();
|
||||
Middleman *middleman = new Middleman(JidInputBox->Text(), PwInputBox->Text(), Application);
|
||||
middleman->Show();
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -4,16 +4,22 @@
|
|||
#include <Message.h>
|
||||
#include <Window.h>
|
||||
#include <Application.h>
|
||||
#include "../App.h"
|
||||
#include <gloox/connectionlistener.h>
|
||||
#include <gloox/presencehandler.h>
|
||||
#include <TextControl.h>
|
||||
|
||||
const uint32 msgConnectButtonClicked = 'mCBC';
|
||||
|
||||
class MainWindow : public BWindow
|
||||
{
|
||||
public:
|
||||
MainWindow(void);
|
||||
MainWindow(App *app);
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
private:
|
||||
App *Application;
|
||||
BTextControl *JidInputBox;
|
||||
BTextControl *PwInputBox;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
23
src/gui/Middleman.cpp
Normal file
23
src/gui/Middleman.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#include "Middleman.h"
|
||||
#include <Application.h>
|
||||
#include <GroupLayout.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <Rect.h>
|
||||
#include <Window.h>
|
||||
#include <StringView.h>
|
||||
#include "../App.h"
|
||||
#include <format>
|
||||
|
||||
// Connection middleman window.
|
||||
// This window, when called, automatically sets up a connection to the XMPP server.
|
||||
Middleman::Middleman(const char* jid, const char* password, App *app)
|
||||
: BWindow(BRect(200,200,600,400), TITLE, B_TITLED_WINDOW, B_NOT_MINIMIZABLE | B_QUIT_ON_WINDOW_CLOSE)
|
||||
{
|
||||
BGroupLayout *group = new BGroupLayout(B_VERTICAL);
|
||||
SetLayout(group);
|
||||
|
||||
group->View()->AdoptSystemColors();
|
||||
|
||||
group->AddView(new BStringView("label", "Placeholder label (connection middleman to be added)"));
|
||||
group->AddView(new BStringView("label", std::format("JID: {}\nPassword: {}", jid, password).c_str()));
|
||||
}
|
13
src/gui/Middleman.h
Normal file
13
src/gui/Middleman.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#ifndef MIDDLEMAN_H
|
||||
#define MIDDLEMAN_H
|
||||
|
||||
#include <Window.h>
|
||||
#include "../App.h"
|
||||
#define TITLE "Connecting..."
|
||||
|
||||
class Middleman : public BWindow {
|
||||
public:
|
||||
Middleman(const char* jid, const char* password, App *app);
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue