These are chat archives for highfidelity/hifi

19th
Mar 2014
Chris Mitchell
@Chris7
Mar 19 2014 01:46
What would be the relevant files/methods for obtaining information on currently running scripts/past run?
it seems that ScriptEngine is the main class for an individual script
Chris Mitchell
@Chris7
Mar 19 2014 01:55
@ddobrev you need to set the window as frameless and mimik the window as a widget
@ddobrev It's a bit of a pain, but you use: setWindowFlags(Qt::CustomizeWindowHint); setWindowFlags(Qt::FramelessWindowHint); setMouseTracking(true);
@ddobrev You will need to provide your own min/max/close/about/whatever icons, as well as their coordinate mapping. And handle mouseMoveEvent, mousePressEvent, mouseReleaseEvent, and paintEvent at the minimum. Realistically you should be handling the resizeEvent as well. But that will give you what you want.
Now someone come around who can tell me about the script engine before I have to dig through the internals for 2 hours :)
Chris Mitchell
@Chris7
Mar 19 2014 02:05
Well I found one way to get the currently running scripts:
QList<QAction*> scriptActions = Menu::getInstance()->getActiveScriptsMenu()->actions();
foreach (QAction* scriptAction, scriptActions) {
scriptAction->activate(QAction::Trigger);
qDebug() << "stopping script..." << scriptAction->text();
}
Is there really no getScripts() function?
Brad Hefta-Gaub
@ZappoMan
Mar 19 2014 04:02
@Chris7 - sorry I missed your questions… ping me if you want to chat
Dimitar Dobrev
@ddobrev
Mar 19 2014 12:52
@Chris7 Thank you for your suggestions. However, I mentioned at the start that there seems to be no reliable event that reports a window being dragged around because the window title is not part of Qt but rather of the OS window manager. In particular, mouseMove isn't triggered.
I've read all the advice given here and search for another way to do it.
Chris Mitchell
@Chris7
Mar 19 2014 14:37
@ddobrev That's why you do not have a window
@ddobrev By making it part of the widget, you are able to handle all the logic. mouseMove is part of the widget, not the window because there is no window frame to capture that.
Dimitar Dobrev
@ddobrev
Mar 19 2014 14:52
@Chris7 I meant the title of the main (application) window. Sorry for not making that clear.
Chris Mitchell
@Chris7
Mar 19 2014 14:53
@ddobrev Title, why would that matter?
@ddobrev You can write the title
Dimitar Dobrev
@ddobrev
Mar 19 2014 14:57
@Chris7 To make sure the chat window stays within the main one, I need to detect the movement of the main one and move the chat one accordingly.
Perhaps I'm misunderstanding you and you mean a custom title for the main window?
Chris Mitchell
@Chris7
Mar 19 2014 14:59
Yes, that is simple.
Dimitar Dobrev
@ddobrev
Mar 19 2014 15:00
I see. That could work. Thanks.
Chris Mitchell
@Chris7
Mar 19 2014 15:00
Here's some very non-optimal code that does it
...how can I paste code in here?
Dimitar Dobrev
@ddobrev
Mar 19 2014 15:01
No idea. You could use pastebin, though.
That was to get a custom border around a window, the buttons correspond to minimize,close,max buttons (the onButton variable)
It was a very quick project so it isn't abstracted, but it shows what needs to be done
And I deleted some of the non-relevant bits, but it should be sufficient to show how to move 2 things in sync (the parentWidget()->move(e->globalPos() - offset); bit)
Dimitar Dobrev
@ddobrev
Mar 19 2014 15:05
@Chris7 Thank you.
Chris Mitchell
@Chris7
Mar 19 2014 15:06
np
The only difficult bit is handling window resizes
Chris Mitchell
@Chris7
Mar 19 2014 15:12
Also, re:coding standards, do you guys want ui files in mixedCase or should I start using CaptialCase?
Dimitar Dobrev
@ddobrev
Mar 19 2014 15:13
@Chris7 I named mine like the existing one - that is, camelCase - and it was taken so I guess camelCase is the way to go.
Chris Mitchell
@Chris7
Mar 19 2014 15:14
ok
Dimitar Dobrev
@ddobrev
Mar 19 2014 15:14
Do you work on Linux?
Chris Mitchell
@Chris7
Mar 19 2014 15:14
yes
Tony Hagale
@thagale
Mar 19 2014 15:38
I was very pleasantly surprised at how easy hifi was to build from source on Mac OS. Kudos, all.
FearghusMcMahon
@FearghusMcMahon
Mar 19 2014 19:58
building it on mac osx is probably the easiest of them all, also on osx it performs so far best of all for me. My old 2008 macbook is laughing at my windows desktop ;)
Tony Hagale
@thagale
Mar 19 2014 21:32
FYI: I just dropped a pull request in [ https://github.com/highfidelity/hifi/pull/2389 ] for the request to optimize numberOfOnes()
Brad Hefta-Gaub
@ZappoMan
Mar 19 2014 21:51
@thagale - checking it out now
Brad Hefta-Gaub
@ZappoMan
Mar 19 2014 22:04
Nice work @thagale ! merged!
Tony Hagale
@thagale
Mar 19 2014 22:06
awesome! glad it helped, if even a little. It looks like there are some better general-purpose population count algorithms if you don't think the table will be kept in memory, but most of the pre-written ones assume 32-bit ints. There's a good one that's O(log n) but would require converting to/from a 32-bit int
Philip Rosedale
@PhilipRosedale
Mar 19 2014 23:30
Yes thank you @thagale that's very cool.. nice speedup!