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.

78 lines
2.0 KiB

#include <QPixmap>
#include <QMessageBox>
#include <QDesktopServices>
#include <QCoreApplication>
#include <QSystemTrayIcon>
#include <QMessageBox>
#include <QWebEnginePage>
#include <QGroupBox>
#include <QFileDialog>
#include "mainwindow.h"
#include "config-conversations.h"
#include "lib/globals.h"
#include "ui_mainwindow.h"
MainWindow * MainWindow::pMainWindow = nullptr;
MainWindow::MainWindow(Conversations *ctx, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
m_ctx(ctx) {
#ifdef Q_WS_MAEMO_5
setProperty("X-Maemo-StackedWindow", 1);
window->setProperty("X-Maemo-Orientation", 2); // XXX: 2 = auto orientation
qInfo() << "ifdef Q_WS_MAEMO_5 OK!";
#else
qInfo() << "ifdef Q_WS_MAEMO_5 FAILED!";
#endif
pMainWindow = this;
ui->setupUi(this);
this->screenDpiRef = 128;
this->screenGeo = QApplication::primaryScreen()->availableGeometry();
this->screenRect = QGuiApplication::primaryScreen()->geometry();
this->screenDpi = QGuiApplication::primaryScreen()->logicalDotsPerInch();
this->screenDpiPhysical = QGuiApplication::primaryScreen()->physicalDotsPerInch();
this->screenRatio = this->screenDpiPhysical / this->screenDpiRef;
qInfo()
<< QString("%1x%2 (%3 DPI)").arg(this->screenRect.width()).arg(this->screenRect.height()).arg(this->screenDpi);
connect(m_ctx, &Conversations::setTitle, this, &QMainWindow::setWindowTitle);
connect(ui->btn, &QPushButton::clicked, this, &MainWindow::bla);
this->show();
}
void MainWindow::bla() {
int wegeiwog = 1;
if(m_chatWindow != nullptr) return;
m_chatWindow = new ChatWindow(m_ctx, this);
m_chatWindow->show();
}
void MainWindow::showDebugInfo() {
// auto *dialog = new DebugInfoDialog(m_ctx, this);
// dialog->exec();
// dialog->deleteLater();
printf("oki\n");
}
MainWindow *MainWindow::getInstance() {
return pMainWindow;
}
Conversations *MainWindow::getContext(){
return pMainWindow->m_ctx;
}
void MainWindow::closeEvent(QCloseEvent *event) {
QWidget::closeEvent(event);
}
MainWindow::~MainWindow() {
delete ui;
}