CodecMenuPlugin

1 view
Skip to first unread message

icoz

unread,
Aug 1, 2008, 7:48:42 AM8/1/08
to HaiQ Development
I made this plugin for support many encodings for different files in
project.
Plugin automatically gets all codecs (that Qt knows) and generate
menus.

By the way I modified:
plugins/system/mainwindow/haiqmainwindow.cpp - added 'Coding' menu
plugins/system/editor/shared/defaulteditorinterface.* - added codec
support
haiqcoreinterface/haiqcommon.* \_ added codec support
haiqcoreinterface/haiqeditorinterface.* /
plugins/system/menus/codecmenu - CodecMenuPlugin

All suggetions and wishes write to this thread!

Thanks,
Vladimir Tikhomirov
(aka icoz)

jeremy....@gmail.com

unread,
Aug 1, 2008, 11:55:15 AM8/1/08
to ha...@googlegroups.com
Hi icoz, Thanks for the plugin (and Russian translation).

The plugin compiled fine for me on Windows, and I see the new menu. Unfortunately, being an American and a Windows user, I am very unfamiliar with the notion of different text file encoding schemes. I am wondering if we need to make any changes to the "read_text_file" and 'write_text_file" functions which are used extensively throughout haiq. I think Elcuco once suggested to me that I add some kind of codec option to this function. If someone could take care of this, or explain the issues involved, I'd be very grateful.

Regards,
Jeremy

icoz

unread,
Aug 4, 2008, 5:25:07 AM8/4/08
to HaiQ Development
Look here:
in haiqcommon.h
---------------------
//Returns the text contained in the file
//QString HAIQ_CORE_INTERFACE_EXPORT read_text_file(const QString
&fname);
//Writes text to the file
//bool HAIQ_CORE_INTERFACE_EXPORT write_text_file(const QString
&fname,const QString &txt);
///Returns the text contained in the file with codec
QString HAIQ_CORE_INTERFACE_EXPORT read_text_file(const QString
&fname, QTextCodec *codec = 0);
///Writes text to the file with codec
bool HAIQ_CORE_INTERFACE_EXPORT write_text_file(const QString
&fname,const QString &txt, QTextCodec *codec = 0);
---------------------
I made there check: if codec!=0 then setCodec. Else function works as
it was (with system codec).
So all other parts of haiq even doesn't know that read_text_file or
write_text_file supports now codecs.
Old call like "content = read_text_file(filename);" know means
"content = read_text_file(filename, 0);" ("read text file with default
system codec").
If some part(plugin) can work with different codecs, it should use
extended version of read_text_file/write_text_file.

See haiqeditorinterface changes...
I added:
1) new methods:
virtual void setCodec( const QString &codec_name ); //Set codec for
file by name
virtual void setCodec( QTextCodec *codec ); //Set codec for file
virtual QTextCodec* currentCodec(); //Get current codec for file
2) new protected variable QTextCodec *codec. It was made protected
because DefaultEditorInterface (child of HaiQEditorInterface) should
change it.
So all children of HaiQEditorInterface automatically supports by
CodecMenuPlugin without any changes.

Regargs,
icoz.

On 1 авг, 19:55, jeremy.magl...@gmail.com wrote:
> Hi icoz, Thanks for the plugin (and Russian translation).
>
> The plugin compiled fine for me on Windows, and I see the new menu.
> Unfortunately, being an American and a Windows user, I am very unfamiliar
> with the notion of different text file encoding schemes. I am wondering if
> we need to make any changes to the "read_text_file" and 'write_text_file"
> functions which are used extensively throughout haiq. I think Elcuco once
> suggested to me that I add some kind of codec option to this function. If
> someone could take care of this, or explain the issues involved, I'd be very
> grateful.
>
> Regards,
> Jeremy
>

jeremy....@gmail.com

unread,
Aug 11, 2008, 3:34:33 PM8/11/08
to ha...@googlegroups.com
Excellent, Icoz. That seems like the right way to do it.
Thanks!
Jeremy

