2021-06-10 18:54:54 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020 ~ 2021 Deepin Technology Co., Ltd.
|
|
|
|
*
|
|
|
|
* Author: He MingYang Hao<hemingyang@uniontech.com>
|
|
|
|
*
|
|
|
|
* Maintainer: He MingYang <hemingyang@uniontech.com>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "mainwidget.h"
|
|
|
|
#include "service/dbusocr_adaptor.h"
|
|
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QDBusConnection>
|
2021-06-16 17:19:22 +08:00
|
|
|
|
2021-06-10 18:54:54 +08:00
|
|
|
#include <DTitlebar>
|
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
|
|
: DMainWindow(parent)
|
|
|
|
{
|
2021-06-11 11:38:52 +08:00
|
|
|
setAttribute(Qt::WA_DeleteOnClose);
|
2021-06-10 18:54:54 +08:00
|
|
|
if (!m_mainWidget) {
|
|
|
|
m_mainWidget = new MainWidget(this);
|
|
|
|
}
|
|
|
|
this->setCentralWidget(m_mainWidget);
|
2021-06-15 11:34:49 +08:00
|
|
|
this->resize(840, 550);
|
|
|
|
this->setMinimumSize(840, 550);
|
2021-06-10 18:54:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MainWindow::openFile(const QString &filePaths)
|
|
|
|
{
|
2021-06-25 11:02:29 +08:00
|
|
|
//更改打开判断文件是否是图片文件
|
|
|
|
return m_mainWidget->openImage(filePaths);;
|
2021-06-10 18:54:54 +08:00
|
|
|
}
|
|
|
|
|
2021-06-23 11:39:32 +08:00
|
|
|
bool MainWindow::openImage(const QImage &image, const QString &name)
|
2021-06-10 18:54:54 +08:00
|
|
|
{
|
2021-06-23 14:10:48 +08:00
|
|
|
m_mainWidget->openImage(image, name);
|
2021-06-10 18:54:54 +08:00
|
|
|
return true;
|
|
|
|
}
|