Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror

Comment Re:Native GUI app development is a pain (Score 1) 330

Okay, found the example in my code archives:

CFileDialog fDlg( TRUE, NULL, NULL,
        OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_EXPLORER,
        NULL, this );
DWORD MAXFILE = 2562;
fDlg.m_ofn.nMaxFile = MAXFILE;
fDlg.m_ofn.lpstrFile = new wchar_t[MAXFILE];
fDlg.m_ofn.lpstrFile[0] = NULL;
fDlg.m_ofn.lpstrFilter = L"Images\0*.bmp;*.jpg;*.jpeg;*.png;*.tif;*.tiff\0"
        L"All files\0*.*\0";

#ifdef NDEBUG
fDlg.m_ofn.Flags&= ~OFN_ENABLEHOOK; //Vista style support
#endif // Display the Open dialog box.
if (fDlg.DoModal()==IDOK){
        for (POSITION pos = fDlg.GetStartPosition();pos != NULL;)
        {
                CString fname= fDlg.GetNextPathName(pos);//here's the filename!
        }
}

More or less the same stuff in Qt:

QFileDialog dialog(this);
dialog.setFileMode(QFileDialog::ExistingFiles);
dialog.setNameFilter(trUtf8("Splits (*.000 *.001)"));
QStringList fileNames;
if (dialog.exec())
        fileNames = dialog.selectedFiles();//List of files is returned

The WinAPI version required a lot of trial and error to get the input parameters correct. Plus, there's no way of stating "allocate as much memory as required for output", so you have to pre-allocate memory and hope the user doesn't select too many files. This issue turns a "lots of boilerplate code pasted from MSDN" inconvenience into a real problem with no solution except for displaying an error message.

Comment Re:Marketing and user experience (Score -1) 373

"7500 songs" is just as bad as that Libraries of Congress shit. Some songs last 3-4 minutes, some run for 7-9. Bitrate can also change the total count significantly. What's more, users usually don't know how many songs they have. A better measurement would be a "74-minute CD", but it still depends on the bitrate.

Comment Re:Native GUI app development is a pain (Score 1) 330

Thanks for sharing the info! Qt signals also have problems with passing non-Qt classes. If I recall correctly, in order for passing non-Qt classes, they have to be inherited from QObject, and have the QOBJECT macro defined in the class definition; also some code is required to declare the class at runtime (qRegisterMetaType). It's strange that Trolltech didn't use C++ templates instead of moc when they developed Qt4 and broke compatibility with earlier Qt versions.
But moc is still required, so Qt compilation may be tricky if you're using a non-standard toolchain (Intel's C++ compiler for example) and not using qmake to build the project.

Comment Re:Native GUI app development is a pain (Score 1) 330

Just a quick example: to create a thread in Boost, I need just one line of code, with relevant and understandable. A mutex takes one line (no parameters required) and a mutex locker is also a one-liner. Now in Windows, this stuff requires a lot more boilerplate code, with pointers and illogical function names such as WaitForSingleObject to lock a mutex.
I've created a simple image-viewing UI in win32 api and it took about 600 lines of code, 400 of which are related to scrollbars. In Qt the same application took about 50 lines of code and I didn't even have to write a single line of code for the scrollbars to work.
Another thing which kills me is poorly documented function parameters, some of which are even conflicting! It took me about 2 hours just to make a progress bar work.
If you learned Win32 API properly and have used it a lot, you probably are OK with it. But compared to modern toolkits/frameworks (Qt, Boost, .NET Framework, Java etc) it's much more difficult to use and writing an app in WinAPI feels like a waste of time.

Comment Re:Native GUI app development is a pain (Score 2) 330

Technically I was probably wrong - although some stuff in WinAPI looks like C++, such as
- pre-defined pointers (LPCWSTR etc.) are close to C++ references
- structs are used far more often than in C
- less memory tricks, such as pointer arithmetic
And MFC is C++, but most developers give up on using this monster, and instead implement their own C++ wrappers for making WinAPI usable.

Comment Re:Native GUI app development is a pain (Score 5, Interesting) 330

Qt is an incredible toolkit. The only problem is that it looks "different" in Gnome, but about a year ago this problem seems to be solved.
Qt Creator is one of the highest-quality IDEs - very easy to use, powerful and not getting in the way.
Plus as a bonus Qt apps can be easily ported to Windows and MacOS, especially if they aren't using anything outside the Qt toolkit - many apps will simply compile and run with zero changes. Qt includes stuff like XML parsing, sockets, OpenGL etc. so you can probably will never need anything except Qt.
The only thing some people don't like about Qt is the need for a preprocessor and duplication of C++ stdlib stuff (like containers, I/O operatuins), which supposedly fragments C++ development. But I actually like this - no need to use use multiple library dependencies, everything is included in Qt SDK, along with great documentation and works out of the box.
There are concerns about Qt's future, since it no longer fits in Nokia's strategy. But it's quality definetly exceeds most toolkits like wxwidgets, gtk, mono and many others. Probably because the "boring" stuff like documenting and testing was done by full-time employees.

Oh, and Windows native C++ development is horrible. Just look at how you're supposed to display the standard "open files" dialog and get the selected file names.

Comment Re:What a stupid us of statistics (Score 2, Interesting) 770

Nexus One currently has tons of bugs:
- Clock drift (as much as 5 minutes/week!)
- WiFI/network switchover. When I leave home, I have to enter airplane mode and turn it back off, or else my 2G/3G data will not work simply because the phone liked my home WiFI so much.
- Headphone jack sometimes goes nuts. If you get an incoming call while listening to music, there's no way of predicting if sound will go to headphones or the speaker. Once this resulted in all calls going to headphones, even when they were disconnected. I couldn't hear anything and lost an important call.
- Buggy car dock bluetooth, also no way of predicting if it will use the dock's or the phone's speaker.
- Ringtones sometimes change randomly. It may be *any* song or the "default" ringtone.
- The launcher becomes slow and unresponsive over time, crashes and after that works OK until the next slowdown and crash.
- Sometimes the screen locker stops responding. This looks like a touchscreen bug, however holding the power button reveals a menu which does work correctly. So this is not a frozen phone or hardware problem.
- The Gingerbread update was awful until 2.3.5 was released. Reboots and slowdowns every two days. 2.3.5 fixed reboots, but the pre-gingerbread bugs are still there.

This is just a few bugs!

Comment Re:and what about xerox's stuff? (Score 1) 988

Tapping icons existed 10 years before the iPhone, as seen on PalmPilot and (later) on Microsoft's Palm-size PC. From what I understand, Apple is unhappy about innovative stuff like the proximity sensor, multi-touch gestures, touch-friendly controls (instead of replicating the desktop UI) etc.

Comment Code Search (Score 5, Insightful) 139

Code Search is the part I'll miss the most. Great for searching code samples (such as using threads in Perl etc) with some context (instead of a one-line snippet) and without junk like Experts-Exchange or unanswered forum posts. I also like the ability to search code inside a library along with third-party projects using this library, great for bugfixing.
Google is turning into Bing now. Answering common questions with helper scripts (flight info), and forwarding the user to Wikipedia if there is no predefined script. Except that Bing is doing this because their *real* search engine is a joke.

Slashdot Top Deals

The speed of anything depends on the flow of everything.

Working...