2008/8/4 icoz <vlad_...@rambler.ru>

Christian Dähn

unread,
Aug 13, 2008, 7:11:23 PM8/13/08
to ha...@googlegroups.com
Hi,

today I checked in some changes/improvements:

- the default editor now has its own font settings
- the open file dialog now has a history and starts using the last opened dir

I hope, the new handling of the open file dialog is ok.

ciao,
Chris


jeremy....@gmail.com

unread,
Aug 15, 2008, 6:23:39 AM8/15/08
to ha...@googlegroups.com
Chris, Thanks for the improvements. I just compiled them today, and everything seems fine on Windows. Regarding new handling of open file dialog, I think it's good the way you have changed it. However, there is also an advantage to starting at the current project directory (previous functionality). Does anybody else feel the same way? I wonder if there is an easy way to get the best of both worlds here. Not a big deal though.
Jeremy

icoz

unread,
Aug 17, 2008, 4:23:40 PM8/17/08
to HaiQ Development
Hi, all!

I updated CodecMenuPlugin.
Now current codec for current editor is checked in menu.

By the way I fixed 2 bugs:
- in DefaultEditorInterface: restored correct work with codec.
- added check for open-file-dialog is cancelled - then we DONT load
file

PS. I thought thread called "CodecMenuPlugin" is not for disscussion
about open dialog. May be it's more logical to create new thread for
this discussion?

Christian Dähn

unread,
Aug 28, 2008, 4:07:09 PM8/28/08
to ha...@googlegroups.com
Hi,

the last days I checked in some new changes:
- now restoring last selection of file and class tree works - can be
enabled/disabled under Settings -> Project Browser
=> limitation: selected classes are not restored, only selected files
(by just cklicking on them) can be restored in tree view

- file positions (line numbers) are restored automatically

- added new setting "Save before Build" under "Main Window" to
save all changed files automatically before running qmake or make
(default is off/disabled)

I hope this will bring some more comfort and fun ;)


Further I discussed with a german user of HaiQ - who still uses
the very old Windows 0.2.x version before the comple rewrite.

Here some of his reasons why he still don't wants to use the current version:

- mixed up case for filenames in filebrowser under win32
- missing project dependant setting files in project dirs (the former "<project>.haiq")
- "tags for current class" seems to not work properly
- missing restoring of open files and state of tree views (now solved)
- missing automatic saving of open files before compile (now solved)
- missing debugger support (in work ;-)

Currently I'm working hard to solve most of the mentioned issues -
so hopefully I can convince him to use the current SVN version ;-)

ciao,
Chris

jeremy....@gmail.com

unread,
Aug 28, 2008, 8:03:27 PM8/28/08
to ha...@googlegroups.com
Great, Chris, it looks like you are making important progress... and it makes me happy as you seem to be keeping this project alive!

I also have a few "complaints" about the current state of haiq :)
  
   Sometimes haiq seems to lose track of tags for certain files... then I need to restart the program.
   The new project dialogs leave a lot to be desired, and the new class dialog could be improved.

Once we get the tracking system set up, I have a whole bunch of other things to report... so I can't wait until we "get organized".

Cheers,
Jeremy

Jose Maria Garcia-Valdecasas

unread,
Aug 29, 2008, 3:08:12 AM8/29/08
to ha...@googlegroups.com
I'd like to say sorry for being a bit disconnected these past months. In fact, i'm spending my spare time practicing one of my favourite sports, windsurf. And during the summer, the chances of sailing are greater, also the weather is much nicer... so i have less time for HaiQ, Chainlink or coding in general.

We may have a calm week after a very windy one.. so i will try to colaborate a bit.

I hope that you all understand :)

Jose.

Christian Dähn

unread,
Aug 29, 2008, 11:11:14 AM8/29/08
to ha...@googlegroups.com
Hi,

