LMN / LMN-File-Manager / lib / App / LMN / Window.pm

package App::LMN::Window;

use strict;
use warnings;
use autodie;

use utf8;

use File::Spec;
use File::stat;

use QtCore4;
use QtGui4;

use QtCore4::isa qw( Qt::MainWindow );
use QtCore4::slots windowExit => [];

use App::LMN::FileBrowserWidget;

our $VERSION = '0.0.1';

sub windowExit() {
    exit(0);
}

sub NEW {
    my ( $class, $parent ) = @_;
    $class->SUPER::NEW( $parent );

    my $layout = Qt::GridLayout();
    my $tab_widget = Qt::TabWidget();

    foreach my $dir_pathname (@ARGV)
    {
        $tab_widget->addTab(
            App::LMN::FileBrowserWidget(
                this,
                {
                    dir_pathname => $dir_pathname,
                }
            ),
            $dir_pathname,
        );
    }

    my $num_columns = 1;

    $layout->addWidget($tab_widget, 0, 0, 1, $num_columns);

    my $widget = Qt::Widget();
    $widget->setLayout($layout);
    this->setCentralWidget($widget);

    this->setWindowTitle(this->tr(q{Shlomif's Ad-Hoc File Manager}));

    my $fileMenu = this->menuBar()->addMenu(this->tr("&File"));
    my $exitAction = Qt::Action(this->tr("E&xit"), this);

    this->connect($exitAction, SIGNAL 'triggered()',
        this, SLOT 'windowExit()');

    $fileMenu->addAction($exitAction);

    return;
}

1;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.