Added links page
This commit is contained in:
56
src/app.cpp
56
src/app.cpp
@@ -49,22 +49,9 @@ App::App(const Wt::WEnvironment &env, Broadcast &server):
|
||||
initApp();
|
||||
updateLocation();
|
||||
enableUpdates(true);
|
||||
userName = server.userNameForSessionId(sessionId());
|
||||
auto verticalContainer = createVerticalLayout();
|
||||
createHeadContainer(verticalContainer);
|
||||
createMenuContainer(verticalContainer);
|
||||
auto horizontalContainer = createActionLayout(verticalContainer);
|
||||
createUserListContainer(horizontalContainer);
|
||||
createContentContainer(horizontalContainer);
|
||||
createImprintContainer(verticalContainer);
|
||||
reSetUser();
|
||||
if (userName == "") {
|
||||
showLogin();
|
||||
// Wt::WMessageBox::show("Cookie information", "By technical reasons we set a cookie. This cookie isn't tracking anything or will be saved in a database.", Wt::StandardButton::Ok);
|
||||
} else {
|
||||
startChat();
|
||||
}
|
||||
showStandardPage();
|
||||
messageReceived_ = std::make_unique<Wt::WSound>("newmessage.mp3");
|
||||
onInternalPathChanged(internalPath());
|
||||
}
|
||||
|
||||
App::~App() {
|
||||
@@ -84,6 +71,28 @@ void App::initApp() {
|
||||
setCssTheme("");
|
||||
useStyleSheet("style.css");
|
||||
messageResourceBundle().use("../docroot/text");
|
||||
internalPathChanged().connect(this, &App::onInternalPathChanged);
|
||||
}
|
||||
|
||||
void App::showStandardPage() {
|
||||
userName = server_.userNameForSessionId(sessionId());
|
||||
if (root()) {
|
||||
root()->clear();
|
||||
initApp();
|
||||
}
|
||||
auto verticalContainer = createVerticalLayout();
|
||||
createHeadContainer(verticalContainer);
|
||||
createMenuContainer(verticalContainer);
|
||||
auto horizontalContainer = createActionLayout(verticalContainer);
|
||||
createUserListContainer(horizontalContainer);
|
||||
createContentContainer(horizontalContainer);
|
||||
createImprintContainer(verticalContainer);
|
||||
reSetUser();
|
||||
if (userName == "") {
|
||||
showLogin();
|
||||
} else {
|
||||
startChat();
|
||||
}
|
||||
}
|
||||
|
||||
void App::reSetUser() {
|
||||
@@ -495,27 +504,32 @@ void App::imageUploaded(Wt::WFileUpload *fileWidget, std::shared_ptr<Magick::Blo
|
||||
std::list<Magick::Image> App::resizeImages(std::list<Magick::Image> &images, int maxWidth, int maxHeight) {
|
||||
std::list<Magick::Image> resizedImages;
|
||||
for (auto& img : images) {
|
||||
// Berechne das Verhältnis des Originalbildes
|
||||
double originalWidth = img.columns();
|
||||
double originalHeight = img.rows();
|
||||
double widthRatio = static_cast<double>(maxWidth) / originalWidth;
|
||||
double heightRatio = static_cast<double>(maxHeight) / originalHeight;
|
||||
double resizeRatio = std::min(widthRatio, heightRatio); // Nehme das kleinere Verhältnis, um innerhalb der Grenzen zu bleiben
|
||||
|
||||
// Berechne die neuen Dimensionen, um die Proportionen beizubehalten
|
||||
int newWidth = static_cast<int>(originalWidth * resizeRatio);
|
||||
int newHeight = static_cast<int>(originalHeight * resizeRatio);
|
||||
|
||||
// Wende die neue Größe an, wenn eine Verkleinerung erforderlich ist
|
||||
if (resizeRatio < 1) {
|
||||
img.resize(Magick::Geometry(newWidth, newHeight));
|
||||
}
|
||||
|
||||
resizedImages.push_back(img);
|
||||
}
|
||||
return resizedImages;
|
||||
}
|
||||
|
||||
void App::onInternalPathChanged(const std::string &path) {
|
||||
std::cout << __LINE__ << "'" << path << "'" << std::endl << std::endl;
|
||||
if (path.empty() || path == "/") {
|
||||
showStandardPage();
|
||||
} else if (path == "/partners") {
|
||||
showPartnerSites();
|
||||
} else {
|
||||
setInternalPath("/", true);
|
||||
}
|
||||
}
|
||||
|
||||
Wt::WContainerWidget* App::createSmileyButton(Wt::WHBoxLayout* inputLayout, Wt::WLineEdit* inputLine, std::shared_ptr<int> cursorPosition) {
|
||||
auto smileyButton = inputLayout->addNew<Wt::WContainerWidget>();
|
||||
smileyButton->addNew<Wt::WImage>(Wt::WLink("/smileys.png"));
|
||||
|
||||
Reference in New Issue
Block a user