I checked in a new feature and some bugfixes:

- now the correct tab order of open files is restored (restoring state
of splitted window is already prepared)

- fixed open file restoring bug under windows

- now the bracket highlighting works completely again (formerly there
was an issue caused by function+operators highlighting)

@Jeremy: Thanks :-)

@Jose: No problem ;-)

Have a nice weekend guys!

ciao,
Chris

jeremy....@gmail.com

unread,
Aug 29, 2008, 2:06:29 PM8/29/08
to ha...@googlegroups.com
Chris, I compiled your changes on windows, and everything runs beautifully. Wow, it's nice to see a reload of the previous state -- I'll need to check out how you did that in the code :)

One serious issue: In the current bracket highlighting (which is much improved BTW), it now causes the document to be "dirty", i.e. "modified". I'm going to see if I can fix that now, because it is a big pain.

Jeremy

jeremy....@gmail.com

unread,
Aug 29, 2008, 2:18:35 PM8/29/08
to ha...@googlegroups.com
Okay, I fixed that issue and checked it in.
.... it feels good to be back in haiq dev mode :) ... looking forward to a nice issue tracking system.

Christian Dähn

unread,
Aug 29, 2008, 4:56:19 PM8/29/08
to ha...@googlegroups.com
Hi Jeremy,


>
> Okay, I fixed that issue and checked it in.
>

Super!

>
> .... it feels good to be back in haiq dev mode :)
>

...me too ;-)

>
> ... looking forward to a nice issue tracking system.
>

This will take some time - Apropos:
I reached the owner of www.haiq.org, but he wants up to 3000 bucks
for the domain - shamelessly...

Alternatively I talked with the (german) owner of www.haiq.info -
he would allow us to use the domain for our project website...
....without having to pay buckets of dollars (or euros).

So let's see...

ciao,
Chris

Christian Dähn

unread,
Aug 29, 2008, 6:22:25 PM8/29/08
to ha...@googlegroups.com
Hi,

I checked in a rewritten bracket highlighter - now it works flawlessly ;-)

ciao,
Chris


sadjo...@gmail.com

unread,
Sep 2, 2008, 1:59:44 PM9/2/08
to HaiQ Development
Hey guys, can i make a little request for a plugin or something like
this making automatic execution of a process after successfull
compile... something like: "C:\file.exe -t opt1 -u opt2" when my
program compiles. If someone makes it i will be very grateful.
Also last changes of haiq are really great. Now i don`t even close
HaiQ it on my pc :) I`m so pleased with that IDE. Thank you.

sadjo...@gmail.com

unread,
Sep 2, 2008, 2:01:58 PM9/2/08
to HaiQ Development
Oh, one more thing .. sorry for double post. Do you have plans to make
"code folding" feature for HaiQ? Thank you again.

Christian Dähn

unread,
Sep 2, 2008, 2:18:52 PM9/2/08
to ha...@googlegroups.com
Hi,

you can easily add commands after successful compile directly
to your .pro files - just follow my guide:

http://www.3dh.de/3dh.de/2006/12/19/qt-automated-unit-tests-with-qmake/

Thus enables you to add any command to your .pro files,
which will be executed after linking - which is used in my company
for very large platform independant projects.

To your request for code folding: Sounds interesting, till now I don't
know who will do it and when - but: We are currently building a new
project website with a site for feature requests and a roadmap.

But this will take some weeks - so I have to ask you for some patience ;-)

ciao,
Chris


Christian Dähn

unread,
Sep 3, 2008, 6:38:31 PM9/3/08
to ha...@googlegroups.com
Hi,

I've check in some new functionality, which needs some testing:

- now you can use Ctrl+Up / Ctrl+Down to goto the next/previous
 occurence of the current word under the cursor

- brackets are now only highlighted while the cursor stays on a bracket -
 this was changed in cause of some coloring troubles and for usability
 (experiences taken from other IDEs)

