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.

70 lines
1.8 KiB

3 years ago
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2020-2021, The Monero Project.
#include <QPixmap>
#include <QMessageBox>
#include <QDesktopServices>
#include <QCoreApplication>
#include <QSystemTrayIcon>
#include <QMessageBox>
#include <QGroupBox>
#include <QFileDialog>
#include "mainwindow.h"
#include "config-conversations.h"
#include "lib/globals.h"
#include "ui_mainwindow.h"
// libwalletqt
//#include "libwalletqt/AddressBook.h"
MainWindow * MainWindow::pMainWindow = nullptr;
MainWindow::MainWindow(ConvContext *ctx, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
m_ctx(ctx) {
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);
this->show();
#ifdef Q_WS_MAEMO_5
window->setProperty("X-Maemo-Orientation", 2); // XXX: 2 = auto orientation
#endif
ui->webWidget->load(QUrl("qrc:/chat/conversation.html"));
}
void MainWindow::showDebugInfo() {
// auto *dialog = new DebugInfoDialog(m_ctx, this);
// dialog->exec();
// dialog->deleteLater();
printf("oki\n");
}
MainWindow *MainWindow::getInstance() {
return pMainWindow;
}
ConvContext *MainWindow::getContext(){
return pMainWindow->m_ctx;
}
void MainWindow::closeEvent(QCloseEvent *event) {
QWidget::closeEvent(event);
}
MainWindow::~MainWindow() {
delete ui;
}