You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.6 KiB

#include <QPixmap>
#include <QMessageBox>
#include <QDesktopServices>
#include <QCoreApplication>
#include <QSystemTrayIcon>
#include <QQmlContext>
#include <QMessageBox>
#include <QGroupBox>
#include <QFileDialog>
#include "settings.h"
#include "config-conversations.h"
#include "lib/globals.h"
#include "ui_settings.h"
Settings * Settings::pSettings = nullptr;
Settings::Settings(Conversations *ctx, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Settings),
m_ctx(ctx) {
pSettings = this;
ui->setupUi(this);
#ifdef MAEMO
setProperty("X-Maemo-StackedWindow", 1);
#endif
QPixmap p_theme_default(":theme_default.png");
QPixmap p_theme_uwot(":theme_uwot.png");
ui->label_default_img->setPixmap(p_theme_default);
ui->label_uwot_img->setPixmap(p_theme_uwot);
auto theme = config()->get(ConfigKeys::ChatTheme).toString();
if(theme == "uwot")
ui->radio_theme_uwot->setChecked(true);
else
ui->radio_theme_default->setChecked(true);
connect(ui->themeRadioGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked), [=](QAbstractButton *button) {
auto name = button->objectName();
if(name == "radio_theme_default") {
config()->set(ConfigKeys::ChatTheme, "default");
} else if(name == "radio_theme_uwot") {
config()->set(ConfigKeys::ChatTheme, "uwot");
}
});
//connect(this->ui->btnSend, &QPushButton::clicked, this, &Settings::onGatherMessage);
}
Conversations *Settings::getContext(){
return pSettings->m_ctx;
}
void Settings::closeEvent(QCloseEvent *event) {
QWidget::closeEvent(event);
}
Settings::~Settings() {
delete ui;
}