Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kumir2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kumir
kumir2
Commits
bd5e520a
Commit
bd5e520a
authored
Jun 29, 2021
by
Alexander A. Maly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dropping DISPLAY env variable support
parent
55a8360d
Pipeline
#4646
passed with stages
in 4 minutes and 39 seconds
Changes
10
Pipelines
33
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
42 additions
and
85 deletions
+42
-85
scripts/gen_actor_source.py
scripts/gen_actor_source.py
+3
-5
src/actors/isometricrobot/isometricrobotmodule.cpp
src/actors/isometricrobot/isometricrobotmodule.cpp
+7
-7
src/actors/robot/robotmodule.cpp
src/actors/robot/robotmodule.cpp
+3
-6
src/kumir2-libs/extensionsystem/pluginmanager.cpp
src/kumir2-libs/extensionsystem/pluginmanager.cpp
+0
-6
src/kumir2-libs/extensionsystem/pluginmanager_impl.cpp
src/kumir2-libs/extensionsystem/pluginmanager_impl.cpp
+1
-0
src/plugins/coursemanager/course_model.cpp
src/plugins/coursemanager/course_model.cpp
+9
-33
src/plugins/coursemanager/coursemanager_plugin.cpp
src/plugins/coursemanager/coursemanager_plugin.cpp
+15
-19
src/plugins/kumiranalizer/kumiranalizerplugin.cpp
src/plugins/kumiranalizer/kumiranalizerplugin.cpp
+2
-4
src/plugins/kumircoderun/consolerun.cpp
src/plugins/kumircoderun/consolerun.cpp
+0
-3
src/plugins/kumircoderun/runplugin.cpp
src/plugins/kumircoderun/runplugin.cpp
+2
-2
No files found.
scripts/gen_actor_source.py
View file @
bd5e520a
...
...
@@ -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;
...
...
src/actors/isometricrobot/isometricrobotmodule.cpp
View file @
bd5e520a
...
...
@@ -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
{
...
...
src/actors/robot/robotmodule.cpp
View file @
bd5e520a
...
...
@@ -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:
GuiM
ode"
;
qDebug
()
<<
"Robot:
GUI m
ode"
;
if
(
!
configurationParameters
.
contains
(
"tablesOnly"
))
{
createGui
();
...
...
src/kumir2-libs/extensionsystem/pluginmanager.cpp
View file @
bd5e520a
...
...
@@ -49,12 +49,6 @@ PluginManager::PluginManager()
}
}
#ifdef Q_WS_X11
bool
gui
=
getenv
(
"DISPLAY"
)
!=
0
;
if
(
!
gui
)
{
return
;
}
#endif
}
...
...
src/kumir2-libs/extensionsystem/pluginmanager_impl.cpp
View file @
bd5e520a
...
...
@@ -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
;
...
...
src/plugins/coursemanager/course_model.cpp
View file @
bd5e520a
...
...
@@ -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"
)));
...
...
src/plugins/coursemanager/coursemanager_plugin.cpp
View file @
bd5e520a
...
...
@@ -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
(
"Нет тетради"
);
...
...
src/plugins/kumiranalizer/kumiranalizerplugin.cpp
View file @
bd5e520a
...
...
@@ -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
);
}
...
...
src/plugins/kumircoderun/consolerun.cpp
View file @
bd5e520a
...
...
@@ -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
))
{
...
...
src/plugins/kumircoderun/runplugin.cpp
View file @
bd5e520a
...
...
@@ -9,7 +9,7 @@
#include <kumir2/actorinterface.h>
#include <QWidget>
#include <Q
Core
Application>
#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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment