|
|
|
@@ -49,22 +49,9 @@ App::App(const Wt::WEnvironment &env, Broadcast &server):
|
|
|
|
initApp();
|
|
|
|
initApp();
|
|
|
|
updateLocation();
|
|
|
|
updateLocation();
|
|
|
|
enableUpdates(true);
|
|
|
|
enableUpdates(true);
|
|
|
|
userName = server.userNameForSessionId(sessionId());
|
|
|
|
showStandardPage();
|
|
|
|
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();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
messageReceived_ = std::make_unique<Wt::WSound>("newmessage.mp3");
|
|
|
|
messageReceived_ = std::make_unique<Wt::WSound>("newmessage.mp3");
|
|
|
|
|
|
|
|
onInternalPathChanged(internalPath());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
App::~App() {
|
|
|
|
App::~App() {
|
|
|
|
@@ -84,6 +71,28 @@ void App::initApp() {
|
|
|
|
setCssTheme("");
|
|
|
|
setCssTheme("");
|
|
|
|
useStyleSheet("style.css");
|
|
|
|
useStyleSheet("style.css");
|
|
|
|
messageResourceBundle().use("../docroot/text");
|
|
|
|
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() {
|
|
|
|
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> App::resizeImages(std::list<Magick::Image> &images, int maxWidth, int maxHeight) {
|
|
|
|
std::list<Magick::Image> resizedImages;
|
|
|
|
std::list<Magick::Image> resizedImages;
|
|
|
|
for (auto& img : images) {
|
|
|
|
for (auto& img : images) {
|
|
|
|
// Berechne das Verhältnis des Originalbildes
|
|
|
|
|
|
|
|
double originalWidth = img.columns();
|
|
|
|
double originalWidth = img.columns();
|
|
|
|
double originalHeight = img.rows();
|
|
|
|
double originalHeight = img.rows();
|
|
|
|
double widthRatio = static_cast<double>(maxWidth) / originalWidth;
|
|
|
|
double widthRatio = static_cast<double>(maxWidth) / originalWidth;
|
|
|
|
double heightRatio = static_cast<double>(maxHeight) / originalHeight;
|
|
|
|
double heightRatio = static_cast<double>(maxHeight) / originalHeight;
|
|
|
|
double resizeRatio = std::min(widthRatio, heightRatio); // Nehme das kleinere Verhältnis, um innerhalb der Grenzen zu bleiben
|
|
|
|
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 newWidth = static_cast<int>(originalWidth * resizeRatio);
|
|
|
|
int newHeight = static_cast<int>(originalHeight * resizeRatio);
|
|
|
|
int newHeight = static_cast<int>(originalHeight * resizeRatio);
|
|
|
|
|
|
|
|
|
|
|
|
// Wende die neue Größe an, wenn eine Verkleinerung erforderlich ist
|
|
|
|
|
|
|
|
if (resizeRatio < 1) {
|
|
|
|
if (resizeRatio < 1) {
|
|
|
|
img.resize(Magick::Geometry(newWidth, newHeight));
|
|
|
|
img.resize(Magick::Geometry(newWidth, newHeight));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resizedImages.push_back(img);
|
|
|
|
resizedImages.push_back(img);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resizedImages;
|
|
|
|
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) {
|
|
|
|
Wt::WContainerWidget* App::createSmileyButton(Wt::WHBoxLayout* inputLayout, Wt::WLineEdit* inputLine, std::shared_ptr<int> cursorPosition) {
|
|
|
|
auto smileyButton = inputLayout->addNew<Wt::WContainerWidget>();
|
|
|
|
auto smileyButton = inputLayout->addNew<Wt::WContainerWidget>();
|
|
|
|
smileyButton->addNew<Wt::WImage>(Wt::WLink("/smileys.png"));
|
|
|
|
smileyButton->addNew<Wt::WImage>(Wt::WLink("/smileys.png"));
|
|
|
|
|