Active Topics

 


Reply
Thread Tools
Berserk's Avatar
Posts: 199 | Thanked: 156 times | Joined on May 2010 @ Holland
#1
There's only one bug that keeps me from promoting Wallpaeper to Extras-testing, which is the following:

It's possible to open multiple windows after pressing a button more than once.

How can I make sure a button can only be pressed once? (or how can I make sure only one window is opened?)
I've tried: (after button press)
- Disable button before creating a new Manager window (but that seemed to go simultaneously, so the button was disabled just before or after the new window shows)
- Disable the button, if(disabled) - open window (same as above, strange..)
- A boolean that decides whether to open it or not (false if button pressed)
- disconnect() after button press
- if a Manager window is made, don't make it again (didn't work..)

None of these worked
It doesn't crash with multiple windows, there are just multiple windows without a parent window

So can anyone help me with either:
- Preventing double button press
- Setting QListWidget icons faster

Many thanks in advance!
__________________
Wallpaeper - Desktop background manager (in Extras!)
Config Reader - Export all Gconf to an HTML file + compare feature (Extras-testing)
Even though these programs are available for free, I would appreciate any donations

Last edited by Berserk; 2010-09-27 at 19:20. Reason: Added [SOLVED] to title
 
Posts: 5 | Thanked: 1 time | Joined on Sep 2010
#2
Can you be more accurate on what language your coding ?

I'am a beginner but i found handy to use Hildon's StackableWindow.
Makes you sure you won't have multiple windows opened at the same time...

Hope i'am not completely wrong !
 

The Following User Says Thank You to Tetsuo6995 For This Useful Post:
Berserk's Avatar
Posts: 199 | Thanked: 156 times | Joined on May 2010 @ Holland
#3
I'm using C++ in the Nokia Qt SDK

I also use .setAttribute(Qt::WA_Maemo5StackedWindow);
with the right parent window, of course.

When I press the button once, it stacks perfectly, however when I press it multiple times, it opens multiple windows, which then don't have a parent window, and are shown as separate windows.

The window takes some time to load, that's why it can be pressed more than once.
__________________
Wallpaeper - Desktop background manager (in Extras!)
Config Reader - Export all Gconf to an HTML file + compare feature (Extras-testing)
Even though these programs are available for free, I would appreciate any donations
 
Posts: 180 | Thanked: 76 times | Joined on May 2010
#4
Set a windowIsVisible etc. flag before QWidget::show() is called. Then unset the flag when QWidget is hidden (maybe you have to reimplement hideEvent()).

E: Maybe it is easier to help if you show your code...

What do you mean by setting QListWidget icons faster?

Last edited by Diph; 2010-09-27 at 14:59.
 

The Following User Says Thank You to Diph For This Useful Post:
Berserk's Avatar
Posts: 199 | Thanked: 156 times | Joined on May 2010 @ Holland
#5
Thanks for that visible-flag tip I will try something with that, not that I know a lot about flags, but I'll figure it out.


This is how it adds new items to the QListWidget:
- Put all .desktop files from /home/user/MyDocs/.images/ in a QStringList
- Open all of them
--- Check if it contains "Type=Background Image", if it does, next step:
--- Take filename, X-File1=, X-File2=, X-File3=, X-File4=, Name= from the file and put it in a second QStringList, [0] to [5]
--- Then add values from that second QStringList (the "clean" one) to the QListWidget, like this:
Code:
itemList.append(new QListWidgetItem(QIcon(imageSetList[i][1]), QFileInfo(imageSetList[i][0]).fileName(), ui->fileList));
That all goes blazingly fast, except for the QIcon, taken from the X-File1= value.
(A previous version didn't have the icons, it was LOTS faster..)







This is the slot that creates/shows the new window:
Code:
void wallPaeper::manBtnClicked() {
    manWin = new wpManager(this);
    manWin->setAttribute(Qt::WA_Maemo5StackedWindow);
    manWin->setAttribute(Qt::WA_DeleteOnClose);
    manWin->show();
}
By the way, it seems to open multiple windows simultaneously. So I can't do an existing-check in between, because every window is building at the same time as it seems
__________________
Wallpaeper - Desktop background manager (in Extras!)
Config Reader - Export all Gconf to an HTML file + compare feature (Extras-testing)
Even though these programs are available for free, I would appreciate any donations

Last edited by Berserk; 2010-09-27 at 16:42.
 
Berserk's Avatar
Posts: 199 | Thanked: 156 times | Joined on May 2010 @ Holland
#6
The updateList() function, that does the above with the QStringLists, is in the constructor of wpManager (the new window). Hence the loading time,

I've just gotten an idea, which didn't work before, but I thought of a new way to do it..

I'll remove updateList() from the contructor, make a connect() function that checks if the window is visible, and updates the list when it is.
I'll make sure the slot prevents an infinite loop, since it stays visible for a while.

So it will load the list after the window opens. This will greatly improve the loading time (before it shows), making double button pressing less likely.
__________________
Wallpaeper - Desktop background manager (in Extras!)
Config Reader - Export all Gconf to an HTML file + compare feature (Extras-testing)
Even though these programs are available for free, I would appreciate any donations

Last edited by Berserk; 2010-09-27 at 17:00.
 
Berserk's Avatar
Posts: 199 | Thanked: 156 times | Joined on May 2010 @ Holland
#7
It's solved it's probably not the prettiest solution, but I'm not taking my code to the catwalk

It sets openManWin on true in the constructor, after the button press it's set on false, and after the window closes, it's true again.

Here's the code:
Code:
void wallPaeper::manBtnClicked() {
    if(openManWin == true) {
        openManWin = false;
        manWin = new wpManager(this);
        manWin->setAttribute(Qt::WA_Maemo5StackedWindow);
        manWin->setAttribute(Qt::WA_DeleteOnClose);
        connect(manWin, SIGNAL(destroyed()),
                this, SLOT(openManWinTrue()));
        manWin->show();
    }
}
void wallPaeper::openManWinTrue() {
    openManWin = true;
}
__________________
Wallpaeper - Desktop background manager (in Extras!)
Config Reader - Export all Gconf to an HTML file + compare feature (Extras-testing)
Even though these programs are available for free, I would appreciate any donations

Last edited by Berserk; 2010-09-27 at 19:18.
 
Reply


 
Forum Jump


All times are GMT. The time now is 14:36.