Active Topics

 


Reply
Thread Tools
Posts: 434 | Thanked: 325 times | Joined on Sep 2009
#1
I'm having some really odd difficulties in locating the .sounds directory. This no doubt due my limited understanding of Linux.

I got the following (Qt) code:

Code:
QString fileName = QFileDialog::getOpenFileName(this,tr("Open Sound"), "/home/user/MyDocs/.sounds", tr("Wave Files (*.wav)"));

// END
With this I get the no files/folders in Open file dialog and the directory up button is disabled. The same thing happens when pointing to /home/user/MyDocs. When I point to /home/user, I don't see the MyDocs directory but up button works.

Can anyone please explain what I'm doing wrong? Where is the .sounds directory located?

Thank you

Last edited by Sasler; 2010-01-01 at 06:30.
 
pagesix1536's Avatar
Posts: 232 | Thanked: 102 times | Joined on Nov 2009 @ Warren, MI, USA
#2
looks like the correct path to me. Maybe you need the trailing forward slash? I'm shooting in the dark here...I'm no programmer.
__________________
N900
TuxRunner.com
 

The Following User Says Thank You to pagesix1536 For This Useful Post:
Posts: 434 | Thanked: 325 times | Joined on Sep 2009
#3
Originally Posted by pagesix1536 View Post
looks like the correct path to me. Maybe you need the trailing forward slash? I'm shooting in the dark here...I'm no programmer.
Thanks, but it doesn't make any difference. The same result.
 
Posts: 355 | Thanked: 566 times | Joined on Nov 2009 @ Redstone Canyon, Colorado
#4
Ya, that PATH is correct.

The reason they made it a "hidden" directory was so they could translate it. Like that directory *name* stays the same across all installations, but on my spanish system it says "Sonidos", for example. So they are mapping to it some other way as well, to provide translations. Also, files that begin with a dot ".", are called "hidden" files in *nix. This isn't a full answer to your question, but maybe that provides some hints that will help.

Good luck and post the answer if you find it.
 

The Following User Says Thank You to jebba For This Useful Post:
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#5
In GTK+, having the Hildon file chooser dialog open, already navigated to the .sounds directory works fine. (You can compile the attached to verify that.)

I know **** all about Qt so I wouldn't take this seriously, but you could try:
  • Ensuring that the device is not in Mass Storage mode. ;P
  • Try setting the path after the dialog is instantiated.

PHP Code:
/* gcc file-chooser-example.c $(pkg-config --cflags --libs glib-2.0 gtk+-2.0 hildon-1 hildon-fm-2) -Wall */

#include <stdlib.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <hildon/hildon.h>
#include <hildon/hildon-file-chooser-dialog.h>

static void on_file_chooser_dialog_response (GtkWidget *file_chooser_dialoggint response_idgpointer user_data G_GNUC_UNUSED)
{
    if (
response_id == GTK_RESPONSE_OK)
    {
        
char *filename gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser_dialog));
        
GtkWidget *note hildon_note_new_information (GTK_WINDOW (file_chooser_dialog), filename);
        
gtk_dialog_run (GTK_DIALOG (note));
        
gtk_widget_destroy (note);
        
g_free (filename);
    }

    
gtk_widget_destroy (file_chooser_dialog);
    
gtk_main_quit ();
}

int main (int argccharargv[])
{
    
GtkWidget *file_chooser_dialog;
    
GtkFileFilter *file_chooser_filter;

    
g_assert (g_file_test ("/home/user/MyDocs/.sounds"G_FILE_TEST_IS_DIR));

    
hildon_gtk_init (&argc, &argv);

    
file_chooser_dialog hildon_file_chooser_dialog_new (NULLGTK_FILE_CHOOSER_ACTION_OPEN);
    
gtk_window_set_title (GTK_WINDOW (file_chooser_dialog), "Open Sound");
    
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (file_chooser_dialog), "/home/user/MyDocs/.sounds");
    
file_chooser_filter gtk_file_filter_new ();
    
/* gtk_file_filter_set_name (file_chooser_filter, "Wave Files"); */ /* No point with the HildonFileChooserDialog... */
    
gtk_file_filter_add_pattern (file_chooser_filter"*.wav");
    
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (file_chooser_dialog), file_chooser_filter);
    
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (file_chooser_dialog), file_chooser_filter);

    
g_signal_connect (G_OBJECT (file_chooser_dialog), "response"G_CALLBACK (on_file_chooser_dialog_response), NULL);
    
gtk_widget_show_all (file_chooser_dialog);

    
gtk_main ();

    return 
EXIT_SUCCESS;


Last edited by qwerty12; 2010-01-01 at 18:05.
 

The Following User Says Thank You to qwerty12 For This Useful Post:
Posts: 2 | Thanked: 0 times | Joined on Jul 2010
#6
Do you launch your application with the "user" user?

Maybe you are using QtCreator. If you use QtCreator, the application gets launched with the "developer" user, wich, I think so, can't read /home/user/MyDocs/.sounds.

Try to exec your application from an xterm...

HTH,
Raul.
 
Reply


 
Forum Jump


All times are GMT. The time now is 00:59.