I hope these changes are ok - especially the change of the bracket
highlighting - which let me have some headaches.

ciao,
Chris

jeremy....@gmail.com

unread,
Sep 4, 2008, 8:39:37 AM9/4/08
to ha...@googlegroups.com
Thanks Chris. Everything seems to compile okay on windows.

Ctrl+Up/Ctrl+Down seems to work, but there is a one important usability issue:
  Suppose the current word is "QWidget" and I want to go through all occurances of this word. So I press Ctrl+Down repeatedly. This is fine until I come to the word "QWidgetList", then it will no longer be searching for QWidget, but QWidgetList, and so will get annoyingly stuck. Therefore I propose the following fix: If text is highlighted, then search for highlighted text instead of the current word. I think this should fix the above issue.

Braces highlighting also seems to work fine, but is it possible that the response of the editor has been slowed somewhat? I can't say for sure, but please let me know if you have sacrificed some performance in the editor.

Thanks!
Jeremy

jeremy....@gmail.com

unread,
Sep 4, 2008, 9:10:16 AM9/4/08
to ha...@googlegroups.com
... on other thing Chris... with your recent changes, the wordcompletion window now seems to pop up in back of the main window, rather than in front ...

Christian Dähn

unread,
Sep 4, 2008, 9:27:29 AM9/4/08
to ha...@googlegroups.com
Hi,

your're right Jeremy - it seems that the last changes lead to performance
problems - I noticed such during selecting text. But: The former version using
timers wasn't performance friendly, too - especially if you rapidly move to
many braces - this can lead to serious coloring issues - one of the main
reasons to changes this behavior. But I could reproduce these issues only
under linux - maybe Qt / QTextEdit behaves a little bit different.

Btw: The behaviour of QTextEdit & Co. changed dramatically since Qt 4.4 -
e.g. the "QTextCusor::beginEditBlock()" doesn't work correctly under linux.

Till now I didn't recognize the issue of the wordcompletion popup under linux.

But there are many issues left in the editor - e.g. if you close a block by entering
a "}" the editor reases parts of the previous line.

Oh... there's so much work left...

ciao,
Chris


jeremy....@gmail.com

unread,
Sep 4, 2008, 10:30:16 AM9/4/08
to ha...@googlegroups.com
Chris, I have reverted back to rev. 397 on my system, and I'll wait for further updates, particularly regarding the wordcompletion and cppcompletion popup window problem.
Jeremy

Christian Dähn

unread,
Sep 4, 2008, 11:15:28 AM9/4/08
to ha...@googlegroups.com
Hi Jeremy,


>
> Chris, I have reverted back to rev. 397 on my system, and I'll wait for further updates, particularly regarding the wordcompletion and cppcompletion popup window problem.
>

Mhm... that's not good. Currently I don't have any idea how the last changes could influence the
completer's popup windows.

Here the colored diffs for the changed functionality (.cpp files):

 http://haiq.svn.sourceforge.net/viewvc/haiq/src/plugins/system/editor/shared/defaulteditorwindow.cpp?sortdir=down&r1=345&r2=398&sortby=rev
 http://haiq.svn.sourceforge.net/viewvc/haiq/src/plugins/system/editor/shared/haiqtextedit.cpp?sortdir=down&r1=395&r2=398&sortby=rev

Maybe the key handling could be an error source - but at first and second sight I still
couldn't find sources for performance or window displaying errors.

My collegues tested the current revision, too - but we cannot reproduce the errors.

Can you describe the performance issues? And when exactly does the popup window
misbehave (which keys are pressed before)?

I'm highly motivated to solve the problems - but I need some help,
even because I still don't know so much details of HaiQ.

ciao,
Chris

jeremy....@gmail.com

unread,
Sep 4, 2008, 11:43:58 AM9/4/08
to ha...@googlegroups.com
Okay, since you can't reproduce the problem, I'll fix it on my end... and then let you know what was the cause.
Thanks for the quick info.
Jeremy

