Branding/ru: Difference between revisions

From FreeCAD Documentation
(Created page with "Эта статья описывает '''Брендинг''' FreeCAD. Брендинг средств для начала вашего собственного прилож...")
(Updating to match new version of source page)
 
(23 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>

{{Docnav/ru
|[[Continuous Integration/ru|Continuous Integration]]
|[[Localisation/ru|Localisation]]
}}

{{TOCright}}

==Overview==

<div class="mw-translate-fuzzy">
==Обзор==
Эта статья описывает '''Брендинг''' FreeCAD. Брендинг средств для начала вашего собственного приложения основанного на FreeCAD. Это может быть как ваш собственный исполняемый файл или загрузочная картинка так и полностью переработанная программа. На базе гибкой архитектуры FreeCAD, её легко использовать как основу для собственной целевой программы.
Эта статья описывает '''Брендинг''' FreeCAD. Брендинг средств для начала вашего собственного приложения основанного на FreeCAD. Это может быть как ваш собственный исполняемый файл или загрузочная картинка так и полностью переработанная программа. На базе гибкой архитектуры FreeCAD, её легко использовать как основу для собственной целевой программы.
</div>


=== General ===
== Warning ==
Most of the branding is done in the '''MainCmd.cpp'' or ''MainGui.cpp'''. These Projects generate the executable files of FreeCAD. To make your own Brand just copy the Main or MainGui projects and give the executable an own name, e.g. FooApp.exe.
The most important settings for a new look can be made in one place in the main() function. Here is the code section that controls the branding:


Although FreeCAD is offered to you free of charge, and the FreeCAD community is happy to see other applications emerging, that are based on FreeCAD, we have on the other hand seen a lot of unfair use of the information contained on this page by people who simply rebranded FreeCAD into a closed-source application to make profit from it.
<syntaxhighlight>

int main( int argc, char ** argv )
Although the [[License|LGPL license]] allows to use the FreeCAD source code in closed-source applications, it also gives strict rules to do so, and does not allow simply taking FreeCAD, renaming it and stripping it of its license.
{

// Name and Version of the Application
Would you be interested in using FreeCAD in a closed-source application, be sure to check thoroughly the implications of the LGPL license, and, even better, contact any FreeCAD developer, administrator or moderator before doing so.
App::Application::Config()["ExeName"] = "FooApp";

App::Application::Config()["ExeVersion"] = "0.7";
== General ==

// set the banner (for loging and console)
<div class="mw-translate-fuzzy">
App::Application::Config()["CopyrightInfo"] = sBanner;
=== Главное ===
App::Application::Config()["AppIcon"] = "FooAppIcon";
Большая часть брендинга делается в {{FileName|MainCmd.cpp}} или {{FileName|MainGui.cpp}}. Эти Проекты генерируют исполняемые файлы FreeCAD. Чтобы сделать ваш собственный Бренд просто скопируйте Main или MainGui проекты и дайте исполняемым файлам собственное имя, например {{FileName|FooApp.exe}}.
App::Application::Config()["SplashScreen"] = "FooAppSplasher";
Наиболее важные настройки для нового облика можно сделать в одном месте в функции main(). Вот участок кода, который управляет брендингом:
App::Application::Config()["StartWorkbench"] = "Part design";
</div>
App::Application::Config()["HiddenDockWindow"] = "Property editor";

App::Application::Config()["SplashAlignment" ] = "Bottom|Left";
<!-- WARNING Do not modify the <syntaxhighligh> tag because of "{}" or pipe characters "|" included in the source code of the macro -->
App::Application::Config()["SplashTextColor" ] = "#000000"; // black
<syntaxhighlight lang="C">
int main( int argc, char ** argv )
// Inits the Application
{
App::Application::Config()["RunMode"] = "Gui";
App::Application::init(argc,argv);
// Name and Version of the Application
App::Application::Config()["ExeName"] = "FooApp";
App::Application::Config()["ExeVersion"] = "0.7";
Gui::BitmapFactory().addXPM("FooAppSplasher", ( const char** ) splash_screen);

// set the banner (for loging and console)
Gui::Application::initApplication();
Gui::Application::runApplication();
App::Application::Config()["CopyrightInfo"] = sBanner;
App::Application::destruct();
App::Application::Config()["AppIcon"] = "FooAppIcon";
App::Application::Config()["SplashScreen"] = "FooAppSplasher";
App::Application::Config()["StartWorkbench"] = "Part design";
return 0;
App::Application::Config()["HiddenDockWindow"] = "Property editor";
}
App::Application::Config()["SplashAlignment" ] = "Bottom|Left";
App::Application::Config()["SplashTextColor" ] = "#000000"; // black

// Inits the Application
App::Application::Config()["RunMode"] = "Gui";
App::Application::init(argc,argv);

Gui::BitmapFactory().addXPM("FooAppSplasher", ( const char** ) splash_screen);

Gui::Application::initApplication();
Gui::Application::runApplication();
App::Application::destruct();

return 0;
}
</syntaxhighlight>
</syntaxhighlight>
The first Config entry defines the program name. This is not the executable name, which can be changed by renaming or by compiler settings, but the name that is displayed in the task bar on windows or in the program list on Unix systems.


Первая запись Config определяет название программы. Это не имя исполняемого файла, который может быть изменен путем переименования или настройки компилятора, а имя, которое отображается в панели задач в Windows или в списке программ в Unix системах.
The next lines define the Config entries of your FooApp Application. A description of the Config and its entries you find in [[Start up and Configuration]].


Следующие строки определяют Config записи вашего FooApp Приложения. Описание Config и его элементов вы можете найти в [[Start up and Configuration/ru|запуске и конфигурации]].
=== Images ===

Image resources are compiled into FreeCAD using [http://qt-project.org/doc/qt-4.8/resources.html Qt's resource system]. Therefore you have to write a .qrc file, an XML-based file format that lists image files on the disk but also any other kind of resource files. To load the compiled resources inside the application you have to add a line
== Images ==
<syntaxhighlight>

Q_INIT_RESOURCE(FooApp);
Image resources are compiled into FreeCAD using [http://qt-project.org/doc/qt-4.8/resources.html Qt's resource system]. Therefore you have to write a {{FileName|.qrc}} file, an XML-based file format that lists image files on the disk but also any other kind of resource files. To load the compiled resources inside the application you have to add a line
</syntaxhighlight>

into the main() function. Alternatively, if you have an image in XPM format you can directly include it into your main.cpp and add the following line to register it:
{{Code|code=
<syntaxhighlight>
Q_INIT_RESOURCE(FooApp);
Gui::BitmapFactory().addXPM("FooAppSplasher", ( const char** ) splash_screen);
}}

into the main() function. Alternatively, if you have an image in XPM format you can directly include it into your {{FileName|main.cpp}} and add the following line to register it:

{{Code|code=
Gui::BitmapFactory().addXPM("FooAppSplasher", ( const char** ) splash_screen);
}}

== Branding XML ==

In FreeCAD there is also a method supported without writing a customized main() function. For this method you must write a file name called {{FileName|branding.xml}} and put it into the installation directory of FreeCAD. Here is an example with all supported tags:

<!-- WARNING Do not modify the <syntaxhighligh> tag because of "{}" or pipe characters "|" included in the source code of the macro -->
<syntaxhighlight lang="XML">
<?xml version="1.0" encoding="utf-8"?>
<Branding>
<Application>FooApp</Application>
<WindowTitle>Foo App in title bar</WindowTitle>
<BuildVersionMajor>1</BuildVersionMajor>
<BuildVersionMinor>0</BuildVersionMinor>
<BuildRevision>1234</BuildRevision>
<BuildRevisionDate>2014/1/1</BuildRevisionDate>
<CopyrightInfo>(c) My copyright</CopyrightInfo>
<MaintainerUrl>Foo App URL</MaintainerUrl>
<ProgramLogo>Path to logo (appears in bottom right corner)</ProgramLogo>
<WindowIcon>Path to icon file</WindowIcon>
<ProgramIcons>Path to program icons</ProgramIcons>
<SplashScreen>splashscreen.png</SplashScreen>
<SplashAlignment>Bottom|Left</SplashAlignment>
<SplashTextColor>#ffffff</SplashTextColor>
<SplashInfoColor>#c8c8c8</SplashInfoColor>
<StartWorkbench>PartDesignWorkbench</StartWorkbench>
</Branding>
</syntaxhighlight>
</syntaxhighlight>
=== Branding XML ===
In FreeCAD there is also a method supported without writing a customized main() function. For this method you must write a file name called branding.xml and put it into the installation directory of FreeCAD. Here is an example with all supported tags:
<syntaxhighlight>
<?xml version="1.0" encoding="utf-8"?>
<Branding>
<Application>FooApp</Application>
<WindowTitle>Foo App in title bar</WindowTitle>
<BuildVersionMajor>1</BuildVersionMajor>
<BuildVersionMinor>0</BuildVersionMinor>
<BuildRevision>1234</BuildRevision>
<BuildRevisionDate>2014/1/1</BuildRevisionDate>
<CopyrightInfo>(c) My copyright</CopyrightInfo>
<MaintainerUrl>Foo App URL</MaintainerUrl>
<ProgramLogo>Path to logo (appears in bottom right corner)</ProgramLogo>
<WindowIcon>Path to icon file</WindowIcon>
<ProgramIcons>Path to program icons</ProgramIcons>
<SplashScreen>splashscreen.png</SplashScreen>
<SplashAlignment>Bottom|Left</SplashAlignment>
<SplashTextColor>#ffffff</SplashTextColor>
<SplashInfoColor>#c8c8c8</SplashInfoColor>
<StartWorkbench>PartDesignWorkbench</StartWorkbench>
</Branding>
</syntaxhighlight>
All of the listed tags are optional.


All listed tags are optional.
{{docnav|Testing|Localisation}}



[[Category:Developer Documentation]]
<div class="mw-translate-fuzzy">
{{clear}}
{{Docnav/ru
<languages/>
|[[Continuous Integration/ru|Continuous Integration]]
|[[Localisation/ru|Localisation]]
}}
</div>

{{Userdocnavi{{#translation:}}}}
[[Category:Developer Documentation{{#translation:}}]]

Latest revision as of 09:46, 12 January 2022

Overview

Обзор

Эта статья описывает Брендинг FreeCAD. Брендинг средств для начала вашего собственного приложения основанного на FreeCAD. Это может быть как ваш собственный исполняемый файл или загрузочная картинка так и полностью переработанная программа. На базе гибкой архитектуры FreeCAD, её легко использовать как основу для собственной целевой программы.

Warning

Although FreeCAD is offered to you free of charge, and the FreeCAD community is happy to see other applications emerging, that are based on FreeCAD, we have on the other hand seen a lot of unfair use of the information contained on this page by people who simply rebranded FreeCAD into a closed-source application to make profit from it.

Although the LGPL license allows to use the FreeCAD source code in closed-source applications, it also gives strict rules to do so, and does not allow simply taking FreeCAD, renaming it and stripping it of its license.

Would you be interested in using FreeCAD in a closed-source application, be sure to check thoroughly the implications of the LGPL license, and, even better, contact any FreeCAD developer, administrator or moderator before doing so.

General

Главное

Большая часть брендинга делается в MainCmd.cpp или MainGui.cpp. Эти Проекты генерируют исполняемые файлы FreeCAD. Чтобы сделать ваш собственный Бренд просто скопируйте Main или MainGui проекты и дайте исполняемым файлам собственное имя, например FooApp.exe. Наиболее важные настройки для нового облика можно сделать в одном месте в функции main(). Вот участок кода, который управляет брендингом:

int main( int argc, char ** argv )
{
    // Name and Version of the Application
    App::Application::Config()["ExeName"] = "FooApp";
    App::Application::Config()["ExeVersion"] = "0.7";

    // set the banner (for loging and console)
    App::Application::Config()["CopyrightInfo"] = sBanner;
    App::Application::Config()["AppIcon"] = "FooAppIcon";
    App::Application::Config()["SplashScreen"] = "FooAppSplasher";
    App::Application::Config()["StartWorkbench"] = "Part design";
    App::Application::Config()["HiddenDockWindow"] = "Property editor";
    App::Application::Config()["SplashAlignment" ] = "Bottom|Left";
    App::Application::Config()["SplashTextColor" ] = "#000000"; // black

    // Inits the Application 
    App::Application::Config()["RunMode"] = "Gui";
    App::Application::init(argc,argv);

    Gui::BitmapFactory().addXPM("FooAppSplasher", ( const char** ) splash_screen);

    Gui::Application::initApplication();
    Gui::Application::runApplication();
    App::Application::destruct();

    return 0;
}

Первая запись Config определяет название программы. Это не имя исполняемого файла, который может быть изменен путем переименования или настройки компилятора, а имя, которое отображается в панели задач в Windows или в списке программ в Unix системах.

Следующие строки определяют Config записи вашего FooApp Приложения. Описание Config и его элементов вы можете найти в запуске и конфигурации.

Images

Image resources are compiled into FreeCAD using Qt's resource system. Therefore you have to write a .qrc file, an XML-based file format that lists image files on the disk but also any other kind of resource files. To load the compiled resources inside the application you have to add a line

Q_INIT_RESOURCE(FooApp);

into the main() function. Alternatively, if you have an image in XPM format you can directly include it into your main.cpp and add the following line to register it:

Gui::BitmapFactory().addXPM("FooAppSplasher", ( const char** ) splash_screen);

Branding XML

In FreeCAD there is also a method supported without writing a customized main() function. For this method you must write a file name called branding.xml and put it into the installation directory of FreeCAD. Here is an example with all supported tags:

<?xml version="1.0" encoding="utf-8"?>
<Branding>
    <Application>FooApp</Application>
    <WindowTitle>Foo App in title bar</WindowTitle>
    <BuildVersionMajor>1</BuildVersionMajor>
    <BuildVersionMinor>0</BuildVersionMinor>
    <BuildRevision>1234</BuildRevision>
    <BuildRevisionDate>2014/1/1</BuildRevisionDate>
    <CopyrightInfo>(c) My copyright</CopyrightInfo>
    <MaintainerUrl>Foo App URL</MaintainerUrl>
    <ProgramLogo>Path to logo (appears in bottom right corner)</ProgramLogo>
    <WindowIcon>Path to icon file</WindowIcon>
    <ProgramIcons>Path to program icons</ProgramIcons>
    <SplashScreen>splashscreen.png</SplashScreen>
    <SplashAlignment>Bottom|Left</SplashAlignment>
    <SplashTextColor>#ffffff</SplashTextColor>
    <SplashInfoColor>#c8c8c8</SplashInfoColor>
    <StartWorkbench>PartDesignWorkbench</StartWorkbench>
</Branding>

All listed tags are optional.