URLs, an implementation

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

URLs, an implementation

Post #1by Christophe » 04.08.2002, 16:53

I now have a working URL implementation.

I've added the following public methods to CelestiaCore:
std::string getUrl() const;
void gotoUrl(const std::string& url);
void addToHistory();
void back();
void forward();
const std::vector<std::string>& getHistory() const;
std::vector<std::string>::size_type getHistoryCurrent() const;

It should compile on any ANSI compiler, but I haven't tested on anything else but gcc 2.96 (Mandrake 8.2).

I've also added a construtor and a method to the BigFix class (they show up in base64 in the URL).

Here is what a URL looks like:
cel://Fallow/Sol:Earth:Moon/2002-08-04T ... Hi4mkG7IDA
&y=e/yPGGXUEA&z=ZenTHpckZdkL&ow=-0.009347&ox=0.228147
&oy=0.973347&oz=0.021382&select=Sol:Earth:Moon&fov=27.941454
&ts=1.000000&rf=5523&lm=0

Nothing fancy but it works well enough.
The code is not optimised at all, it's a proof of concept more than anything else.

The code is available as a patch against 1.2.4 along with the KDE interface:
http://www.teyssier.org/~chris/celestia ... e.diff.bz2

To compile it (KDE3 required):
- Get the official 1.2.4 tar file
> tar xvzf celestia-1.2.4.tar.gz
> cd celestia-1.2.4
> bizp2 ../celestia-1.2.4_url_kde.diff.bz2 | patch -p1
> automake ; autoconf (2.5 requiered by KDE3)
> ./configure --with-kde (--with-gnome should still work but you can't use both)
> make
> sudo make install (data files will go to $KDEDIR/share/apps/celestia, so you do have to make install even if you already have celestia installed)

It's alpha quality at the moment, some things don't work (bookmarks), but I still find it more fonctional than the Gnome version (I'm biased):
- it has a full screen mode
- it can open script files
- preferences are saved
- and it's got a working history !

Screenshot, this is what you will see if you 'GoTo' the above URL:

Image

Christophe

Topic author
Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

New version - links working from Konqueror

Post #2by Christophe » 05.08.2002, 21:32

I've put up a new version (same link as above).

You can now start celestia with a URL as parameter and it's a KUniqueApplication.

Simply copy the celestia.protocol file to your $KDEDIR/share/services/ directory, restart konqueror and click here

And all that with probably less than 20 lines of code! The KDE/QT framework is so nice, I wonder why people keep using Win32... Dictature of the masses probably...

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

New version - links working from Konqueror

Post #3by chris » 05.08.2002, 21:58

Christophe wrote:I've put up a new version (same link as above).

You can now start celestia with a URL as parameter and it's a KUniqueApplication.

Simply copy the celestia.protocol file to your $KDEDIR/share/services/ directory, restart konqueror and click here

And all that with probably less than 20 lines of code! The KDE/QT framework is so nice, I wonder why people keep using Win32... Dictature of the masses probably...

Would you be interested in getting your KDE changes into the main Celestia tree? I haven't been able to test your changes yet, but they seem pretty useful, especially to people using KDE instead of Gnome. Beyond the url changes to celestiacore.cpp and adding some sort of kdemain file, did you have to make any other modifications to get a KDE version of Celestia working?

--Chris


--Chris

Topic author
Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

New version - links working from Konqueror

Post #4by Christophe » 06.08.2002, 07:12

chris wrote:Would you be interested in getting your KDE changes into the main Celestia tree? I haven't been able to test your changes yet, but they seem pretty useful, especially to people using KDE instead of Gnome. Beyond the url changes to celestiacore.cpp and adding some sort of kdemain file, did you have to make any other modifications to get a KDE version of Celestia working?


Of course, I think that'd be great if my changes could get included in the main tree. The interface would need some polish before a public release and I'm going to be away for two weeks, when do you plan to release 1.2.5?

Beside the changes you mention I've also had to tweak the build system (that was by far the hardest part, especialy since I'm no automake/autoconf guru). I've added kde_acinclude.m4 (from the kde template application) to the macros directory and modified configure.in and src/celestia/makefile.am - that'd need some fixing too. As a side effect, autoconf 2.5 is now needed.

By the way is the cvs version your latest development version or do you have other non-commited changes?


Christophe

Topic author
Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

Post #5by Christophe » 08.08.2002, 22:01

It's getting better, a new version is available at the same URL.

I've added a new class 'Url' that does all the work: creating a url from the current location as well as parsing a string, it's a lot cleaner. It keeps the information in the native format so when you navigate the history you don't actually have to parse the Urls.

I think it's ready to be included in the other celestia versions, all that's needed is to merge the changes to :
- CelestiaCore
- BigFix
- Date (had to add a default constructor)
- Url

And then simply provide a menu/shorcut to: Back(), Forward()...

To get the url of the current location:
Url url(appCore);
url->getAsString();

And to go to a url provided as a string:
Url url(urlString, appCore);
url->goTo();

The Kde interface has some improvements too. Links should work from Konqueror without having to copy the file manuly now. Still no bookmarks for now.


Christophe

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

New version - links working from Konqueror

Post #6by chris » 09.08.2002, 18:37

Christophe wrote:
chris wrote:Would you be interested in getting your KDE changes into the main Celestia tree? I haven't been able to test your changes yet, but they seem pretty useful, especially to people using KDE instead of Gnome. Beyond the url changes to celestiacore.cpp and adding some sort of kdemain file, did you have to make any other modifications to get a KDE version of Celestia working?

Of course, I think that'd be great if my changes could get included in the main tree. The interface would need some polish before a public release and I'm going to be away for two weeks, when do you plan to release 1.2.5?

Beside the changes you mention I've also had to tweak the build system (that was by far the hardest part, especialy since I'm no automake/autoconf guru). I've added kde_acinclude.m4 (from the kde template application) to the macros directory and modified configure.in and src/celestia/makefile.am - that'd need some fixing too. As a side effect, autoconf 2.5 is now needed.
Of course, the autoconf stuff is always a pain (though still much better than the alternatives . . .) I'm still planning on getting 1.2.5 out next week, but I can wait a few more days if there's a chance we could integrate your KDE changes.

Christophe wrote:By the way is the cvs version your latest development version or do you have other non-commited changes?

The CVS tree has everything except for my latest texture improvements, which still need some tweaking.

--Chris

Topic author
Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

New version - links working from Konqueror

Post #7by Christophe » 26.08.2002, 21:37

I'm back.

I've corrected a few bugs and I think I'll have the bookmarks working before the end of the week. It should be fairly useable then.

chris wrote:The CVS tree has everything except for my latest texture improvements, which still need some tweaking.


The reason I was asking is that the cvs version hasn't been useable for me for a while. The magnitude of the faintest star visible seems to be stuck at the max (all stars visible). It's probably just a small bug but I haven't looked at the code yet.

I'll try to provide a patch against the CVS tree this week.


Christophe


Return to “Development”