KDevelop5/Manual/Sessions and projects/da: Difference between revisions

    From KDE UserBase Wiki
    (Importing a new version from external source)
    (Importing a new version from external source)
    Line 17: Line 17:
    === Opsætning af en session og import af et eksisterende projekt ===
    === Opsætning af en session og import af et eksisterende projekt ===


    Let's stick with the Linux kernel and device driver example &mdash; you may want to substitute your own set of libraries or projects for these two examples. To create a new session that contains these two projects go to the <menuchoice>Session -> Start new session</menuchoice> menu at the top left (or, if this is the first time you use '''KDevelop''': simply use the default session you get on first use, which is empty).
    Lad os holde os til eksemplet med Linux-kernen og enhedsdriveren &mdash; du kan erstatte dem med dit egen sæt af biblioteker og projekter. For at lave en ny session, som indeholder to projekter går du til menuen <menuchoice>Session -> Start ny session</menuchoice> øverst til venstre (eller hvis det er første gang, du bruger '''KDevelop''', så kan du simpelt hen bruge den tomme standardsession, som du får til at begynde med). Nu vil vi populere denne session med projekter, som vi for nu  vil antage allerede findes et eller andet sted (tilfældet, hvor vi laver et projekt fra grunden af omtales andetsteds i denne manual). Til dette er det overordnet set to metoder afhængigt af, om projektet allerede findes et sted på din harddisk eller om det skal downloades fra en server.
    We next want to populate this session with projects that for the moment we assume already exist somewhere (the case of starting projects from scratch is discussed elsewhere in this manual). For this, there are essentially two methods, depending on whether the project already is somewhere on your hard drive or whether it needs to be downloaded from a server.


    ==== Option 1: Importing a project from a version control system server ====
    ==== Option 1: Importing a project from a version control system server ====

    Revision as of 13:02, 9 September 2017

    Sessioner og projekter: KDevelops grundlag

    I dette afsnit vil vi gennemgå noget af terminologien, som KDevelop bruger til at beskrive verden og strukturere sit arbejde. I særdeleshed vil vi introducere begreberne sessioner og projekter og forklare, hvordan du kan opsætte de projekter, som du vil arbejde på i KDevelop.

    Terminologi

    KDevelop bruger begreberne sessioner og projekter. En session indeholder alle de projekter, som har noget med hinanden at gøre. I de eksempler, der følger antager vi, at du både udvikler et bibliotek og et program, som bruger det. Du kan tænke på en centralt KDE-bibliotek som det første og KDevelop som det andet. Et andet eksempel kunne være en Linux-kerneudvkler, som også arbejder på en enhedsdriver til Linux, som ikke er indføjet i selve kernen endnu.

    Tager vi det sidste som eksempel, så ville du have en session i KDevelop, som har to projekter: Linux-kernen og enhedsdriveren. Du vil nok samle dem i en enkelt session (i stedet for at have to sessioner med et projekt i hver), fordi det vil være nyttigt at kunne se kernefunktioner og -datastrukturer i KDevelop, når du skriver kildekode til driveren — så kan du for eksempel få navne på kernefunktioner og -variable automatisk fuldført, og du kan se dokumentation for kernefunktioner mens du arbejder med driveren.

    Forestil dig nu, at du også er en KDE-udvikler. Du kan så have endnu en session, som indeholder KDE som et projekt. Du kan i princippet nøjes med én session til det hele, men det er der ingen grund til: når du arbejder med KDE, så har du ikke brug for adgang til kerne- og enhedsdriver-funktioner; og du har ikke brug for automatisk færdiggørelse af KDE-klassenavne, mens du arbejder på Linux-kernen. Endelig er bygning af KDE-biblioteker uafhængig af bygning af Linux-kernen (hvorimod det altid er en god idé at bygge Linux-kernen igen, når du har bygget enhedsdriveren, hvis nogle af kerne-headerne er blevet ændret).

    Endelig kan du bruge sessioner, hvis du både arbejder på den aktuelle udviklingsversion af et projekt og på en gren: i det tilfælde vil du ikke have, at KDevelop forveksler klasser, som hører til hovedudgaven med nogle, som tilhører grenen, så du vil bruge to sessioner med det samme sæt af projekter men fra forskellige mapper (svarende til de forskellige udviklingsudgaver).

    Opsætning af en session og import af et eksisterende projekt

    Lad os holde os til eksemplet med Linux-kernen og enhedsdriveren — du kan erstatte dem med dit egen sæt af biblioteker og projekter. For at lave en ny session, som indeholder to projekter går du til menuen Session -> Start ny session øverst til venstre (eller hvis det er første gang, du bruger KDevelop, så kan du simpelt hen bruge den tomme standardsession, som du får til at begynde med). Nu vil vi populere denne session med projekter, som vi for nu vil antage allerede findes et eller andet sted (tilfældet, hvor vi laver et projekt fra grunden af omtales andetsteds i denne manual). Til dette er det overordnet set to metoder afhængigt af, om projektet allerede findes et sted på din harddisk eller om det skal downloades fra en server.

    Option 1: Importing a project from a version control system server

    Let's first assume that the project we want to set up -- the Linux kernel -- resides in some version control system on a server, but that you haven't checked it out to your local hard drive yet. In this case, go to the Project menu to create the Linux kernel as a project inside the current session and then follow these steps:

    • Go to Projects -> Fetch project to import a project
    • You then have multiple options to start a new project in the current session, depending on where the source files should come from: You can just point KDevelop at an existing directory (see option 2 below), or you can ask KDevelop to get the sources from a repository.
    • Assuming you don't already have a version checked out:
      • In the dialog box, under Select the source, choose to use Subversion, Git, or one of the other choices
      • Choose a working directory as destination into which the sources should be checked out
      • Choose an URL for the location of the repository where the source files can be obtained
      • Hit Get. This can take quite a long while; depending on the speed of your connection and the size of the project. Unfortunately, in KDevelop 4.2.x the progress bar does not actually show anything, but you can track progress by periodically looking at the output of the command line command
        du -sk /path/to/KDevelop/project
        to see how much data has already been downloaded.

    Note

    The problem with the progress bar has been reported as KDevelop bug 256832.

    Note

    In this process, I also get the error message You need to specify a valid location for the project which can be safely ignored.


    • It asks you to select a KDevelop project file in this directory. Since you probably don't have one yet, simply hit Next
    • Hit Next again
    • KDevelop will then ask you to choose a project manager. If this project uses standard Unix make files, choose the custom makefile project manager
    • KDevelop will then start to parse the entire project. Again, it will take quite a while to go through all files and index classes etc. At the bottom right of the main window, there is a progress bar that shows how long this process has come along. (If you have several processor cores, you can accelerate this process by going to the Settings -> Configure KDevelop menu item, then selecting Background parser on the left, and increasing the number of threads for background parsing on the right.)

    Option 2: Importing a project that is already on your hard drive

    Alternatively, if the project you want to work with already exists on your hard drive (for example, because you have downloaded it as a tar file from an FTP server, because you already checked out a version of the project from a version control system, or because it is your own project that exists only on your own hard drive), then use Projects -> Open/Import project and in the dialog box choose the directory in which your project resides.

    Setting up an application as a second project

    The next thing you want to do is set up other projects in the same session. In the example above, you would want to add the device driver as the second project, which you can do using exactly the same steps.

    If you have multiple applications or libraries, simply repeat the steps to add more and more projects to your session.

    Creating projects from scratch

    There is of course also the possibility that you want to start a new project from scratch. This can be done using the Projects -> New from Template menu item, which presents you with a template selection dialog. Some project templates are provided with KDevelop, but even more are available by installing the KAppTemplate application. Choose the project type and programming language from the dialog, enter a name and location for you project, and click Next.

    The second page of the dialog allows you to set up a version control system. Choose the system you wish the use, and fill in the system-specific configuration if needed. If you do not wish to use a version control system, or want to set it up manually later, choose None. When you are happy with your choice, press Finish.

    Your project is now created, so you can try building or installing it. Some templates will include comments within the code, or even a separate README file, and it is recommended that you read those first. Then, you can start working on your project, by adding whatever features you want.