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
d4124f27
Commit
d4124f27
authored
Aug 28, 2013
by
Victor Yacovlev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small fixes on refactoring Editor/Analizer
parent
81e07857
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
21 deletions
+84
-21
src/plugins/coregui/terminal.cpp
src/plugins/coregui/terminal.cpp
+5
-1
src/plugins/editor/editor.cpp
src/plugins/editor/editor.cpp
+1
-1
src/plugins/editor/editorplugin.cpp
src/plugins/editor/editorplugin.cpp
+3
-1
src/plugins/editor/settingspage.cpp
src/plugins/editor/settingspage.cpp
+15
-0
src/shared/docbookviewer/contentview.cpp
src/shared/docbookviewer/contentview.cpp
+15
-14
src/shared/widgets/multipagedialog_impl.cpp
src/shared/widgets/multipagedialog_impl.cpp
+42
-4
src/shared/widgets/multipagedialog_impl.h
src/shared/widgets/multipagedialog_impl.h
+3
-0
No files found.
src/plugins/coregui/terminal.cpp
View file @
d4124f27
...
...
@@ -249,7 +249,11 @@ void Term::clear()
void
Term
::
start
(
const
QString
&
fileName
)
{
int
fixedWidth
=
-
1
;
OneSession
*
session
=
new
OneSession
(
fixedWidth
,
QFileInfo
(
fileName
).
fileName
(),
m_plane
);
OneSession
*
session
=
new
OneSession
(
fixedWidth
,
fileName
.
isEmpty
()
?
tr
(
"New Program"
)
:
QFileInfo
(
fileName
).
fileName
(),
m_plane
);
session
->
relayout
(
m_plane
->
width
());
connect
(
session
,
SIGNAL
(
updateRequest
()),
m_plane
,
SLOT
(
update
()));
sessions_
<<
session
;
...
...
src/plugins/editor/editor.cpp
View file @
d4124f27
...
...
@@ -194,7 +194,7 @@ void Editor::loadMacros()
}
using
namespace
Shared
;
using
namespace
ExtensionSystem
;
const
QString
analizerName
=
analizerPlugin_
->
defaultDocumentFileNameSuffix
()
.
mid
(
1
)
;
const
QString
analizerName
=
analizerPlugin_
->
defaultDocumentFileNameSuffix
();
// System macros
const
QString
sharePath
=
QCoreApplication
::
instance
()
->
property
(
"sharePath"
).
toString
();
...
...
src/plugins/editor/editorplugin.cpp
View file @
d4124f27
...
...
@@ -54,12 +54,14 @@ Editor::InstanceInterface * EditorPlugin::newDocument(
connectGlobalSignalsToEditor
(
editor
);
if
(
analizerPlugin
)
{
const
QString
initialTextFileName
=
QString
initialTextFileName
=
mySettings
()
->
value
(
SettingsPage
::
KeyProgramTemplateFile
+
"."
+
analizerPlugin
->
defaultDocumentFileNameSuffix
(),
SettingsPage
::
DefaultProgramTemplateFile
+
"."
+
analizerPlugin
->
defaultDocumentFileNameSuffix
()
).
toString
();
static
const
QString
resourcesRoot
=
QDir
(
qApp
->
applicationDirPath
()
+
"/../share/kumir2/"
).
canonicalPath
();
initialTextFileName
.
replace
(
"${RESOURCES}"
,
resourcesRoot
);
QFile
f
(
initialTextFileName
);
if
(
f
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
{
const
QByteArray
bytes
=
f
.
readAll
();
...
...
src/plugins/editor/settingspage.cpp
View file @
d4124f27
#include "settingspage.h"
#include "ui_settingspage.h"
#include "extensionsystem/pluginmanager.h"
#include "interfaces/analizerinterface.h"
namespace
Editor
{
QString
SettingsPage
::
KeyInvertColorsIfDarkSystemTheme
=
"Highlight/InvertColorsIfDarkTheme"
;
...
...
@@ -256,6 +259,18 @@ void SettingsPage::init()
ui
->
freeCursorPositioning
->
setCurrentIndex
(
freeCursorMovement
);
QString
initialFileName
=
DefaultProgramTemplateFile
;
Shared
::
AnalizerInterface
*
analizer
=
ExtensionSystem
::
PluginManager
::
instance
()
->
findPlugin
<
Shared
::
AnalizerInterface
>
();
if
(
analizer
)
{
initialFileName
+=
"."
+
analizer
->
defaultDocumentFileNameSuffix
();
}
else
{
initialFileName
+=
".txt"
;
}
static
const
QString
resourcesRoot
=
QDir
(
qApp
->
applicationDirPath
()
+
"/../share/kumir2/"
).
canonicalPath
();
initialFileName
.
replace
(
"${RESOURCES}"
,
resourcesRoot
);
ui
->
templateFileName
->
setText
(
QDir
::
toNativeSeparators
(
...
...
src/shared/docbookviewer/contentview.cpp
View file @
d4124f27
...
...
@@ -33,20 +33,21 @@ ContentView::ContentView(QWidget *parent)
this
,
SLOT
(
clearLastAnchorUrl
()));
ignoreClearAnchorUrl_
=
false
;
// if (!ExtraFontsLoaded_) {
// const QString resourcesRoot = QCoreApplication::instance()->property("sharePath").toString();
// const QDir fontsDir = QDir(resourcesRoot + "/docbookviewer");
// const QStringList ttfFiles = fontsDir.entryList(QStringList() << "*.ttf" << "*.otf");
// foreach (const QString & fileName, ttfFiles) {
// const QString filePath = fontsDir.absoluteFilePath(fileName);
// int id = QFontDatabase::addApplicationFont(filePath);
// if (id == -1) {
// qWarning() << "Can't load font " << filePath;
// }
// }
// ExtraFontsLoaded_ = true;
// }
#ifdef Q_OS_WIN32
if
(
!
ExtraFontsLoaded_
)
{
const
QString
resourcesRoot
=
QCoreApplication
::
instance
()
->
property
(
"sharePath"
).
toString
();
const
QDir
fontsDir
=
QDir
(
resourcesRoot
+
"/docbookviewer"
);
const
QStringList
ttfFiles
=
fontsDir
.
entryList
(
QStringList
()
<<
"*.ttf"
<<
"*.otf"
);
foreach
(
const
QString
&
fileName
,
ttfFiles
)
{
const
QString
filePath
=
fontsDir
.
absoluteFilePath
(
fileName
);
int
id
=
QFontDatabase
::
addApplicationFont
(
filePath
);
if
(
id
==
-
1
)
{
qWarning
()
<<
"Can't load font "
<<
filePath
;
}
}
ExtraFontsLoaded_
=
true
;
}
#endif
}
QSize
ContentView
::
minimumSizeHint
()
const
...
...
src/shared/widgets/multipagedialog_impl.cpp
View file @
d4124f27
...
...
@@ -5,7 +5,8 @@
#include <QMetaObject>
#include <QMetaMethod>
#include <QListWidgetItem>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QPushButton>
namespace
Widgets
{
...
...
@@ -17,14 +18,30 @@ MultiPageDialogImpl::MultiPageDialogImpl(class MultiPageDialog * parent)
void
MultiPageDialogImpl
::
setupUi
()
{
QGridLayout
*
grid
=
new
QGridLayout
;
pClass_
->
setMinimumSize
(
400
,
300
);
pClass_
->
setLayout
(
new
QHBoxLayout
);
pClass_
->
setLayout
(
grid
);
list_
=
new
QListWidget
(
pClass_
);
pClass_
->
layout
()
->
addWidget
(
list_
);
grid
->
addWidget
(
list_
,
0
,
0
);
stack_
=
new
QStackedWidget
(
pClass_
);
pClass_
->
layout
()
->
addWidget
(
stack_
);
grid
->
addWidget
(
stack_
,
0
,
1
);
connect
(
list_
,
SIGNAL
(
currentRowChanged
(
int
)),
this
,
SLOT
(
handleGroupSelected
(
int
)));
buttonBox_
=
new
QDialogButtonBox
(
pClass_
);
grid
->
addWidget
(
buttonBox_
,
1
,
0
,
1
,
2
);
QPushButton
*
btnAccept
=
buttonBox_
->
addButton
(
tr
(
"OK"
),
QDialogButtonBox
::
AcceptRole
);
connect
(
btnAccept
,
SIGNAL
(
clicked
()),
pClass_
,
SLOT
(
accept
()));
QPushButton
*
btnCancel
=
buttonBox_
->
addButton
(
tr
(
"Cancel"
),
QDialogButtonBox
::
RejectRole
);
connect
(
btnCancel
,
SIGNAL
(
clicked
()),
pClass_
,
SLOT
(
reject
()));
QPushButton
*
btnReset
=
buttonBox_
->
addButton
(
tr
(
"Reset to Defaults"
),
QDialogButtonBox
::
ResetRole
);
connect
(
btnReset
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
resetAllPages
()));
}
void
MultiPageDialogImpl
::
acceptAllPages
()
...
...
@@ -47,6 +64,27 @@ void MultiPageDialogImpl::acceptAllPages()
}
}
void
MultiPageDialogImpl
::
resetAllPages
()
{
for
(
int
i
=
0
;
i
<
pages_
.
size
();
i
++
)
{
const
QMetaObject
*
mo
=
pages_
[
i
]
->
metaObject
();
QMetaMethod
m
;
bool
found
=
false
;
for
(
int
j
=
0
;
j
<
mo
->
methodCount
();
j
++
)
{
const
QString
signature
=
mo
->
method
(
j
).
signature
();
if
(
signature
==
"resetToDefaults()"
)
{
m
=
mo
->
method
(
j
);
found
=
true
;
break
;
}
}
if
(
found
)
{
m
.
invoke
(
pages_
[
i
]);
}
}
init
();
}
void
MultiPageDialogImpl
::
init
()
{
for
(
int
i
=
0
;
i
<
pages_
.
size
();
i
++
)
{
...
...
src/shared/widgets/multipagedialog_impl.h
View file @
d4124f27
...
...
@@ -5,6 +5,7 @@
#include <QStackedWidget>
#include <QListWidget>
#include <QScrollArea>
#include <QDialogButtonBox>
namespace
Widgets
{
...
...
@@ -21,6 +22,7 @@ private /*methods*/:
private
slots
:
void
handleGroupSelected
(
int
index
);
void
acceptAllPages
();
void
resetAllPages
();
void
init
();
private
/*fields*/
:
...
...
@@ -28,6 +30,7 @@ private /*fields*/:
QList
<
QWidget
*>
pages_
;
QStackedWidget
*
stack_
;
QListWidget
*
list_
;
QDialogButtonBox
*
buttonBox_
;
};
...
...
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