Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added configuration server #12

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions configurationServer/gui/.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[General]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

этот файлик тут не нужен

D2ModelWindowWasMaximized=true
LineType=-1
OpenQRSProjectFileDialogLastDir=C:/TRIKStudio/examples
robotModel=3
ResizeLabels=true
Autosave=true
showTitlesForRobots=false
DragArea=12
PaletteIconsInARowCount=3
PreferencesDialogLastPosition=@Point(225 23)
LabelsDistance=100
toolbarSize=30
ShowAlignment=true
ShowGrid=true
2dFollowingRobot=true
2dShowGrid=true
IndexGrid=25
LoopEdgeBoundsIndent=1
Splashscreen=true
recentProjectsLimit=0
EmbeddedLinkerIndent=5
port2SensorType=0
temp=D:/proga/SummerSchool/qreal/bin/unsaved
touchMode=false
oldLineColor=magenta
D2ModelWindowLastPosition=@Point(-8 -8)
MoveLabels=true
pos=@Point(-8 -8)
EmbeddedLinkerSize=6
version=3.0.0 \x3b1\x37
CurrentIndex=0
2d_displayVisible=true
autoscalingInterval=3000
sensorUpdateInterval=50
textUpdateInterval=500
collectErgonomicValues=true
gestureDelay=1000
ActivateGrid=true
Antialiasing=true
maximized=true
ActivateAlignment=true
tcpServer=192.168.1.8
EditorsLoadedCount=1
nxtFlashToolRunPolicy=0
CustomFont=false
PaletteTabSwitching=true
2DModelRealisticPhysics=true
%U0414%U0438%U0430%U0433%U0440%U0430%U043C%U043C%U0430%20%U043F%U043E%U0432%U0435%U0434%U0435%U043D%U0438%U044F%20%U0440%U043E%U0431%U043E%U0442%U0430=true
valueOfCommunication=tcp
usabilityTestingMode=false
pathToImages=./images/iconset1
bluetoothPortName=
PreferencesDialogLastSize=@Size(892 593)
2dCursorType=1
recentProjects="C:\\Users\\Admin\\Downloads\\WFABTree (1).qrs;C:\\Users\\Admin\\Downloads\\125_97_2-___2_2.qrs;C:/TRIKStudio/examples/smiles.qrs;C:/TRIKStudio/examples/alongTheLineByCam.qrs;C:/TRIKStudio/examples/smile_wall.qrs;C:/TRIKStudio/examples/helloworld.qrs;C:/TRIKStudio/examples/thewall.qrs;C:/TRIKStudio/examples/simpleSayExample.qrs;"
PaletteRepresentation=false
enableNoiseOfSensors=false
D2ModelWindowLastSize=@Size(1366 706)
port1SensorType=0
PreferencesDialogWasMaximized=false
enableNoiseOfMotors=false
GridWidth=10
size=@Size(1366 706)
SelectedModelFortrikKit=TwoDRobotModelForTrikRealRobotModelV6
AutosaveInterval=60
PaintOldEdgeMode=true
51 changes: 51 additions & 0 deletions configurationServer/gui/brandManager/brandManager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include "brandManager.h"

using namespace qReal;

BrandManager::BrandManager()
: mFonts(new Fonts)
, mStyles(new Styles(*mFonts))
{
}

BrandManager::~BrandManager()
{
delete mFonts;
delete mStyles;
}

BrandManager &BrandManager::instance()
{
static BrandManager instance;
return instance;
}

//void BrandManager::configure(ToolPluginManager const *toolPluginManager)
//{
// instance().mCustomizer = toolPluginManager->customizer();
//}

Fonts const *BrandManager::fonts()
{
return instance().mFonts;
}

Styles const *BrandManager::styles()
{
return instance().mStyles;
}

//QString BrandManager::applicationName()
//{
// return instance().mCustomizer->windowTitle();
//}

//const QImage BrandManager::applicationLogo()
//{
// return instance().mCustomizer->applicationLogo();
//}

//const QIcon BrandManager::applicationIcon()
//{
// return instance().mCustomizer->applicationIcon();
//}
44 changes: 44 additions & 0 deletions configurationServer/gui/brandManager/brandManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#pragma once

//#include "pluginManager/toolPluginManager.h"
#include "fonts.h"
#include "styles.h"

namespace qReal {

/// Provides information about everything about application appearance: fonts, styles and so on
class BrandManager
{
public:
static BrandManager &instance();

/// Retrieves from plugins customization information
// static void configure(ToolPluginManager const *toolPluginManager);

// TODO: Pluginize two following methods

/// Returns information about all fonts in system
static Fonts const *fonts();

/// Returns information about all json stylesheets in system
static Styles const *styles();

/// Returns application`s name and probably version
static QString applicationName();

/// Returns application`s logo image in wide format
static QImage const applicationLogo();

/// Returns small application`s icon
static QIcon const applicationIcon();

private:
BrandManager();
~BrandManager();

// Customizer *mCustomizer; // Doesn`t take ownership
Fonts const *mFonts; // Takes ownership
Styles const *mStyles; // Takes ownership
};

}
11 changes: 11 additions & 0 deletions configurationServer/gui/brandManager/brandManager.pri
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HEADERS += \
$$PWD/brandManager.h \
$$PWD/fonts.h \
$$PWD/styles.h \

SOURCES += \
$$PWD/brandManager.cpp \

RESOURCES += \
$$PWD/fonts/fonts.qrc \
$$PWD/styles/styles.qrc \
65 changes: 65 additions & 0 deletions configurationServer/gui/brandManager/fonts.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#pragma once

#include <QtGui/QFontDatabase>

#include <qrkernel/settingsManager.h>

namespace qReal {

/// A class for managing all used in system fonts
class Fonts
{
public:
Fonts()
{
initTitlesFont();
}

virtual ~Fonts()
{
}

/// Returns font for inline labels on scene
QFont sceneLabelsFont() const
{
return mTitlesFont;
}

/// Returns a path to a font for inline labels on scene if other was not selected by user
virtual QString defaultSceneLabelsFont() const
{
return ":/fonts/Pfennig.ttf";
}

/// Returns a path to a font for a text on styled command buttons
virtual QString commandButtonsFont() const
{
return ":/fonts/Pfennig.ttf";
}

/// Returns a path to a font for a styled text, non-regular one
virtual QString styledTextFont() const
{
return ":/fonts/Pfennig.ttf";
}

private:
void initTitlesFont()
{
if (SettingsManager::value("CustomFont").toBool()) {
mTitlesFont.fromString(SettingsManager::value("CurrentFont").toString());
} else {
int const fontId = QFontDatabase::addApplicationFont(defaultSceneLabelsFont());
if (fontId != -1) {
mTitlesFont.fromString(QFontDatabase::applicationFontFamilies(fontId).at(0) + ",11,-1,5,50,0,0,0,0,0");
}
}
}

QFont mTitlesFont;

};

}

// Implemented in .h file for correct linkage
Binary file not shown.
5 changes: 5 additions & 0 deletions configurationServer/gui/brandManager/fonts/fonts.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/fonts">
<file>Pfennig.ttf</file>
</qresource>
</RCC>
Loading