Files

102 lines
3.2 KiB
C++
Raw Permalink Normal View History

2020-01-07 20:24:03 +08:00
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* 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, or (at your option)
* 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/&gt;.
*
*/
2019-08-24 15:56:39 +08:00
#include "src/MainWindow/mainwindow.h"
#include <QtSingleApplication>
2019-08-24 15:56:39 +08:00
#include <QDesktopWidget>
#include <QFile>
2020-01-16 09:24:34 +08:00
#include <QScreen>
2020-01-19 14:18:35 +08:00
#include <QTranslator>
#include <QLocale>
2020-07-25 17:22:16 +08:00
#include <X11/Xlib.h>
#include <syslog.h>
2020-10-13 18:08:05 +08:00
#include "src/UtilityFunction/proxystyle.h"
2020-07-25 17:22:16 +08:00
2019-08-24 15:56:39 +08:00
int main(int argc, char *argv[])
{
2020-05-25 21:49:27 +08:00
qRegisterMetaType<QVector<QStringList>>("QVector<QStringList>");
2020-07-25 17:22:16 +08:00
2020-09-09 17:05:52 +08:00
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
2020-07-25 17:22:16 +08:00
QtSingleApplication app("ukui-menu", argc, argv);
2019-10-28 18:52:43 +08:00
app.setQuitOnLastWindowClosed(false);
2019-12-28 17:39:55 +08:00
if(app.isRunning())
{
app.sendMessage("raise_window_noop");
return EXIT_SUCCESS;
}
2019-08-24 15:56:39 +08:00
2020-10-12 19:42:23 +08:00
// auto Style=new ProxyStyle;
// app.setStyle(Style);
2020-01-19 14:18:35 +08:00
QTranslator translator;
2020-07-16 14:44:36 +08:00
if (translator.load(QLocale(), "ukui-menu", "_", QM_FILES_INSTALL_PATH))
app.installTranslator(&translator);
else
qDebug() << "Load translations file" << QLocale() << "failed!";
2020-01-19 14:18:35 +08:00
2019-08-24 15:56:39 +08:00
MainWindow w;
app.setActivationWindow(&w);
2020-11-18 14:49:24 +08:00
// w.setProperty("useSystemStyleBlur", true);
2020-09-29 15:33:03 +08:00
2020-10-14 18:29:30 +08:00
//测试
2020-10-11 15:34:52 +08:00
// int position=0;
// int panelSize=0;
// if(QGSettings::isSchemaInstalled(QString("org.ukui.panel.settings").toLocal8Bit()))
// {
// QGSettings* gsetting=new QGSettings(QString("org.ukui.panel.settings").toLocal8Bit());
// if(gsetting->keys().contains(QString("panelposition")))
// position=gsetting->get("panelposition").toInt();
// else
// position=0;
// if(gsetting->keys().contains(QString("panelsize")))
// panelSize=gsetting->get("panelsize").toInt();
// else
// panelSize=46;
// }
// else
// {
// position=0;
// panelSize=46;
// }
2020-01-16 09:24:34 +08:00
2020-10-11 15:34:52 +08:00
// int x=QApplication::primaryScreen()->geometry().x();
// int y=QApplication::primaryScreen()->geometry().y();
2020-06-13 10:30:31 +08:00
2020-10-11 15:34:52 +08:00
// if(position==0)
// w.setGeometry(QRect(x+8,y+QApplication::primaryScreen()->geometry().height()-panelSize-Style::minh-8,
// Style::minw,Style::minh));
// else if(position==1)
// w.setGeometry(QRect(x+8,y+panelSize+8,Style::minw,Style::minh));
// else if(position==2)
// w.setGeometry(QRect(x+panelSize+8,y+8,Style::minw,Style::minh));
// else
// w.setGeometry(QRect(x+QApplication::primaryScreen()->geometry().width()-panelSize-Style::minw-8,y+8,
// Style::minw,Style::minh));
// w.show();
// w.raise();
2020-10-12 19:42:23 +08:00
// w.update();
2020-10-11 15:34:52 +08:00
// w.activateWindow();
2020-10-14 18:29:30 +08:00
//测试
2020-01-16 09:24:34 +08:00
return app.exec();
2019-08-24 15:56:39 +08:00
}