Ejemplo n.º 1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    left_panel=new FilePanel(ui->centralWidget);
    right_panel=new FilePanel(ui->centralWidget);
    currentPanel=left_panel;
    menu=new QMenu;

    ui->gridLayout->addWidget(left_panel->layoutWidget,1,0,1,1);
    ui->gridLayout->addWidget(right_panel->layoutWidget,1,1,1,1);


    connect(left_panel,SIGNAL(tryOpen(QModelIndex)),this,SLOT(open(QModelIndex)));
    connect(left_panel,SIGNAL(tryJump(QString)),this,SLOT(jumpTo(QString)));
    connect(left_panel,SIGNAL(panelActivated(FilePanel*)),this,SLOT(setCurrentPanel(FilePanel*)));
    connect(left_panel,SIGNAL(tryDelete()),this,SLOT(start_del()));

    connect(right_panel,SIGNAL(tryOpen(QModelIndex)),this,SLOT(open(QModelIndex)));
    connect(right_panel,SIGNAL(tryJump(QString)),this,SLOT(jumpTo(QString)));
    connect(right_panel,SIGNAL(panelActivated(FilePanel*)),this,SLOT(setCurrentPanel(FilePanel*)));
    connect(right_panel,SIGNAL(tryDelete()),this,SLOT(start_del()));

    initDrives();

    connect(right_panel,SIGNAL(tryMount(QString)),this,SLOT(mountDrive(QString)));
    connect(left_panel,SIGNAL(tryMount(QString)),this,SLOT(mountDrive(QString)));

    left_panel->setModel(new fileModel);
    right_panel->setModel(new fileModel);
    setup_contextMenu();
    left_panel->setPopupMenu(menu);
    right_panel->setPopupMenu(menu);

    setup_toolbar();
    setup_favoritiesPath();

    left_panel->loadSettings("Left");
    right_panel->loadSettings("Right");

    connect(left_panel,SIGNAL(tryDrop(QList<QUrl>,QString,Qt::DropAction)),this,SLOT(drop(QList<QUrl>,QString,Qt::DropAction)));
    connect(right_panel,SIGNAL(tryDrop(QList<QUrl>,QString,Qt::DropAction)),this,SLOT(drop(QList<QUrl>,QString,Qt::DropAction)));

    connect(left_panel,SIGNAL(moveChecked(bool)),right_panel,SLOT(checkMove(bool)));
    connect(right_panel,SIGNAL(moveChecked(bool)),left_panel,SLOT(checkMove(bool)));

    QFileSystemWatcher *watcher=new QFileSystemWatcher;
    watcher->addPath("/dev/disk/by-uuid");
    connect(watcher,SIGNAL(directoryChanged(QString)),this,SLOT(drivesChanged(QString)));

}
Ejemplo n.º 2
0
void
show_bookmark_editor (GtkMenuItem *item, gpointer data)
{
    GError *err = NULL;

    if (editor == NULL) {
        editor = g_malloc0 (sizeof(BookmarkEditor));
        gtk_builder_get_all_widgets_simple (BOOKMARK_EDITOR_UI, 
                                "BMWindow", &editor->window,
                                "treeview", &editor->treeview, 
                                "toolbar", &editor->toolbar,
                                "add_button", &editor->add_button,
                                "delete_button", &editor->delete_button,
                                "name_entry", &editor->name_entry,
                                "host_entry", &editor->host_entry,
                                "protocol_combo", &editor->protocol_combo,
                                "user_entry", &editor->user_entry,
                                "passwd_entry", &editor->passwd_entry,
                                "port_entry", &editor->port_entry,
                                "save_button", &editor->save_button,
                                "connect_button", &editor->connect_button,
                                NULL);
        
        g_signal_connect (editor->window, "delete-event", 
                          G_CALLBACK(delete_event_cb), NULL);
        gtk_window_set_transient_for (editor->window, 
                                      GTK_WINDOW(gftp_interface->window));

        setup_treeview();
        setup_toolbar();
        setup_protocol_combo();
        setup_edit_area ();

        set_sensitivity ();
    }
    
    gtk_widget_show_all (GTK_WIDGET (editor->window));
}