+++ /dev/null
-package Buttons2;
-
-use strict;
-use warnings;
-
-use QtCore4 ;
-use QtGui4;
-
-use Data::Dumper;
-use QtCore4::debug qw(ambiguous);
-
-
-#use Qt::isa qw(Qt::Widget);
-#use QtCore4::isa qw(Qt::Widget);
-#use QtCore4;
-
-use QtCore4::isa qw( Qt::Widget );
-
-use QtCore4::slots
- hide_expert_checked => ['int'];
-
-
-sub groupBox_3 {
- return shift->{groupBox_3};
-}
-
-sub hide_expert_checked {
- my ( $state) = @_;
-
- if($state == Qt::Unchecked()) {
- this->{self}->{groupBox_4}->hide();
- }
- else {
- this->{self}->{groupBox_4}->show();
- }
-}
-
-
-use Data::Dumper;
-
-
-
-# # make slots
-my $str;
-$str = "use QtCore4::slots\n slotQuitPressed => [], ";
-foreach my $i (0..150) {
- $str .= " slot". $i . "Pressed => [], ";
-}
-$str .= "slotdummyPressed => [];";
-
-#print "will eval command: $str\n";
-eval $str;
-#print "error: $@\n";
-
-
-# }
-
-
-
-sub NEW {
- my ( $class, $mainWindow ) = @_;
- $class->SUPER::NEW($mainWindow);
-
- my $self = bless {}, $class;
-
- this->{self} = $self;
-
- $self->{ra_buttons} = [];
-
- #print "self: "; print Dumper $self;
- #print "this: "; print Dumper this;
-
- #my $self = $mainWindow;
- if ( !defined $mainWindow->objectName() ) {
- $mainWindow->setObjectName( "mainWindow" );
- }
- #$mainWindow->resize( 800, 600 );
- #$mainWindow->resize( 400, 300 );
-
- #$self->{hide_expert_checked} = hide_expert_checked;
-
- my $centralwidget = Qt::Widget( $mainWindow );
- $self->{centralwidget} = $centralwidget;
- $centralwidget->setObjectName( "centralwidget" );
-
- my $vl_mw = Qt::VBoxLayout( $centralwidget );
-
-# my $layoutWidget = Qt::Widget( $centralwidget );
-# $self->{layoutWidget} = $layoutWidget;
-# $layoutWidget->setObjectName( "layoutWidget" );
- #$layoutWidget->setGeometry( Qt::Rect(30, 110, 723, 418) );
-# my $horizontalLayout = Qt::HBoxLayout( $centralwidget );
- my $horizontalLayout = Qt::HBoxLayout( );
- $self->{horizontalLayout} = $horizontalLayout;
- $horizontalLayout->setObjectName( "horizontalLayout" );
- $horizontalLayout->setContentsMargins(0, 0, 0, 0 );
-
- #$horizontalLayout->addStretch(1);
-
- my $groupBox_1 = Qt::GroupBox( $centralwidget );
- $self->{groupBox_1} = $groupBox_1;
- $groupBox_1->setObjectName( "groupBox_1" );
- my $vl_gb1 = Qt::VBoxLayout( $groupBox_1 );
- $self->{vl_gb1} = $vl_gb1;
- $vl_gb1->setObjectName( "vl_gb1" );
-
-
-
- $horizontalLayout->addWidget( $groupBox_1 );
-
-
-
-
-# my $groupBox_4 = Qt::GroupBox( $centralwidget );
-# $self->{groupBox_4} = $groupBox_4;
-# $groupBox_4->setObjectName( "groupBox_4" );
-#
-# #$groupBox_3->setCheckable(1);
-# #$groupBox_3->setChecked(0);
-# $groupBox_4->hide();
-#
-#
-# my $vl_gb4 = Qt::VBoxLayout( $groupBox_4 );
-# $self->{vl_gb4} = $vl_gb4;
-# $vl_gb4->setObjectName( "vl_gb4" );
-#
-# $horizontalLayout->addWidget( $groupBox_4 );
-#
-#
-#
- my $vl_top = Qt::VBoxLayout( );
- $self->{vl_top} = $vl_top;
- $vl_top->setObjectName( "vl_top" );
- $vl_top->setContentsMargins(0, 0, 0, 0 );
-
- $vl_mw->addLayout($vl_top);
- $vl_mw->addLayout($horizontalLayout);
-#
-#
-# # my $pushButton = Qt::PushButton( $centralwidget );
-# # $self->{pushButton} = $pushButton;
-# # $pushButton->setObjectName( "pushButton" );
-#
-# # my $sizePolicy = Qt::SizePolicy( Qt::SizePolicy::Minimum(), Qt::SizePolicy::Fixed() );
-# # $self->{$sizePolicy} = $sizePolicy;
-# # $sizePolicy->setHorizontalStretch( 0 );
-# # $sizePolicy->setVerticalStretch( 0 );
-# # $sizePolicy->setHeightForWidth( $pushButton->sizePolicy()->hasHeightForWidth() );
-# # $pushButton->setSizePolicy( $sizePolicy );
-# # $pushButton->setMinimumSize( Qt::Size(0, 0) );
-# # my $icon = Qt::Icon;
-# # $icon->addPixmap(Qt::Pixmap("/usr/share/icons/oxygen/64x64/apps/preferences-desktop-icons.png"), Qt::Icon::Normal(), Qt::Icon::Off() );
-# # $icon->addPixmap(Qt::Pixmap("close_window.png"), Qt::Icon::Normal(), Qt::Icon::Off() );
-# #$icon->addPixmap(Qt::Pixmap("/usr/share/icons/oxygen/64x64/apps/preferences-system-login.png"), Qt::Icon::Normal(), Qt::Icon::On() );
-# # $pushButton->setIcon( $icon );
-# # $pushButton->setIconSize( Qt::Size(50, 50) );
-#
-# # $vl_top->addWidget( $pushButton );
-#
-# my $checkBox = Qt::CheckBox( $centralwidget );
-# $self->{checkBox} = $checkBox;
-# $checkBox->setObjectName( "checkBox" );
-#
-# $vl_top->addWidget( $checkBox );
-
- $mainWindow->setCentralWidget( $centralwidget );
- my $menubar = Qt::MenuBar( $mainWindow );
- $self->{menubar} = $menubar;
- $menubar->setObjectName( "menubar" );
- #$menubar->setGeometry( Qt::Rect(0, 0, 800, 25) );
- $mainWindow->setMenuBar( $menubar );
- my $statusbar = Qt::StatusBar( $mainWindow );
- $self->{statusbar} = $statusbar;
- $statusbar->setObjectName( "statusbar" );
- $mainWindow->setStatusBar( $statusbar );
-
- $self->retranslateUi( $mainWindow );
-
-
- my $cur_button_number = 0;
-
- my $dir;
- my $buttons = [];
-
-
- make_buttons($self, "QA", \$cur_button_number, $groupBox_1, $vl_gb1);
- #print "cur_button: $cur_button_number\n";
-
- #$layoutWidget->updateGeometry();
-
-
-# Qt::Object::connect($pushButton, SIGNAL 'clicked()' , $mainWindow, SLOT 'close()' );
-
-
-# Qt::Object::connect($checkBox, SIGNAL 'stateChanged(int)' ,
-# this, SLOT 'hide_expert_checked(int)' );
-
- Qt::MetaObject::connectSlotsByName( $mainWindow );
-
- return $self;
-
-}
-
-
-sub retranslateUi {
- my ( $self, $mainWindow ) = @_;
- $mainWindow->setWindowTitle( Qt::Application::translate( 'MainWindow', "Online QA", undef, Qt::Application::UnicodeUTF8() ) );
- $self->{groupBox_1}->setTitle( Qt::Application::translate( 'MainWindow', "QA", undef, Qt::Application::UnicodeUTF8() ) );
-
-
-} # retranslateUi
-
-
-
-
-sub make_buttons {
- (my $self, my $dir, my $r_current_button_number, my $bgrp, my $layout) = @_;
-
- #print $bgrp;
- #print "current number_; $r_current_button_number\n";
-
- my $c = qq"find $dir -maxdepth 1 -type f| sort";
- my @f = qx($c);
-
- my $i = $$r_current_button_number;
-
- my $button_list=[];
-
- foreach (@f) {
- next if /.png$/i;
- chomp;
- s/.*\///;
- next if /\~$/;
- push @$button_list, $_;
- my $br = $self->{ra_buttons};
- push @{$br}, $_;
- }
-
-
-
-
- foreach my $cur_button_name (@$button_list) {
-
-
- next if ($cur_button_name =~ /.png$/);
-# my $icon->addPixmap(Qt::Pixmap("/usr/share/icons/oxygen/64x64/apps/preferences-desktop-icons.png"), Qt::Icon::Normal(), Qt::Icon::Off() );
- my $icon_path = "$dir/$cur_button_name" . ".png";
-# print "path: $icon_path_file \n";
-# my $fh_icon;
-# my $res = open($fh_icon, "<", $icon_path_file);
-# my @file = <$fh_icon>;
-# $fh_icon->close();
-
- #/usr/share/icons/hicolor/48x48/apps/
-# my ($icon_name) = grep /Icon=/, @file;
-# $icon_name =~ s/Icon=//;
-# my $icon_path = "/usr/share/icons/hicolor/48x48/apps/$icon_name";
-# print "got icon path: $icon_path \n";
-
-
- my $name = $cur_button_name;
- $name =~ s/^\d+_//;
- $name =~ s/_/ /g;
-
-
- my $com = qq|
-my \$pb$i = Qt::PushButton("$cur_button_name", \$bgrp);
-\$self->{pb$i} = \$pb$i;
-\$layout->addWidget( \$pb$i );
-\$pb$i->setText ( Qt::Application::translate( 'MainWindow', "$name", undef,
- Qt::Application::UnicodeUTF8() ) );
-
-my \$icon$i = Qt::Icon;
-\$icon$i->addPixmap(Qt::Pixmap(\"$icon_path\"), Qt::Icon::Normal(), Qt::Icon::Off() );
-
-\$pb$i->setIcon( \$icon$i );
-\$pb$i->setIconSize( Qt::Size(50, 50) );
-
-|;
-
-
-# my $pb_$i = Qt::PushButton("$_", \$bgrp);
-# $self->{pb$i} = $pb_$i;
-# $layout->addWidget( $pb_$i );
-# $pushButton->setIcon( $icon );
-# $pushButton->setIconSize( Qt::Size(50, 50) );
-# $pb$i->setText ( Qt::Application::translate( 'MainWindow', "$name", undef, Qt::Application::UnicodeUTF8() ) );
-
-
-#/usr/share/icons/hicolor/48x48/apps/yast-bootloader.png
-
- # print "command1: $com\n";
-
- #print "command: $com\n";
- eval $com;
- print "$@\n" if ($@);
-
-
-#my $iconstr = "$icon" . "$i";
-
-$com = qq |
-|;
-
-
-
- #Qt::Object::connect($pushButton, SIGNAL 'clicked()' , $mainWindow, SLOT 'close()' );
- $com = qq|Qt::Object::connect(\$self->{pb$i}, SIGNAL 'clicked()', this, SLOT 'slot| . $i . qq|Pressed()');|;
- #print "command2: $com\n";
- eval $com;
- print "error: " , $@ , "\n" if ($@);
-
- make_subroutine($i, $dir);
-
- $i++;
- #last if $i >=10;
- }
-
- $$r_current_button_number = $i;
-}
-
-
-sub make_subroutine {
- (my $i, my $dir) = @_;
- # make subroutines
- #sub slot0Pressed { my $c = buttons->[0]; $c = "cd ../control; ./$c"; print "will execute: $c\n"; qx($c); }
-
- my $str = qq|sub slot| . $i . qq|Pressed { my \$s = this->{self}->{ra_buttons}->[$i]; my \$str="\$dir/\$s"; my \$c = "cd \$dir; control_gui_logger.sh QA \$str; ./\$s &"; print "will execute: \$c\n"; system(\$c); }|;
-# my $str = qq|sub slot| . $i . qq|Pressed { print "$i pressed\n"; }|;
-#system(\$c); }|;
- #print "sub: $str\n";
- eval $str;
-}
-
-
-# sub slotQuitPressed {
-# exit;
-# }
-
-#sub slot0Pressed { my $c = buttons->[0]; $c = "cd ../control; ./$c"; print "will execute: $c\n"; qx($c); }
-
-
-1;