Archive:Development/Tutorials (zh TW): Difference between revisions

    From KDE TechBase
    No edit summary
    No edit summary
    Line 21: Line 21:


    ==基礎知識 ==
    ==基礎知識 ==
    ;[[Development/Tutorials/KDE4 Porting Guide|Porting Your Application]]
    ;[[Development/Tutorials/KDE4 Porting Guide|移植你的程式]]
    :''Help Porting Applications from Qt3/KDE3 to Qt4/KDE4''
    :''協助移植應用程式從Qt3/KDE3到Qt4/KDE4''


    ;[[Development/Tutorials/CMake|介紹 CMake]]
    ;[[Development/Tutorials/CMake|介紹 CMake]]
    Line 61: Line 61:


    == 服務:應用程式和外掛 ==
    == 服務:應用程式和外掛 ==
    ;[[Development/Tutorials/Services/Introduction|Introduction to the Services Framework]]
    ;[[Development/Tutorials/Services/Introduction|介紹服務框架]]
    :''An overview of the services framework in KDE and what it provides the application developer. Covers the system configuration cache (SyCoCa), the source data files and what the indexed information can be used for.''
    :''KDE中的服務框架,以及它們向開發人員提供了哪些功能的概述。覆蓋了系統配置快取(SyCoCa)、源資料檔案以及索引資訊可以做哪些事情。''


    ;[[Development/Tutorials/Services/Traders|Finding Services Using Trader Queries]]
    ;[[Development/Tutorials/Services/Traders|使用 Trader Querie 來搜尋服務]]
    :''How to find services, such as plugins or mimetypes, that are indexed in the SyCoCa using Trader Query Syntax''
    :''如何使用 Trader Query 語法來搜尋那些在 SyCoCa 中有索引的服務,如外掛或者 mime 類型等''


    ;[[Development/Tutorials/Services/Plugins|Creating and Loading Plugins Using KService]]
    ;[[Development/Tutorials/Services/Plugins|使用 KService 創建和載入模塊]]
    :''Learn how to define custom plugin types, find installed plugins (including 3rd party plugins) and load them in an easy and portable fashion using KService.''
    :''學習如何使用 KService,以一種方便且易於擴展方式來完成定義自定外掛類型、搜尋已安裝的外掛(包括第三方外掛)、以及載入外掛等任務。''


    == 本地化 ==
    == 本地化 ==
    See also [[Localization|Localization portal]].
    另見[[Localization|本地化入口]]


    ;[[Development/Tutorials/Localization/Unicode|Introduction To Unicode]]
    ;[[Development/Tutorials/Localization/Unicode|介紹 Unicode]]
    :''An introduction to what Unicode is as well as how to handle Unicode data in KDE applications.''
    :''An introduction to what Unicode is as well as how to handle Unicode data in KDE applications.''


    Line 99: Line 99:
    == 文件 ==
    == 文件 ==


    ;[[Development/Tutorials/API_Documentation|API Documentation]]
    ;[[Development/Tutorials/API_Documentation|API 文件]]
    :''This tutorial explains how to document your APIs properly.''
    :''This tutorial explains how to document your APIs properly.''



    Revision as of 14:24, 29 September 2009


    Development/Tutorials


    教學是發現 KDE 能為你做哪些事以及如何做的捷徑。下面是當前可用的 KDE 4 教學列表。關於 KDE 3 和 KDE 2 的材料可以在本頁的底部找到。

    KDE 4 程式設計介紹

    你是否對用 KDE 4 寫程式感興趣呢?這個教學系列的目的是讓那些對 KDE 程式設計完全沒有概念的新手能夠入門。

    Hello World
    初步的介紹了 KDE 4 程式設計的最基本知識
    建立主視窗
    本教學將向你展示應用程式最重要的部分──主視窗──的魔術。
    使用 KAction
    如何在選單和工具列中加入動作(action)。
    儲存與載入
    介紹 KIO 函式庫,為我們的應用程式增加載入和儲存的功能。
    命令列參數
    加入在命令列用文字編輯器打開指定檔案的功能。

    基礎知識

    移植你的程式
    協助移植應用程式從Qt3/KDE3到Qt4/KDE4
    介紹 CMake
    如何把 CMake 構建系統用於 KDE 4 。
    常見程式設計錯誤
    各種在開發 Qt 和 KDE 應用程式時常見的錯誤,以及如何避免它們。
    使用 Qt Designer 建立使用者界面
    如何使用 designer 創建 UI 檔案,以及如何整合它們到 KDE 程式中。
    建立函式庫來分享程式碼
    如何把函式庫加到建構系統以及如何準備原始碼。
    工作階段管理
    讓您的程式察覺 X 工作階段(X sessions)

    測試與除錯

    對你的應用程式進行除錯
    對你的 KDE 應用程式進行除錯時可以採用的工具、技術和技巧。
    使用 QTestLib 為 Q t4 與 KDE 4 編寫 Unittest (原始出處)
    Brad Hards的教學,敘述如何使用 QTestLib 框架編寫 unit tests。它是一個基於例子的教學,仍在開發中。
    檢測程式碼錯誤的半自動方法
    一些您可以用在 KDE 程式碼中檢測錯誤的技術

    使用 KConfig 管理配置資料

    介紹 KConfig
    概要介紹 KConfig 的類別,以及如何使用它們在你的應用程式的程式碼中
    使用 KConfig XT
    如何有效使用 KConfig XT 框架的教學。
    更新 KConfig 檔案
    如何編寫一個更新腳本,以保證你程式的設定檔格式與使用者已有的設定檔一致的教學

    服務:應用程式和外掛

    介紹服務框架
    KDE中的服務框架,以及它們向開發人員提供了哪些功能的概述。覆蓋了系統配置快取(SyCoCa)、源資料檔案以及索引資訊可以做哪些事情。
    使用 Trader Querie 來搜尋服務
    如何使用 Trader Query 語法來搜尋那些在 SyCoCa 中有索引的服務,如外掛或者 mime 類型等
    使用 KService 創建和載入模塊
    學習如何使用 KService,以一種方便且易於擴展方式來完成定義自定外掛類型、搜尋已安裝的外掛(包括第三方外掛)、以及載入外掛等任務。

    本地化

    另見本地化入口

    介紹 Unicode
    An introduction to what Unicode is as well as how to handle Unicode data in KDE applications.
    Writing Applications With Localization In Mind
    This tutorial covers what localization is, why it's important and how to ensure your application is ready to be localized. A must read for all application developers.
    Avoiding Common Localization Pitfalls
    There are several common mistakes that prevent applications from being properly localized. Find out what they are and how to easily avoid them in this tutorial.
    Building KDE's Localization Module
    Building and installing language support from KDE's localization (l10n) module is a good idea for those working on applications in the main KDE repository. Doing so will allow you to test your application in another language and spot problem areas. Learn how to do just that in this tutorial.
    Incorporating i18n Into the Build System
    Once your application is ready to be localized, the next step is to ensure that translation files are built automatically and kept up to date. This tutorial covers the necessary CMakeFiles.txt additions as well the process of distributing the resulting message catalogs with your application.
    Common i18n Challenges and Solutions
    This tutorial covers challenges that you may eventually run into such as translating handbooks and other data that exists outside of the source code, merging and handling obsolete .po files, dealing with freezes, coding in languages other than English and creating independent releases of or moving applications between KDE modules.
    Semantic Markup of Messages
    To ensure consistent presentation and more meaningful representations of messages in applications, semantic markup can be applied to messages marked for translation using the KUIT system. This tutorial describes how this system works.
    Automated i18n Code Checking
    The Krazy code checker scans KDE's code and reports common i18n mistakes.

    文件

    API 文件
    This tutorial explains how to document your APIs properly.
    Man Pages
    Writing and Generating Reference Manual Pages.

    應用程式自動化及腳本

    D-Bus

    Introduction to D-Bus
    A straight-forward introduction to the core concepts in D-Bus from an application developer's perspective, this tutorial covers what D-Bus is and how it can be used by applications.
    Accessing D-Bus Interfaces
    A step-by-step guide to calling D-Bus methods and connecting to D-Bus signals using QtDBus.
    Intermediate D-Bus
    Tips to make use of QtDBus when faced with problematic real-world interfaces.
    Creating D-Bus Interfaces
    Learn how to expose functionality in your application by creating and using custom D-Bus interfaces. Covers generating the XML descriptions, instantiating interfaces at run time and setting up the build system with CMake.
    D-Bus Autostart Services
    Turn your application into a D-Bus autostart service with this tutorial. This D-Bus feature, also known as "D-Bus service activation", will ensure that even when your application isn't running that D-Bus calls made to it will work by relying on the D-Bus daemon itself to start your app if and when needed.
    Porting from DCOP to D-Bus
    Port your applications from DCOP to D-Bus with this handy guide.

    Konqueror

    Creating Konqueror Service Menus
    This tutorial shows you how to create mimetype-specific actions in Konqueror's context menu (aka "servicemenus").

    Kross

    Introduction to Kross
    An introduction to the Kross Scripting Framework.
    Hello World
    A first application with working kross code.
    Calling Functions in Kross
    Simple demonstration of calling scripting functions
    Connecting Signals and Slots in Kross
    Simple demonstration of connecting object signals with script slots
    Scripts as Plugins with Kross
    This tutorial provides a step-by-step introduction how to integrate scripts as plugins into a KDE application.
    Placing script actions in your application menus
    Simple demonstration on how to extend you application menus to execute script files.


    Calligra Plugin Tutorials

    Calligra Overview
    This document shows an overview of the different Calligra plugin types and tells you what each of their purpose and strengths are. If you are new with Calligra plugins, this is the place to start.
    Calligra Plugin Creation
    This gives a technical overview of what it means to write a Calligra plugin.
    Creating Calligra Flake Plugins
    This tutorial shows you how you can build a plugin for Calligra applications to allow you embed content in ODF documents using Flake.
    Calligra Words Scripting
    This tutorial shows how to script Calligra Words with Python, or JavaScript using Kross.
    Calligra Sheets Scripting
    This tutorial shows how to script Calligra Sheets with Python, or JavaScript using Kross.


    SuperKaramba

    SuperKaramba Tutorial
    This tutorial provides an overview of SuperKaramba, theme files and scripting with Python, Ruby and JavaScript.

    外掛和KParts

    Writing kontact plugins
    Kontact plugins are KParts. This tutorial describes how you can write one.
    Using KParts
    Learn how to load a KPart into an application window.
    Writing Qt Designer Plugins
    Add your widgets to Qt Designer and thus make them usable in UI files.

    搜尋與元數據

    Strigi

    Writing file analyzers
    File analyzers extract data from files to display in the file dialogs and file managers. The data gathered this way is also used to search for files. KDE4 allows the use of multiple analyzers per file type. This tutorial describes how you can write new analyzers.

    Nepomuk

    Nepomuk Quickstart
    How to use Nepomuk resources in a quick and painless way without much fuss.
    RDF and Ontologies in Nepomuk
    An introduction to RDF and the usage of ontologies in Nepomuk.
    Data Layout in Nepomuk
    An overview of which and how data is stored in Nepomuk.
    Handling Resources with Nepomuk
    Nepomuk is the KDE library which provides easy access to metadata in the Nepomuk system. Learn how to make your application create and read metadata using the Nepomuk system.
    Using the Nepomuk Resource Generator
    Nepomuk includes a resource generator which creates convenience classes for handling metadata.
    Advanced Queries
    The real power of Nepomuk can only be exposed when performing fancy queries on the data repository. This tutorial provides an introduction to semantic and full text queries in Nepomuk.
    The Nepomuk Server and the Architecture of the Nepomuk subsystem
    The Nepomuk Server hosts the main Nepomuk data repository and can be accessed directly via a Soprano API.
    Nepomuk Services
    The Nepomuk Server manages a set of Nepomuk services.
    • Storage Service The probably most important service hosts the Nepomuk data repository using Soprano.
    • Ontology Loader Makes sure installed ontologies such as RDF, RDFS, NRL, or Xesam are loaded into the storage repository.
    • File Watch Service Monitors the file system for changes and updates the file resource paths and URIs in Nepomuk.
    • Strigi Service Controls Strigi, the file indexing tool which extracts metadata from files and stores it into the storage repository.
    • Query Service Provides persistant query folders.
    Nepomuk Tips and Tricks
    A set of tips and tricks for development with Nepomuk and Soprano. This is a must-read if you intend to use Nepomuk in your application or hack on it directly.

    硬體探知(Solid)

    Introduction to Solid
    An introduction to using the Solid hardware discovery and interaction system in KDE applications.
    Accessing Network Information
    How to use the Solid system to get information about the network

    Privileged Applications (PolicyKit)

    Introduction to PolicyKit
    A straight-forward introduction to what PolicyKit is, and how it can be useful for your next application requiring super-user privileges or user authentication
    Using the caller-helper model to perform actions as root
    This tutorial will teach you how to get your application to perform some actions as root in a completely safe and easy manner, if the user is authorized to, by using PolicyKit and the caller-helper technique
    Getting root privileges in KCM Modules
    This tutorial will teach you how to create KCModules able to save settings as root

    多媒體(Phonon)

    Phonon
    How to start with the multimedia API
    How to compile and use Phonon and its GStreamer backend on Linux using Qt 4.3.x
    This article gives you a quick brief of how you can use checkout, compile Phonon and its GStreamer backend on GNU/Linux with just Qt 4.3.x. Towards the end, the article also describes how a developer can make use of Phonon to create simple audio and video players. You can read the article here. You can download the editable OpenDocumentText file from here.

    Plasma

    See Development/Tutorials/Plasma for Plasma tutorials.

    通訊(Decibel)

    Getting started with Decibel
    This tutorial describes how to set up Decibel.
    Handling TextChannels
    This tutorial introduces the basics of handling incoming TextChannels by guiding you through building a simple text chat application.

    個人資訊管理(Akonadi)

    Using Akonadi in Applications
    Displaying and modifying data provided by Akonadi
    Developing Akonadi Resources
    Akonadi Resources are agent programs which transport PIM data between Akonadi and a backend (files, servers, etc)
    Using custom data types with Akonadi
    Akonadi can handle arbitrary data as item payloads through the use of a plugin based serialization framework

    Kate / Kwrite

    Getting started with KTextEditor plugins
    Creating your first KTextEditor plugin
    Developing a plugin with configuration dialog
    Adding a configuration dialog to the Time & Date example
    A small Editor
    Create a small application using KTextEditor

    列印

    Hello World
    Introduction to the KDE printing system
    Print Dialog
    Using the KDE print dialog

    kioslaves

    Get Hot New Stuff

    New introduction to Get Hot New Stuff 2
    A short tutorial about how to use KHotNewStuff2 in your application.
    • old links for KNS1 content:
    Introduction to Get Hot New Stuff
    An introduction to the developer-friendly network update system that allows KDE applications to fetch new application data at runtime in a user friendly manner.
    KNewStuff Secure (Original Link)
    Tutorial showing how to share resources in a secured way (KDE 3.4 and later). By András Mantia <[email protected]>.

    Goya

    Introduction to Goya usage
    An introduction for the Goya subsystem usage, which allows you to easily add widgets to your itemviews and connect their signals to your code, as they were real widgets.
    Introduction to Goya usage (part 2)
    The second part of the tutorial, with a slightly more complex example than the first part.

    其他程式語言

    Python

    An Introduction to PyQt
    Starting off
    PyQt by Example
    Another introduction to PyQt
    PyKDE WebKit Tutorial
    A simple web browser application in PyKDE
    101 Introduction to signals and slots
    A simple introduction to Qt's signal and slot architecture.
    PyKDE DBus Tutorial
    An introduction to DBus communication using PyKDE


    Ruby

    KDE Ruby Korundum 教學
    A ruby version of Antonio Larrosa Jiménez's KDE tutorial by Richard Dale. See the Ruby Developers Corner for Qt tutorials and other info.
    Qt4 Ruby 教學
    Trolltech's fabulous introductory tutorial to Qt, translated to Ruby.
    Creating a Plasma Widget in Ruby
    Tutorial that shows how to create your first Plasma Applet using the Ruby language.
    Developing Qt4 Applications using Qt Designer and Ruby on Kubuntu
    Tutorial that shows how to design a simple User Interface in Qt Designer and then use the resulting widget in a Qt Ruby application we build from scratch.

    Shell

    Shell Scripting with KDE dialogs (Original Link)
    Tutorial by Brad Hards that describes how to use KDE dialogs in shell scripts with kdialog. It is presented as an example based tutorial.

    繪圖程式設計

    QPainter Perfomance
    Hints on avoiding common mistakes leading to poor performance when using QPainter

    使用 KDE 遊戲函式庫

    KStandardGameAction
    Using libkdegames to make your game fit the kdegames standard
    Highscores
    Implementing a simple highscore table into your game
    Theme Selector
    Using the libkdegames theme selection dialog
    Palapeli Patterns
    Creating a pattern for Palapeli

    使用 KDE PIM 函式庫

    iCalendar functionality
    Using kcal to manage iCalendar files

    其它教學

    2D Plotting (KPlotWidget)

    Using the KDE data-plotting widget
    This tutorial introduces KPlotWidget, which is used for 2-D data plotting. It includes information on simple usage of the widget (including adding and modifying data sets, and customizing the plot axes and labels), and advanced customization (including extending the widget through sub-classing).

    拼寫與語法檢查(Sonnet)

    Adding spell-checking or grammar-checking to KDE applications
    This tutorial introduces Sonnet and how one may use it to add language correction to your KDE application. Sonnet's auxiliary features shall be described in a separate tutorial.

    像素圖快取(KPixmapCache)

    Using the KDE pixmap cache
    This tutorial shows how to use KPixmapCache to cache e.g. pixmaps generated from SVGs or some data.

    使用MarbleWidget (Marble)

    Using MarbleWidget
    This short tutorial describes how to use the MarbleWidget in your project

    用本地 SCM 開發 KDE

    Using Git to develop for KDE
    This tutorial shows how to use Git to develop for KDE

    Kwin effect tutorial (blog)

    [blog by Martin Graesslin]
    This tutorial guides you through the development of a simple KWin effect

    Implementing KSysGuard sensors and adding them

    Development/Tutorials/Sensors
    This tutorial shows how to write and KSysGuard sensor and connect it to the systray.

    Runners

    KDE2 and KDE3 Materials

    KDE3 Tutorials
    These tutorials cover topics related to KDE3.
    KDE2 Tutorials
    These tutorials cover topics related to KDE2.