jeremy....@gmail.com

unread,
Sep 4, 2008, 12:17:40 PM9/4/08
to ha...@googlegroups.com
Very strange, when I recompiled your changes, everything worked fine this time... so I guess there was no problem after all...

I committed some new changes
- Modified slot_FindNextWordUnderCursor and slot_FindPreviousWordUnderCursor so that if text is highlighted, the search uses the highlighted text rather than the word under the cursor.
- Modified the wordcompletion plugin so that custom words can be added to the list of words to autocomplete... see templates/wordcompletion.txt

Christian Dähn

unread,
Sep 4, 2008, 2:13:30 PM9/4/08
to ha...@googlegroups.com
Hi Jeremy,


>
> Very strange, when I recompiled your changes, everything worked fine this time... so I guess there was no problem after all...
>


uff (sigh) ... I'm happy to hear this.


>
> I committed some new changes
> - Modified slot_FindNextWordUnderCursor and slot_FindPreviousWordUnderCursor so that if text is highlighted, the search uses the highlighted text rather than the word under the cursor.
> - Modified the wordcompletion plugin so that custom words can be added to the list of words to autocomplete... see templates/wordcompletion.txt
>


Great!

So my evening is rescued ;-)

ciao,
Chris

jeremy....@gmail.com

unread,
Sep 4, 2008, 2:44:19 PM9/4/08
to ha...@googlegroups.com
I hate to say it but the problem is back... it happens after some time of using the IDE, and I don't know what causes it...

Christian Dähn

unread,
Sep 4, 2008, 3:07:00 PM9/4/08
to ha...@googlegroups.com

>
> I hate to say it but the problem is back... it happens after some time of using the IDE, and I don't know what causes it...
>

That's one of the seldom moments where I hate it to be a software developer :-(

If this issue is new and reproduceable, whe sould find the last revison without these problems -
than we can use the ViewCVS to make such fany colored diffs to maybe find out the reason.

ciao,
Chris


jeremy....@gmail.com

unread,
Sep 5, 2008, 8:41:51 AM9/5/08
to ha...@googlegroups.com
I just checked in some modifications that attempt to fix the following 2 issues:

(1) Mysterious problem where wordcompletion popup window pops up behind the main Window
(2) When typing "}", sometimes text in previous line is erased.

Time will tell whether I was successful.

Also, regarding HaiQEditorInterface:
My intention was to keep everything in haiqcoreinterface stable... and change only the functionality in haiqcore and the plugins. Sometimes there are good reasons for haiqcoreinterface to be modified, but this should be done cautiously (because every plugin depends on it). Now, I realize that the weak link in this seems to be HaiQEditorInterface, which often needs updating whenever new functionality is added to the editor. I think this is okay for now, but I eventually want to revisit this issue... ideally editor functionality should only be found in the editor plugins... and the menu actions controlling editor commands should be defined within the editor plugin itself. We can revisit this later... just to give a heads up. For now, feel free to add to HaiQEditorInterface, as has been done, when needed, and we'll clean up later.

Jeremy

Christian Dähn

unread,
Sep 5, 2008, 9:05:45 AM9/5/08
to ha...@googlegroups.com

>
> (2) When typing "}", sometimes text in previous line is erased.
>

Cool! That's great - today I experienced this ennoying error multiple times -
I'm looking forward to enjoy typing "}" without any fear ;-)

ciao,
Chris


Jose Maria Garcia-Valdecasas

unread,
Sep 5, 2008, 9:56:42 AM9/5/08
to ha...@googlegroups.com
Hi,

it's nice to know that the 2nd issue is fixed. I really hated that nasty bug.

Regarding to Editor plugins, IIRC, some months ago we spoke about modifying the way we handle the editors right now.. i will try to find that conversation and post it here. Jeremy, if you recall what we spoke about... could you post it?

Ciao,

Jose

Reply all
Reply to author
Forward
0 new messages