Commit bd5e520a authored by Alexander A. Maly's avatar Alexander A. Maly

Dropping DISPLAY env variable support

parent 55a8360d
Pipeline #4047 passed with stages
in 4 minutes and 45 seconds
......@@ -1186,7 +1186,7 @@ class Settings:
result += """
bool guiAvailable = (qobject_cast<QApplication*>(qApp) != 0);
#ifdef Q_OS_LINUX
guiAvailable = 0 != getenv("DISPLAY");
//guiAvailable = 0 != getenv("DISPLAY");
#endif
if (guiAvailable) {
%s = new Widgets::DeclarativeSettingsPage(
......@@ -2703,10 +2703,9 @@ class ModuleBaseCppClass(CppClassBase):
%s::%s(ExtensionSystem::KPlugin* parent)
: QObject(parent)
{
//bool hasGui = true;
bool hasGui = (qobject_cast<QApplication*>(qApp) != 0);
#ifdef Q_OS_LINUX
hasGui = getenv("DISPLAY")!=0;
//hasGui = getenv("DISPLAY")!=0;
#endif
if (hasGui) {
%s
......@@ -2795,10 +2794,9 @@ class ModuleBaseCppClass(CppClassBase):
return """
/* public */ QList<QMenu*> %s::moduleMenus() const
{
//bool hasGui = true;
bool hasGui = (qobject_cast<QApplication*>(qApp) != 0);
#ifdef Q_OS_LINUX
hasGui = getenv("DISPLAY")!=0;
//hasGui = getenv("DISPLAY")!=0;
#endif
if (hasGui) {
QList<QMenu*> result;
......
......@@ -11,6 +11,7 @@ You should change it corresponding to functionality.
#include "sch_game.h"
#include "remotecontrol.h"
#include <QApplication>
#include <QScriptEngine>
#include <QLayout>
#include <QTextStream>
......@@ -89,19 +90,18 @@ void IsometricRobotModule::loadDefaultEnvironment()
QString IsometricRobotModule::initialize(const QStringList &configurationParameters, const ExtensionSystem::CommandLine &cmdLine)
{
QString IsometricRobotModule::initialize(
const QStringList &configurationParameters,
const ExtensionSystem::CommandLine &cmdLine
) {
if (!configurationParameters.contains("tablesOnly")) {
_model = new Robot25D::RobotModel;
bool hasGui = true;
#ifdef Q_OS_LINUX
hasGui = 0 != getenv("DISPLAY");
#endif
bool hasGui = (qobject_cast<QApplication*>(qApp) != 0);
if (hasGui) {
createGui();
} else {
const QString envFileName = cmdLine.value('e').toString();
QString envFileName = cmdLine.value('e').toString();
if (envFileName.isEmpty()) {
loadDefaultEnvironment();
} else {
......
......@@ -290,6 +290,7 @@ QString RobotModule::initialize(
const QStringList &configurationParameters,
const ExtensionSystem::CommandLine &runtimeParameters
) {
QString fName = "";
if (runtimeParameters.value('f').isValid()) {
fName = runtimeParameters.value('f').toString();
......@@ -306,22 +307,18 @@ QString RobotModule::initialize(
#ifdef Q_OS_LINUX
QProcessEnvironment pe = QProcessEnvironment::systemEnvironment();
qDebug() << "Display" << pe.value("DISPLAY");
if (pe.keys().indexOf("DISPLAY") < 0 || pe.value("DISPLAY").isEmpty()) {
DISPLAY = false;
}
#endif
if (!DISPLAY) {
qDebug() << "Robot:Console mode";
qDebug() << "Robot: Console mode";
curConsoleField = new ConsoleField(10, 15);
DISPLAY = false;
if (!fName.isEmpty()) {
qDebug() << "LOAD FIELD ERR CODE:" << curConsoleField->loadFromFile(fName);
}
return "";
}
qDebug() << "Robot:GuiMode";
qDebug() << "Robot: GUI mode";
if (!configurationParameters.contains("tablesOnly")) {
createGui();
......
......@@ -49,12 +49,6 @@ PluginManager::PluginManager()
}
}
#ifdef Q_WS_X11
bool gui = getenv("DISPLAY") != 0;
if (!gui) {
return;
}
#endif
}
......
......@@ -242,6 +242,7 @@ QString PluginManagerImpl::initializePlugin(KPlugin *entryPoint)
return error;
}
qDebug() << "Initializing plugin" << entryPoint->pluginName();
error = entryPoint->initialize(spec.arguments, runtimeParameters);
if (error.length() == 0) {
entryPoint->_state = KPlugin::Initialized;
......
......@@ -6,6 +6,7 @@
#include <QBrush>
#include <QIcon>
#include <QMessageBox>
#include <QApplication>
static const int MARK_BLOCK = 12;
......@@ -34,34 +35,12 @@ courseModel::courseModel() : QAbstractItemModel()
{
isTeacher = false;
itemFont = QFont("Helvetica [Cronyx]");
//#ifdef Q_OS_WIN32
// markIcons.append(QIcon(":/out_stand.png"));
// markIcons.append(QIcon(":/1.png"));
// markIcons.append(QIcon(":/2.png"));
// markIcons.append(QIcon(":/3.png"));
// markIcons.append(QIcon(":/4.png"));
// markIcons.append(QIcon(":/5.png"));
// markIcons.append(QIcon(":/6.png"));
// markIcons.append(QIcon(":/7.png"));
// markIcons.append(QIcon(":/8.png"));
// markIcons.append(QIcon(":/9.png"));
// markIcons.append(QIcon(":/10.png"));
// markIcons.append(QIcon(":/m.png"));
//
// markIcons.append(QIcon(":/folder_close.png"));
// markIcons.append(QIcon(":/folder_1.png"));
// markIcons.append(QIcon(":/folder_2.png"));
// markIcons.append(QIcon(":/folder_3.png"));
// markIcons.append(QIcon(":/folder_4.png"));
// markIcons.append(QIcon(":/folder_5.png"));
// markIcons.append(QIcon(":/folder_6.png"));
// markIcons.append(QIcon(":/folder_7.png"));
// markIcons.append(QIcon(":/folder_8.png"));
// markIcons.append(QIcon(":/folder_9.png"));
// markIcons.append(QIcon(":/folder_10.png"));
// markIcons.append(QIcon(":/folder_open.png"));
// return;
//#endif
bool hasX11 = (qobject_cast<QApplication*>(qApp) != 0);
if (!hasX11) {
return;
}
const ExtensionSystem::KPlugin *csmanager =
ExtensionSystem::PluginManager::instance()
->findKPlugin<Shared::CoursesInterface>();
......@@ -71,11 +50,8 @@ courseModel::courseModel() : QAbstractItemModel()
// QUrl::fromLocalFile(qApp->property("sharePath").toString()+
// "/coursemanager/out_stand.svg"
// ); // WTF?
bool hasX11 = true;
#ifdef Q_OS_LINUX
hasX11 = 0 != getenv("DISPLAY");
#endif
if (hasX11) {
{
markIcons.append(QIcon(resourcesRoot.absoluteFilePath("out_stand.png")));
markIcons.append(QIcon(resourcesRoot.absoluteFilePath("1.png")));
markIcons.append(QIcon(resourcesRoot.absoluteFilePath("2.png")));
......
......@@ -21,30 +21,23 @@ typedef Shared::ActorInterface AI;
namespace CourseManager
{
Plugin::Plugin()
: ExtensionSystem::KPlugin()
, mainWindow_(nullptr)
, actionPerformCheck_(nullptr)
, settingsEditorPage_(nullptr)
, cur_task(nullptr)
Plugin::Plugin() :
ExtensionSystem::KPlugin(),
mainWindow_(nullptr),
actionPerformCheck_(nullptr),
settingsEditorPage_(nullptr),
cur_task(nullptr),
course(nullptr)
{
field_no = 0;
DISPLAY = false;
DISPLAY = (qobject_cast<QApplication*>(qApp) != 0);
#ifdef Q_OS_LINUX
QProcessEnvironment pe = QProcessEnvironment::systemEnvironment();
// qDebug()<<"PE"<<pe.toStringList();
qDebug() << "Display" << pe.value("DISPLAY");
if (pe.value("DISPLAY").isEmpty()) { //NO DISPLAY
qDebug() << "CourseManager:Console mode";
if (!DISPLAY) {
qDebug() << "CourseManager: Console mode";
return;
}
#endif
qDebug() << "CourseManager:GUI Mode";
DISPLAY = true;
qDebug() << "CourseManager: GUI Mode";
courseMenu = new QMenu(trUtf8("Практикум"));
MenuList.append(courseMenu);
rescentMenu = new QMenu(trUtf8("Недавние тетради/курсы..."));
......@@ -271,6 +264,10 @@ int Plugin::checkTaskFromConsole(const int taskID)
void Plugin::start()
{
qDebug() << "Starts with coursemanager";
if (!course) {
return;
}
QList<int> taskIds = course->getIDs();
for (int i = 0; i < taskIds.count(); i++) {
field_no = 0;
......@@ -629,7 +626,6 @@ QString Plugin::initialize(
const QStringList &configurationArguments,
const ExtensionSystem::CommandLine &runtimeArguments
) {
qDebug() << "DIPLSY" << DISPLAY;
if (!DISPLAY) {
if (!runtimeArguments.value('w').isValid()) {
return trUtf8("Нет тетради");
......
......@@ -6,6 +6,7 @@
#include "kumfilehandler.h"
#include "quickreferencewidget.h"
#include <QApplication>
using namespace KumirAnalizer;
......@@ -31,10 +32,7 @@ KumirAnalizerPlugin::~KumirAnalizerPlugin()
QWidget *KumirAnalizerPlugin::languageQuickReferenceWidget()
{
bool hasGui = true;
#ifdef Q_WS_X11
hasGui = getenv("DISPLAY") != 0;
#endif
bool hasGui = (qobject_cast<QApplication*>(qApp) != 0);
if (!_quickReferenceWidget && hasGui) {
_quickReferenceWidget = new QuickReferenceWidget(this);
}
......
......@@ -87,9 +87,6 @@ ExternalModuleLoadFunctor::operator()(
}
bool gui = (qobject_cast<QApplication*>(qApp) != 0);
#ifdef Q_OS_LINUX
gui = gui && getenv("DISPLAY") != 0;
#endif
if (actor && gui && actor->mainWidget()) {
if (!ACTOR_WINDOWS.contains(actor)) {
......
......@@ -9,7 +9,7 @@
#include <kumir2/actorinterface.h>
#include <QWidget>
#include <QCoreApplication>
#include <QApplication>
#include <QDebug>
#include <iostream>
#include <locale.h>
......@@ -482,7 +482,7 @@ void KumirRunPlugin::terminateAndWaitForStopped()
}
pRun_->wait();
#ifdef Q_OS_LINUX
bool gui = getenv("DISPLAY") != 0;
bool gui = (qobject_cast<QApplication*>(qApp) != 0);
if (gui) {
usleep(50000);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment