void Window3D::setFixedSize(QSize size)
{
    setMinimumSize(size);
    setMaximumSize(size);
}
Example #2
0
DockWnd::DockWnd(QWidget *main)
        : QWidget(NULL, "dock",  WType_TopLevel | WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop)
{
    setMouseTracking(true);
    connect(this, SIGNAL(toggleWin()), main, SLOT(toggleShow()));
    connect(this, SIGNAL(showPopup(QPoint)), main, SLOT(showDockPopup(QPoint)));
    connect(this, SIGNAL(doubleClicked()), main, SLOT(dockDblClicked()));
    connect(pClient, SIGNAL(event(ICQEvent*)), this, SLOT(processEvent(ICQEvent*)));
    connect(pMain, SIGNAL(iconChanged()), this, SLOT(reset()));
    connect(pMain, SIGNAL(msgChanged()), this, SLOT(reset()));
    m_state = 0;
    showIcon = State;
    QTimer *t = new QTimer(this);
    connect(t, SIGNAL(timeout()), this, SLOT(timer()));
    t->start(800);
    bNoToggle = false;
#ifdef WIN32
    QWidget::hide();
    QWidget::setIcon(Pict(pClient->getStatusIcon()));
    gDock = this;
    oldDockProc = (WNDPROC)SetWindowLongW(winId(), GWL_WNDPROC, (LONG)DockWindowProc);
    if (oldDockProc == 0)
        oldDockProc = (WNDPROC)SetWindowLongA(winId(), GWL_WNDPROC, (LONG)DockWindowProc);
    NOTIFYICONDATAA notifyIconData;
    notifyIconData.cbSize = sizeof(notifyIconData);
    notifyIconData.hIcon = topData()->winIcon;
    notifyIconData.hWnd = winId();
    notifyIconData.szTip[0] = 0;
    notifyIconData.uCallbackMessage = WM_DOCK;
    notifyIconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
    notifyIconData.uID = 0;
    Shell_NotifyIconA(NIM_ADD, &notifyIconData);
#else
    setMinimumSize(22, 22);
    resize(22, 22);
    bInit = false;
    inTray = false;
    inNetTray = false;

    Display *dsp = x11Display();
    WId win = winId();

    if (bEnlightenment){
        wharfIcon = NULL;
        bInit = true;
        resize(48, 48);
        setFocusPolicy(NoFocus);
        move(pMain->getDockX(), pMain->getDockY());
        reset();
        MWMHints mwm;
        mwm.flags = MWM_HINTS_DECORATIONS;
        mwm.functions = 0;
        mwm.decorations = 0;
        mwm.inputMode = 0;
        mwm.status = 0;
        Atom a = XInternAtom(dsp, "_MOTIF_WM_HINTS", False);
        XChangeProperty(dsp, win, a, a, 32, PropModeReplace,
                        (unsigned char *)&mwm, sizeof(MWMHints) / 4);
        XStoreName(dsp, win, "SIM");
        XClassHint *xch = XAllocClassHint();
        xch->res_name  = (char*)"SIM";
        xch->res_class = (char*)"Epplet";
        XSetClassHint(dsp, win, xch);
        XFree(xch);
        XSetIconName(dsp, win, "SIM");
        unsigned long val = (1 << 0) /* | (1 << 9) */ ;
        a = XInternAtom(dsp, "_WIN_STATE", False);
        XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace,
                        (unsigned char *)&val, 1);
        val = 2;
        a = XInternAtom(dsp, "_WIN_LAYER", False);
        XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace,
                        (unsigned char *)&val, 1);
        val = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 5);
        a = XInternAtom(dsp, "_WIN_HINTS", False);
        XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace,
                        (unsigned char *)&val, 1);
        win_name = "SIM";
        win_version = VERSION;
        win_info = "";
        while (!comms_win)
        {
            ECommsSetup(dsp);
            sleep(1);
        }
        char s[256];
        snprintf(s, sizeof(s), "set clientname %s", win_name);
        ECommsSend(s);
        snprintf(s, sizeof(s), "set version %s", win_version);
        ECommsSend(s);
        snprintf(s, sizeof(s), "set info %s", win_info);
        ECommsSend(s);
        ESYNC;

        set_background_properties(this);

        show();
        return;
    }

    wharfIcon = new WharfIcon(this);

    setBackgroundMode(X11ParentRelative);
    const QPixmap &pict = Pict(pClient->getStatusIcon());
    setIcon(pict);

    XClassHint classhint;
    classhint.res_name  = (char*)"sim";
    classhint.res_class = (char*)"Wharf";
    XSetClassHint(dsp, win, &classhint);

    Screen *screen = XDefaultScreenOfDisplay(dsp);
    int screen_id = XScreenNumberOfScreen(screen);
    char buf[32];
    snprintf(buf, sizeof(buf), "_NET_SYSTEM_TRAY_S%d", screen_id);
    Atom selection_atom = XInternAtom(dsp, buf, false);
    XGrabServer(dsp);
    Window manager_window = XGetSelectionOwner(dsp, selection_atom);
    if (manager_window != None)
        XSelectInput(dsp, manager_window, StructureNotifyMask);
    XUngrabServer(dsp);
    XFlush(dsp);
    if (manager_window != None){
        inNetTray = true;
        if (!send_message(dsp, manager_window, SYSTEM_TRAY_REQUEST_DOCK, win, 0, 0)){
            inNetTray = false;
        }
    }

    Atom kde_net_system_tray_window_for_atom = XInternAtom(dsp, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", false);

    long data[1];
    data[0] = 0;
    XChangeProperty(dsp, win, kde_net_system_tray_window_for_atom, XA_WINDOW,
                    32, PropModeReplace,
                    (unsigned char*)data, 1);

    XWMHints *hints;
    hints = XGetWMHints(dsp, win);
    hints->initial_state = WithdrawnState;
    hints->icon_x = 0;
    hints->icon_y = 0;
    hints->icon_window = wharfIcon->winId();
    hints->window_group = win;
    hints->flags = WindowGroupHint | IconWindowHint | IconPositionHint | StateHint;
    XSetWMHints(dsp, win, hints);
    XFree( hints );
    XSetCommand(dsp, win, _argv, _argc);

    if (!inNetTray){
        move(-21, -21);
        resize(22, 22);
    }
    show();
#endif
    reset();
}
MainWindow::MainWindow(QWidget *parent)
	: QMainWindow(parent)
{
	QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
	setMinimumSize(450, 480);
	
	newGameMenu = menuBar()->addMenu("New game");
	optionsMenu = menuBar()->addMenu("Options");
	helpMenu = menuBar()->addMenu("Help");

	easyGame = new QAction("Easy", this);
	newGameMenu->addAction(easyGame);
	connect(easyGame, SIGNAL(triggered()), this, SLOT(generateEasy()));
	easyGame->setShortcut(Qt::CTRL + Qt::Key_1);
	
	mediumGame = new QAction("Medium", this);
	newGameMenu->addAction(mediumGame);
	connect(mediumGame, SIGNAL(triggered()), this, SLOT(generateMedium()));
	mediumGame->setShortcut(Qt::CTRL + Qt::Key_2);
	
	hardGame = new QAction("Hard", this);
	newGameMenu->addAction(hardGame);
	connect(hardGame, SIGNAL(triggered()), this, SLOT(generateHard()));
	hardGame->setShortcut(Qt::CTRL + Qt::Key_3);
	
	/*randomGame = new QAction("Random", this);
	newGameMenu->addAction(randomGame);
	connect(randomGame, SIGNAL(triggered()), this, SLOT(generateRandom()));
	randomGame->setShortcut(Qt::CTRL + Qt::Key_4);*/

	solve = new QAction("Solve", this);
	optionsMenu->addAction(solve);
	connect(solve, SIGNAL(triggered()), this, SLOT(showSolution()));
	solve->setShortcut(Qt::CTRL + Qt::Key_F);
	
	stopSolving = new QAction("Stop solving", this);
	optionsMenu->addAction(stopSolving);
	connect(stopSolving, SIGNAL(triggered()), this, SLOT(solvingStopped()));
	stopSolving->setShortcut(Qt::CTRL + Qt::Key_R);
	
	previousMove = new QAction("Move back", this);
	optionsMenu->addAction(previousMove);
	connect(previousMove, SIGNAL(triggered()), this, SLOT(moveBack()));
	previousMove->setShortcut(Qt::CTRL + Qt::Key_Z);
	
	nextMove = new QAction("Move forward", this);
	optionsMenu->addAction(nextMove);
	connect(nextMove, SIGNAL(triggered()), this, SLOT(moveForward()));
	nextMove->setShortcut(Qt::CTRL + Qt::Key_Y);
	
	getInfo = new QAction("Instructions", this);
	helpMenu->addAction(getInfo);
	connect(getInfo, SIGNAL(triggered()), this, SLOT(showInstructions()));
	getInfo->setShortcut(Qt::Key_F1);

	gview = new Graphics();
	setCentralWidget(gview);

	scene = new QGraphicsScene();
	scene->setBackgroundBrush(QColor("#e0e0e0"));

	gview->setScene(scene);
	gview->setEnabled(true);

	counter = new QLabel();
	
	for (int i = 1; i <= 15; i++)
		tiles[i] = NULL;
	
	srand(time(NULL));
	gameBoard = NULL;
	
	generateEasy();

	statusBar()->addWidget(counter);

	timer = new QTimer(this);
	timer->setInterval(400);
	connect(timer, SIGNAL(timeout()), this, SLOT(moveForward()));
}
    CreateUserDialog::CreateUserDialog(const QStringList &databases, const QString &serverName,
                                       const QString &database, const MongoUser &user,
                                       QWidget *parent) : QDialog(parent),
        _user(user)
    {
        setWindowTitle("Add User");
        setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); // Remove help button (?)
        setMinimumSize(minimumSize);

        Indicator *serverIndicator = new Indicator(GuiRegistry::instance().serverIcon(), serverName);
        Indicator *databaseIndicator = new Indicator(GuiRegistry::instance().databaseIcon(), database);

        QFrame *hline = new QFrame();
        hline->setFrameShape(QFrame::HLine);
        hline->setFrameShadow(QFrame::Sunken);

        _userNameLabel = new QLabel("Name:");
        _userNameEdit = new QLineEdit();
        _userNameEdit->setText(QtUtils::toQString(user.name()));
        _userPassLabel = new QLabel("Password:"******"UserSource:");
        _userSourceComboBox = new QComboBox();
        _userSourceComboBox->addItems(QStringList() << "" << databases); //setText(QtUtils::toQString(user.userSource()));
        utils::setCurrentText(_userSourceComboBox, QtUtils::toQString(user.userSource()));

        QGridLayout *gridRoles = new QGridLayout();
        MongoUser::RoleType userRoles = user.role();
        for (unsigned i = 0; i<RolesCount; ++i)
        {
            int row = i%3;
            int col = i/3;
            _rolesArray[i] = new QCheckBox(rolesText[i], this);
            MongoUser::RoleType::const_iterator it = std::find(userRoles.begin(), userRoles.end(), rolesText[i]);
            _rolesArray[i]->setChecked(it!= userRoles.end());
            gridRoles->addWidget(_rolesArray[i], row, col);
        }

        QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
        buttonBox->setOrientation(Qt::Horizontal);
        buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Save);
        VERIFY(connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())));
        VERIFY(connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())));

        QHBoxLayout *hlayout = new QHBoxLayout();
        hlayout->addStretch(1);
        hlayout->addWidget(buttonBox);

        QHBoxLayout *vlayout = new QHBoxLayout();
        vlayout->addWidget(serverIndicator, 0, Qt::AlignLeft);
        vlayout->addWidget(databaseIndicator, 0, Qt::AlignLeft);
        vlayout->addStretch(1);

        QGridLayout *namelayout = new QGridLayout();
        namelayout->setContentsMargins(0, 7, 0, 7);
        namelayout->addWidget(_userNameLabel, 0, 0);
        namelayout->addWidget(_userNameEdit,  0, 1);
        namelayout->addWidget(_userPassLabel, 1, 0);
        namelayout->addWidget(_userPassEdit,  1, 1);
        namelayout->addWidget(_userSourceLabel, 2, 0);
        namelayout->addWidget(_userSourceComboBox,  2, 1);
        namelayout->addLayout(gridRoles,  3, 1);

        QVBoxLayout *layout = new QVBoxLayout();
        layout->addLayout(vlayout);
        layout->addWidget(hline);
        layout->addLayout(namelayout);
        layout->addLayout(hlayout);
        setLayout(layout);

        _userNameEdit->setFocus();
    }
CollectionDialog::CollectionDialog(SLManager *slm,int selC,QWidget *parent,const char *name) : QDialog(parent,name,TRUE)
{
setCaption(i18n("Collections Manager"));
ok=new KPushButton(KStdGuiItem::ok(),this);
ok->setGeometry(140,200,100,30);
connect(ok,SIGNAL(clicked()),SLOT(accept()) );
cancel=new KPushButton(KStdGuiItem::cancel(),this);
cancel->setGeometry(250,200,100,30);
connect(cancel,SIGNAL(clicked()),SLOT(reject()) );

label=new QLabel(i18n("Available collections:"),this);
label->adjustSize();
label->move(10,10);
collections=new QListBox(this,"collectionlist");
collections->setGeometry(10,20+label->height(),340,90);
connect(collections,SIGNAL(highlighted(int)),SLOT(collectionselected(int)));
connect(collections,SIGNAL(selected(int)),SLOT(changeCollectionName(int)));
slman=slm;
for (int i=0;i<=slman->numberOfCollections();i++)
    {
    collections->insertItem(i18n( slman->getCollectionName(i) ),i);
#ifdef COLLECTDLGDEBUG
    printf("Name : %s\n",slman->getCollectionName(i));
#endif
    };
selectedC=selC;
#ifdef COLLECTDLGDEBUG
printf("selectedC : %d\n",selectedC);
#endif

label2=new QLabel(i18n("Songs in selected collection:"),this);
label2->adjustSize();
label2->move(10,collections->y()+collections->height()+10);

songs=new QListBox(this,"songlist");
songs->setGeometry(10,label2->y()+label2->height()+10,340,120);
connect(songs,SIGNAL(highlighted(int)),SLOT(songselected(int)));
currentsl=slman->getCollection(selectedC);
if (slman->numberOfCollections()>0)
    {
    collections->setCurrentItem(selectedC);
    collections->centerCurrentItem();
    };
//fillInSongList();
newC=new QPushButton(i18n("&New..."),this);
newC->adjustSize();
newC->move(360,collections->y()+5);
connect(newC,SIGNAL(clicked()),SLOT(newCollection()) );
copyC=new QPushButton(i18n("&Copy..."),this);
copyC->adjustSize();
copyC->move(360,newC->y()+newC->height()+5);
connect(copyC,SIGNAL(clicked()),SLOT(copyCollection()) );
deleteC=new QPushButton(i18n("Delete"),this);
deleteC->adjustSize();
deleteC->move(360,copyC->y()+copyC->height()+5);
connect(deleteC,SIGNAL(clicked()),SLOT(deleteCollection()) );

addS=new QPushButton(i18n("&Add..."),this);
addS->adjustSize();
addS->move(360,songs->y()+5);
connect(addS,SIGNAL(clicked()),SLOT(addSong()) );
delS=new QPushButton(i18n("&Remove"),this);
delS->adjustSize();
delS->move(360,addS->y()+addS->height()+5);
connect(delS,SIGNAL(clicked()),SLOT(removeSong()) );

ok->move(ok->x(),songs->y()+songs->height()+10);
cancel->move(ok->x()+ok->width()+5,ok->y());

setMinimumSize(400,ok->y()+ok->height()+5);
//setMaximumSize(360,240);
}
Example #6
0
QgsLocatorWidget::QgsLocatorWidget( QWidget *parent )
  : QWidget( parent )
  , mLocator( new QgsLocator( this ) )
  , mLineEdit( new QgsFilterLineEdit() )
  , mLocatorModel( new QgsLocatorModel( this ) )
  , mResultsView( new QgsLocatorResultsView() )
{
  mLineEdit->setShowClearButton( true );
#ifdef Q_OS_MACX
  mLineEdit->setPlaceholderText( tr( "Type to locate (⌘K)" ) );
#else
  mLineEdit->setPlaceholderText( tr( "Type to locate (Ctrl+K)" ) );
#endif

  int placeholderMinWidth = mLineEdit->fontMetrics().width( mLineEdit->placeholderText() );
  int minWidth = std::max( 200, ( int )( placeholderMinWidth * 1.6 ) );
  resize( minWidth, 30 );
  QSizePolicy sizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
  sizePolicy.setHorizontalStretch( 0 );
  sizePolicy.setVerticalStretch( 0 );
  setSizePolicy( sizePolicy );
  setMinimumSize( QSize( minWidth, 0 ) );

  QHBoxLayout *layout = new QHBoxLayout();
  layout->setMargin( 0 );
  layout->setContentsMargins( 0, 0, 0, 0 );
  layout->addWidget( mLineEdit );
  setLayout( layout );

  setFocusProxy( mLineEdit );

  // setup floating container widget
  mResultsContainer = new QgsFloatingWidget( parent ? parent->window() : nullptr );
  mResultsContainer->setAnchorWidget( mLineEdit );
  mResultsContainer->setAnchorPoint( QgsFloatingWidget::BottomLeft );
  mResultsContainer->setAnchorWidgetPoint( QgsFloatingWidget::TopLeft );

  QHBoxLayout *containerLayout = new QHBoxLayout();
  containerLayout->setMargin( 0 );
  containerLayout->setContentsMargins( 0, 0, 0, 0 );
  containerLayout->addWidget( mResultsView );
  mResultsContainer->setLayout( containerLayout );
  mResultsContainer->hide();

  mProxyModel = new QgsLocatorProxyModel( mLocatorModel );
  mProxyModel->setSourceModel( mLocatorModel );
  mResultsView->setModel( mProxyModel );
  mResultsView->setUniformRowHeights( true );
  mResultsView->setIconSize( QSize( 16, 16 ) );
  mResultsView->recalculateSize();

  connect( mLocator, &QgsLocator::foundResult, this, &QgsLocatorWidget::addResult );
  connect( mLocator, &QgsLocator::finished, this, &QgsLocatorWidget::searchFinished );
  connect( mLineEdit, &QLineEdit::textChanged, this, &QgsLocatorWidget::scheduleDelayedPopup );
  connect( mResultsView, &QAbstractItemView::activated, this, &QgsLocatorWidget::acceptCurrentEntry );

  // have a tiny delay between typing text in line edit and showing the window
  mPopupTimer.setInterval( 100 );
  mPopupTimer.setSingleShot( true );
  connect( &mPopupTimer, &QTimer::timeout, this, &QgsLocatorWidget::performSearch );
  mFocusTimer.setInterval( 110 );
  mFocusTimer.setSingleShot( true );
  connect( &mFocusTimer, &QTimer::timeout, this, &QgsLocatorWidget::triggerSearchAndShowList );

  mLineEdit->installEventFilter( this );
  mResultsContainer->installEventFilter( this );
  mResultsView->installEventFilter( this );
  installEventFilter( this );
  window()->installEventFilter( this );

  mLocator->registerFilter( new QgsLocatorFilterFilter( this, this ) );

  mMenu = new QMenu( this );
  QAction *menuAction = mLineEdit->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/search.svg" ) ), QLineEdit::LeadingPosition );
  connect( menuAction, &QAction::triggered, this, [ = ]
  {
    mFocusTimer.stop();
    mResultsContainer->hide();
    mMenu->exec( QCursor::pos() );
  } );
  connect( mMenu, &QMenu::aboutToShow, this, &QgsLocatorWidget::configMenuAboutToShow );

}
Example #7
0
 void setFixedSize(QSize size)
 {
     setMinimumSize(size);
     setMaximumSize(size);
 }
Example #8
0
NavyPainter::NavyPainter(QWidget *parent, AutoLocation * location, int bgm) :
    QGLWidget(parent), Navy(location)
{
    setAutoFillBackground(false);

    if(bgm >= 3 || bgm < 0)
        bgm = 0;

    bgcode = bgm;

    t=0;

    backgrounds.push_back(QImage(":/Skin1.png"));
    backgrounds.push_back(QImage(":/Skin2.png"));
    backgrounds.push_back(QImage(":/Island3min.png"));

    bg= backgrounds[bgcode];

    tt.load(":/reflection.jpg");
    rr.load(":/boom.png");
    mbg.load(":/images/background.png");

    resize(m_w,m_h);
    setMinimumSize(m_w,m_h);
    setMaximumSize(m_w,m_h);

    splash.load(":/images/splash.png");
    boom.load(":/images/boom.png");
    death.load(":/images/death.png");

    timer = new QTimer(this);
    timer->setInterval(25);

    timer_fire = new QTimer(this);
    //timer_fire->setInterval(100);

    connect(timer, SIGNAL(timeout()), this, SLOT(animate()));
    //connect(timer_fire, SIGNAL(timeout()), this, SLOT(fire()));

    qsrand(::time(NULL));
    timer->start();

    show_shell = false;

    setMouseTracking(true);

    enemy = new Navy();
    cur_sursor = false;

    InitNoise();

    wire_frame = normals = xold = yold = 0;

    rotate_y = 35;
    rotate_x = 10;

    translate_z=2.5;

    time = 0;

    int flags = QGLFormat::openGLVersionFlags();
    useOpenGl = (flags & QGLFormat::OpenGL_Version_2_0);

    if(!useOpenGl)
        timer->stop();
}
void
MyPluginGUI::createGUI(DefaultGUIModel::variable_t *var, int size)
{

  setMinimumSize(200, 300); // Qt API for setting window size

  //overall GUI layout with a "horizontal box" copied from DefaultGUIModel

  QBoxLayout *layout = new QHBoxLayout(this);

  //additional GUI layouts with "vertical" layouts that will later
  // be added to the overall "layout" above
  QBoxLayout *leftlayout = new QVBoxLayout();
  //QBoxLayout *rightlayout = new QVBoxLayout();

  // this is a "horizontal button group"
  QHButtonGroup *bttnGroup = new QHButtonGroup("Button Panel:", this);

  // we add two pushbuttons to the button group
  QPushButton *aBttn = new QPushButton("Button A", bttnGroup);
  QPushButton *bBttn = new QPushButton("Button B", bttnGroup);

  // clicked() is a Qt signal that is given to pushbuttons. The connect()
  // function links the clicked() event to a function that is defined
  // as a "private slot:" in the header.
  QObject::connect(aBttn, SIGNAL(clicked()), this, SLOT(aBttn_event()));
  QObject::connect(bBttn, SIGNAL(clicked()), this, SLOT(bBttn_event()));

  //these 3 utility buttons are copied from DefaultGUIModel
  QHBox *utilityBox = new QHBox(this);
  pauseButton = new QPushButton("Pause", utilityBox);
  pauseButton->setToggleButton(true);
  QObject::connect(pauseButton, SIGNAL(toggled(bool)), this, SLOT(pause(bool)));
  QPushButton *modifyButton = new QPushButton("Modify", utilityBox);
  QObject::connect(modifyButton, SIGNAL(clicked(void)), this, SLOT(modify(void)));
  QPushButton *unloadButton = new QPushButton("Unload", utilityBox);
  QObject::connect(unloadButton, SIGNAL(clicked(void)), this, SLOT(exit(void)));

  // add custom button group at the top of the layout
  leftlayout->addWidget(bttnGroup);

  // copied from DefaultGUIModel DO NOT EDIT
  // this generates the text boxes and labels
  QScrollView *sv = new QScrollView(this);
  sv->setResizePolicy(QScrollView::AutoOneFit);
  leftlayout->addWidget(sv);

  QWidget *viewport = new QWidget(sv->viewport());
  sv->addChild(viewport);
  QGridLayout *scrollLayout = new QGridLayout(viewport, 1, 2);

  size_t nstate = 0, nparam = 0, nevent = 0, ncomment = 0;
  for (size_t i = 0; i < num_vars; i++)
    {
      if (vars[i].flags & (PARAMETER | STATE | EVENT | COMMENT))
        {
          param_t param;

          param.label = new QLabel(vars[i].name, viewport);
          scrollLayout->addWidget(param.label, parameter.size(), 0);
          param.edit = new DefaultGUILineEdit(viewport);
          scrollLayout->addWidget(param.edit, parameter.size(), 1);

          QToolTip::add(param.label, vars[i].description);
          QToolTip::add(param.edit, vars[i].description);

          if (vars[i].flags & PARAMETER)
            {
              if (vars[i].flags & DOUBLE)
                {
                  param.edit->setValidator(new QDoubleValidator(param.edit));
                  param.type = PARAMETER | DOUBLE;
                }
              else if (vars[i].flags & UINTEGER)
                {
                  QIntValidator *validator = new QIntValidator(param.edit);
                  param.edit->setValidator(validator);
                  validator->setBottom(0);
                  param.type = PARAMETER | UINTEGER;
                }
              else if (vars[i].flags & INTEGER)
                {
                  param.edit->setValidator(new QIntValidator(param.edit));
                  param.type = PARAMETER | INTEGER;
                }
              else
                param.type = PARAMETER;
              param.index = nparam++;
              param.str_value = new QString;
            }
          else if (vars[i].flags & STATE)
            {
              param.edit->setReadOnly(true);
              param.edit->setPaletteForegroundColor(Qt::darkGray);
              param.type = STATE;
              param.index = nstate++;
            }
          else if (vars[i].flags & EVENT)
            {
              param.edit->setReadOnly(true);
              param.type = EVENT;
              param.index = nevent++;
            }
          else if (vars[i].flags & COMMENT)
            {
              param.type = COMMENT;
              param.index = ncomment++;
            }

          parameter[vars[i].name] = param;
        }
    }

  // end DO NOT EDIT

  // add the 3 utility buttons to the bottom of the layout
  leftlayout->addWidget(utilityBox);

  // layouts can contain other layouts. if you added components to
  // "rightlayout" and added "rightlayout" to "layout," you would
  // have left and right panels in your custom GUI.
  layout->addLayout(leftlayout);
  //layout->addLayout(rightlayout);

  show(); // this line is required to render the GUI
}
Example #10
0
//Le constructeur
Widget::Widget(): QWidget()
{
	//On initialise la fenetre
	this->setWindowTitle("Client B");
	setMinimumSize(640,480);

	//On crèe une table view non éditable
	QTableView *tableView=new QTableView();
	tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);

	//On crèe le model à 2 colonnes de la qtableview
	this->model=new QStandardItemModel(0,2,tableView);

	//On écrit l'entete du model
	QStringList list;
	list<<"Evenement"<<"Heure";
	model->setHorizontalHeaderLabels(list);

	//On affecte le model à sa qtableview, et on configure cette dernière
	tableView->setModel(model);
	tableView->horizontalHeader()->setStretchLastSection(true);
	tableView->setColumnWidth(0,500);

	//On range la qtableview dans la fenetre avec une layout
	QHBoxLayout *layout = new QHBoxLayout;
	layout->addWidget(tableView);
	this->setLayout(layout);
	addRowToTable("Démarage de l'application",model);

	//On créé la configuration réseau
        ConfigurationNetwork *configurationNetwork=ConfigurationNetwork::createConfigurationNetwork("pchky",4321);
	if(configurationNetwork) addRowToTable("La configuration réseau a été crée",model);
	else {addRowToTable("Echec de la création de la configuration réseau",model);return;}

	//On créé la configuration d'identification
	ConfigurationIdentification *configurationIdentification=ConfigurationIdentification::createConfigurationIdentification("hky","hky");
	if(configurationIdentification) addRowToTable("La configuration d'identification' a été crée",model);
	else {addRowToTable("Echec de la création de la configuration d'indentification",model);return;}

	//On créé la configuration de fichier
	QList<Dir*> *depots=new QList<Dir*>();
        Dir *d1=Dir::createDir("/home/julien/test/A","/sd/1");depots->append(d1);
        if(!d1){addRowToTable("Echec de la création du repertoire 1",model);return;}
        //Dir *d2=Dir::createDir("/home/hky/test/B","/sd/1");depots->append(d2);
        //if(!d2){addRowToTable("Echec de la création du repertoire 2",model);return;}
	ConfigurationFile *configurationFile=ConfigurationFile::createConfigurationFile(depots);
	if(configurationFile) addRowToTable("Les configurations des repertoires surveillés ont été créés",model);
	else {addRowToTable("Echec de la création des configurations de repertoires surveillés",model);return;}

	//On créé la configuration totale
        this->configurationData=ConfigurationData::createConfigurationData(configurationNetwork,configurationIdentification,configurationFile,"/home/julien/test/config2.xml");

	//On créé l'interface réseau
	this->networkInterface=NetworkInterface::createNetworkInterface(configurationData);
	if(networkInterface) addRowToTable("L'interface réseau a été crée",model);
	else {addRowToTable("Echec de la création de l'interface réseau",model);return;}

	//On créé l'interface disque dur
	this->hddInterface=HddInterface::createHddInterface(configurationData,networkInterface,model);
	if(hddInterface) addRowToTable("L'interface disque a été crée",model);
	else {addRowToTable("Echec de la création de l'interface disque",model);return;}

	//On tente de se connecter au serveur
	addRowToTable("Tentative de connexion au serveur",model);
	bool a=networkInterface->connect();
	if(a) addRowToTable("Success: Connexion réuissie",model);
	else addRowToTable("Echec: Connexion échouée",model);
}
Example #11
0
KateConfigDialog::KateConfigDialog ( KateMainWindow *parent, Kate::View *view )
 : KDialogBase ( KDialogBase::TreeList,
                 i18n("Configure"),
                 KDialogBase::Ok | KDialogBase::Apply|KDialogBase::Cancel | KDialogBase::Help,
                 KDialogBase::Ok,
                 parent,
                 "configdialog" )
{
  TDEConfig *config = KateApp::self()->config();

  KWin::setIcons( winId(), KateApp::self()->icon(), KateApp::self()->miniIcon() );

  actionButton( KDialogBase::Apply)->setEnabled( false );

  mainWindow = parent;

  setMinimumSize(600,400);

  v = view;

  pluginPages.setAutoDelete (false);
  editorPages.setAutoDelete (false);

  TQStringList path;

  setShowIconsInTreeList(true);

  path.clear();
  path << i18n("Application");
  setFolderIcon (path, SmallIcon("kate", TDEIcon::SizeSmall));

  path.clear();

  //BEGIN General page
  path << i18n("Application") << i18n("General");
  TQFrame* frGeneral = addPage(path, i18n("General Options"), BarIcon("go-home", TDEIcon::SizeSmall));

  TQVBoxLayout *lo = new TQVBoxLayout( frGeneral );
  lo->setSpacing(KDialog::spacingHint());
  config->setGroup("General");

  // GROUP with the one below: "Appearance"
  TQButtonGroup *bgStartup = new TQButtonGroup( 1, Qt::Horizontal, i18n("&Appearance"), frGeneral );
  lo->addWidget( bgStartup );

  // show full path in title
  config->setGroup("General");
  cb_fullPath = new TQCheckBox( i18n("&Show full path in title"), bgStartup);
  cb_fullPath->setChecked( mainWindow->viewManager()->getShowFullPath() );
  TQWhatsThis::add(cb_fullPath,i18n("If this option is checked, the full document path will be shown in the window caption."));
  connect( cb_fullPath, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) );

  // sort filelist if desired
   cb_sortFiles = new TQCheckBox(bgStartup);
   cb_sortFiles->setText(i18n("Sort &files alphabetically in the file list"));
   cb_sortFiles->setChecked(parent->filelist->sortType() == KateFileList::sortByName);
   TQWhatsThis::add( cb_sortFiles, i18n(
         "If this is checked, the files in the file list will be sorted alphabetically.") );
   connect( cb_sortFiles, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) );

  // GROUP with the one below: "Behavior"
  bgStartup = new TQButtonGroup( 1, Qt::Horizontal, i18n("&Behavior"), frGeneral );
  lo->addWidget( bgStartup );

  // number of recent files
  TQHBox *hbNrf = new TQHBox( bgStartup );
  TQLabel *lNrf = new TQLabel( i18n("&Number of recent files:"), hbNrf );
  sb_numRecentFiles = new TQSpinBox( 0, 1000, 1, hbNrf );
  sb_numRecentFiles->setValue( mainWindow->fileOpenRecent->maxItems() );
  lNrf->setBuddy( sb_numRecentFiles );
  TQString numRecentFileHelpString ( i18n(
        "<qt>Sets the number of recent files remembered by Kate.<p><strong>NOTE: </strong>"
        "If you set this lower than the current value, the list will be truncated and "
        "some items forgotten.</qt>") );
  TQWhatsThis::add( lNrf, numRecentFileHelpString );
  TQWhatsThis::add( sb_numRecentFiles, numRecentFileHelpString );
  connect( sb_numRecentFiles, TQT_SIGNAL( valueChanged ( int ) ), this, TQT_SLOT( slotChanged() ) );

  // Use only one instance of kate (MDI) ?
  cb_useInstance = new TQCheckBox(bgStartup);
  cb_useInstance->setText(i18n("Always use the current instance of kate to open new files"));
  cb_useInstance->setChecked(parent->useInstance);
  TQWhatsThis::add( cb_useInstance, i18n(
        "When checked, all files opened from outside of Kate will only use the "
        "currently opened instance of Kate.") );
  connect( cb_useInstance, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) );

  // sync the konsole ?
  cb_syncKonsole = new TQCheckBox(bgStartup);
  cb_syncKonsole->setText(i18n("Sync &terminal emulator with active document"));
  cb_syncKonsole->setChecked(parent->syncKonsole);
  TQWhatsThis::add( cb_syncKonsole, i18n(
        "If this is checked, the built in Konsole will <code>cd</code> to the directory "
        "of the active document when started and whenever the active document changes, "
        "if the document is a local file.") );
  connect( cb_syncKonsole, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) );

  // modified files notification
  cb_modNotifications = new TQCheckBox(
      i18n("Wa&rn about files modified by foreign processes"), bgStartup );
  cb_modNotifications->setChecked( parent->modNotification );
  TQWhatsThis::add( cb_modNotifications, i18n(
      "If enabled, when Kate receives focus you will be asked what to do with "
      "files that have been modified on the hard disk. If not enabled, you will "
      "be asked what to do with a file that has been modified on the hard disk only "
      "when that file gains focus inside Kate.") );
  connect( cb_modNotifications, TQT_SIGNAL( toggled( bool ) ),
           this, TQT_SLOT( slotChanged() ) );

  // GROUP with the one below: "Meta-informations"
  bgStartup = new TQButtonGroup( 2, Qt::Horizontal, i18n("Meta-Information"), frGeneral );
  lo->addWidget( bgStartup );

  // save meta infos
  cb_saveMetaInfos = new TQCheckBox( bgStartup );
  cb_saveMetaInfos->setText(i18n("Keep &meta-information past sessions"));
  cb_saveMetaInfos->setChecked(KateDocManager::self()->getSaveMetaInfos());
  TQWhatsThis::add(cb_saveMetaInfos, i18n(
        "Check this if you want document configuration like for example "
        "bookmarks to be saved past editor sessions. The configuration will be "
        "restored if the document has not changed when reopened."));
  connect( cb_saveMetaInfos, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) );

  // meta infos days
  TQHBox *hbDmf = new TQHBox( bgStartup );
  hbDmf->setEnabled(KateDocManager::self()->getSaveMetaInfos());
  TQLabel *lDmf = new TQLabel( i18n("&Delete unused meta-information after:"), hbDmf );
  sb_daysMetaInfos = new TQSpinBox( 0, 180, 1, hbDmf );
  sb_daysMetaInfos->setSpecialValueText(i18n("(never)"));
  sb_daysMetaInfos->setSuffix(i18n(" day(s)"));
  sb_daysMetaInfos->setValue( KateDocManager::self()->getDaysMetaInfos() );
  lDmf->setBuddy( sb_daysMetaInfos );
  connect( cb_saveMetaInfos, TQT_SIGNAL( toggled( bool ) ), hbDmf, TQT_SLOT( setEnabled( bool ) ) );
  connect( sb_daysMetaInfos, TQT_SIGNAL( valueChanged ( int ) ), this, TQT_SLOT( slotChanged() ) );

  lo->addStretch(1); // :-] works correct without autoadd
  //END General page

  path.clear();

  //BEGIN Session page
  path << i18n("Application") << i18n("Sessions");
  TQFrame* frSessions = addPage(path, i18n("Session Management"), BarIcon("history", TDEIcon::SizeSmall));

  lo = new TQVBoxLayout( frSessions );
  lo->setSpacing(KDialog::spacingHint());

  // GROUP with the one below: "Startup"
  bgStartup = new TQButtonGroup( 1, Qt::Horizontal, i18n("Elements of Sessions"), frSessions );
  lo->addWidget( bgStartup );

  // restore view  config
  cb_restoreVC = new TQCheckBox( bgStartup );
  cb_restoreVC->setText(i18n("Include &window configuration"));
  config->setGroup("General");
  cb_restoreVC->setChecked( config->readBoolEntry("Restore Window Configuration", true) );
  TQWhatsThis::add(cb_restoreVC, i18n(
        "Check this if you want all your views and frames restored each time you open Kate"));
  connect( cb_restoreVC, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) );

  TQRadioButton *rb1, *rb2, *rb3;

  sessions_start = new TQButtonGroup( 1, Qt::Horizontal, i18n("Behavior on Application Startup"), frSessions );
  lo->add (sessions_start);

  sessions_start->setRadioButtonExclusive( true );
  sessions_start->insert( rb1=new TQRadioButton( i18n("&Start new session"), sessions_start ), 0 );
  sessions_start->insert( rb2=new TQRadioButton( i18n("&Load last-used session"), sessions_start ), 1 );
  sessions_start->insert( rb3=new TQRadioButton( i18n("&Manually choose a session"), sessions_start ), 2 );

  config->setGroup("General");
  TQString sesStart (config->readEntry ("Startup Session", "manual"));
  if (sesStart == "new")
    sessions_start->setButton (0);
  else if (sesStart == "last")
    sessions_start->setButton (1);
  else
    sessions_start->setButton (2);

  connect(rb1, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotChanged()));
  connect(rb2, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotChanged()));
  connect(rb3, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotChanged()));

  sessions_exit = new TQButtonGroup( 1, Qt::Horizontal, i18n("Behavior on Application Exit or Session Switch"), frSessions );
  lo->add (sessions_exit);

  sessions_exit->setRadioButtonExclusive( true );
  sessions_exit->insert( rb1=new TQRadioButton( i18n("&Do not save session"), sessions_exit ), 0 );
  sessions_exit->insert( rb2=new TQRadioButton( i18n("&Save session"), sessions_exit ), 1 );
  sessions_exit->insert( rb3=new TQRadioButton( i18n("&Ask user"), sessions_exit ), 2 );

  config->setGroup("General");
  TQString sesExit (config->readEntry ("Session Exit", "save"));
  if (sesExit == "discard")
    sessions_exit->setButton (0);
  else if (sesExit == "save")
    sessions_exit->setButton (1);
  else
    sessions_exit->setButton (2);

  connect(rb1, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotChanged()));
  connect(rb2, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotChanged()));
  connect(rb3, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotChanged()));

  lo->addStretch(1); // :-] works correct without autoadd
  //END Session page

  path.clear();

  // file selector page
  path << i18n("Application") << i18n("File Selector");

  TQVBox *page = addVBoxPage( path, i18n("File Selector Settings"),
                              BarIcon("document-open", TDEIcon::SizeSmall) );
  fileSelConfigPage = new KFSConfigPage( page, "file selector config page",
                                         mainWindow->fileselector );
  connect( fileSelConfigPage, TQT_SIGNAL( changed() ), this, TQT_SLOT( slotChanged() ) );
  path.clear();

  path << i18n("Application") << i18n("Document List");
  page = addVBoxPage( path, i18n("Document List Settings"),
  BarIcon("view_text", TDEIcon::SizeSmall) );
  filelistConfigPage = new KFLConfigPage( page, "file list config page",
					  mainWindow->filelist );
  connect( filelistConfigPage, TQT_SIGNAL( changed() ), this, TQT_SLOT( slotChanged() ) );
  path.clear();

  path << i18n("Application") << i18n("Plugins");
  /*TQVBox **/page=addVBoxPage(path,i18n("Plugin Manager"),
                          BarIcon("connect_established",TDEIcon::SizeSmall));
  KateConfigPluginPage *configPluginPage = new KateConfigPluginPage(page, this);
  connect( configPluginPage, TQT_SIGNAL( changed() ), TQT_TQOBJECT(this), TQT_SLOT( slotChanged() ) );

  // Tools->External Tools menu
  path.clear();
  path << i18n("Application") << i18n("External Tools");
  page = addVBoxPage( path, i18n("External Tools"),
      BarIcon("configure", TDEIcon::SizeSmall) );
  configExternalToolsPage = new KateExternalToolsConfigWidget(page, "external tools config page");
  connect( configExternalToolsPage, TQT_SIGNAL(changed()), TQT_TQOBJECT(this), TQT_SLOT(slotChanged()) );

  // editor widgets from kwrite/kwdialog
  path.clear();
  path << i18n("Editor");
  setFolderIcon (path, SmallIcon("edit", TDEIcon::SizeSmall));

  for (uint i = 0; i < KTextEditor::configInterfaceExtension (v->document())->configPages (); i++)
  {
    path.clear();
    path << i18n("Editor") << KTextEditor::configInterfaceExtension (v->document())->configPageName (i);
    /*TQVBox **/page = addVBoxPage(path, KTextEditor::configInterfaceExtension (v->document())->configPageFullName (i),
                              KTextEditor::configInterfaceExtension (v->document())->configPagePixmap(i, TDEIcon::SizeSmall) );

    KTextEditor::ConfigPage *cPage = KTextEditor::configInterfaceExtension (v->document())->configPage(i, page);
    connect( cPage, TQT_SIGNAL( changed() ), this, TQT_SLOT( slotChanged() ) );
    editorPages.append (cPage);
  }

  KatePluginList &pluginList (KatePluginManager::self()->pluginList());
  for (unsigned int i=0; i < pluginList.size(); ++i)
  {
    if  ( pluginList[i].load
          && Kate::pluginConfigInterfaceExtension(pluginList[i].plugin) )
      addPluginPage (pluginList[i].plugin);
  }

  enableButtonSeparator(true);
  dataChanged = false;
  unfoldTreeList ();
}
Example #12
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    ui2(new Ui::Dialog),
    m_aboutDialog(nullptr),
    m_baiduTranslater(new CBaiduTranslater(this)),
    m_from("auto"),
    m_to("auto"),
    m_statusInfo(new QLabel(this)),
    m_pinWindow(new QToolButton(this)),
    //m_updateStyle(new QToolButton(this)),
    m_about(new QToolButton(this))
{
    ui->setupUi(this);

    /* Stay on top tool button */
//    m_pinWindow = new QToolButton(this);
    m_pinWindow->setObjectName(tr("pinWindow"));
    m_pinWindow->setText("置顶");
    m_pinWindow->setToolTip(tr("stay on top"));
    m_pinWindow->setToolButtonStyle(Qt::ToolButtonTextOnly);
    ui->statusBar->addWidget(m_pinWindow, 0);
    connect(m_pinWindow, &QToolButton::clicked, this, &MainWindow::togglePinWindow);

    /* Update style tool button */
//    m_updateStyle = new QToolButton(this);
    //m_updateStyle->setObjectName(tr("updateStyle"));
    //m_updateStyle->setToolTip(tr("update style"));
    //ui->statusBar->addWidget(m_updateStyle, 0);
    //connect(m_updateStyle, &QToolButton::clicked, this, &MainWindow::updateStyle);

    /* status display label */
//    m_statusInfo = new QLabel(this);
    m_statusInfo->setAlignment(Qt::AlignRight);
    ui->statusBar->addWidget(m_statusInfo, 1);

    /* About button */
//    m_about = new QToolButton(this);
    m_about->setObjectName(tr("about"));
    m_about->setToolTip(tr("关于 LBTrans"));
    m_about->setText("关于 LBTrans");
    m_about->setToolButtonStyle(Qt::ToolButtonTextOnly);
    ui->statusBar->insertWidget(2, m_about);
    connect(m_about, &QToolButton::clicked, this, &MainWindow::showAboutDialog);


    /* initialize translation direction */
    initComboBox(ui->comboBox, 0);
    initComboBox(ui->comboBoxObject, 1);

    // Set baidu translate seveice API key
    m_baiduTranslater->setAPI_Key("YaGqITH4r1i95Xp8izAhrxwT");

    /* translate */
    connect(ui->btnTranslate, SIGNAL(clicked()), this, SLOT(translate()));
    connect(m_baiduTranslater, &CBaiduTranslater::finished, this, &MainWindow::showResult);

    /* initialize waiting label */
    ui->label_statusPicture->setFileName(":/res/loading.gif");
    ui->label_statusPicture->hide();
    ui->label_translationStatus->setText(tr("正在翻译..."));
    ui->label_translationStatus->hide();

    /* Set MainWindow title */
    setWindowTitle(tr("LBTrans"));
    setWindowIcon(QIcon(":/res/windowIcon.ico"));
    /* Show in screen center */
    QSize screenSize = qApp->desktop()->availableGeometry().size();
    QSize mainWindowSize = size();
    QPoint destPos;
    destPos.setX((screenSize.width() - mainWindowSize.width()) / 2);
    destPos.setY((screenSize.height() - mainWindowSize.height()) / 2);
    this->move(destPos);

    /* contriant window size */
    setMaximumSize(size());
    setMinimumSize(size());
}
Example #13
0
 InputPreview::InputPreview(QWidget* _parent) :
   GLView(_parent)
 {
   setMinimumSize(128 / devicePixelRatio(),128 / devicePixelRatio());
 }
Example #14
0
QgsDial::QgsDial( QWidget *parent ) : QDial( parent )
{
  setMinimumSize( QSize( 50, 50 ) );
}
Example #15
0
SwapObjectsIdsWidget::SwapObjectsIdsWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f)
{
	try
	{
		QGridLayout *swap_objs_grid=new QGridLayout(this);
		vector<ObjectType> types=BaseObject::getObjectTypes(true, {OBJ_PERMISSION, OBJ_ROLE, OBJ_TEXTBOX,
																   OBJ_COLUMN, OBJ_CONSTRAINT });
		setupUi(this);

		PgModelerUiNS::configureWidgetFont(message_lbl, PgModelerUiNS::MEDIUM_FONT_FACTOR);

		src_object_sel=nullptr;
		dst_object_sel=nullptr;

		src_object_sel=new ObjectSelectorWidget(types, true, this);
		src_object_sel->enableObjectCreation(false);

		dst_object_sel=new ObjectSelectorWidget(types, true, this);
		dst_object_sel->enableObjectCreation(false);

		swap_objs_grid->setContentsMargins(4,4,4,4);
		swap_objs_grid->setSpacing(6);

		swap_objs_grid->addWidget(create_lbl, 0, 0);
		swap_objs_grid->addWidget(src_object_sel, 0, 1);
		swap_objs_grid->addWidget(src_id_lbl, 0, 2);
		swap_objs_grid->addWidget(src_ico_lbl, 0, 3);

		swap_objs_grid->addWidget(before_lbl, 1, 0);
		swap_objs_grid->addWidget(dst_object_sel, 1, 1);
		swap_objs_grid->addWidget(dst_id_lbl, 1, 2);
		swap_objs_grid->addWidget(dst_ico_lbl, 1, 3);

		QHBoxLayout *hlayout=new QHBoxLayout;
		hlayout->addSpacerItem(new QSpacerItem(10,10, QSizePolicy::Expanding));
		hlayout->addWidget(swap_values_tb);
		hlayout->addSpacerItem(new QSpacerItem(10,10, QSizePolicy::Expanding));

		swap_objs_grid->addLayout(hlayout, 2, 0, 1, 4);
		swap_objs_grid->addItem(new QSpacerItem(10,0,QSizePolicy::Minimum,QSizePolicy::Expanding), swap_objs_grid->count()+1, 0);
		swap_objs_grid->addWidget(alert_frm, swap_objs_grid->count()+1, 0, 1, 4);

		setModel(nullptr);

		connect(src_object_sel, SIGNAL(s_objectSelected(void)), this, SLOT(showObjectId(void)));
		connect(dst_object_sel, SIGNAL(s_objectSelected(void)), this, SLOT(showObjectId(void)));
		connect(src_object_sel, SIGNAL(s_selectorCleared(void)), this, SLOT(showObjectId(void)));
		connect(dst_object_sel, SIGNAL(s_selectorCleared(void)), this, SLOT(showObjectId(void)));

		connect(swap_values_tb, &QToolButton::clicked,
				[=](){ BaseObject *obj=src_object_sel->getSelectedObject();
			src_object_sel->setSelectedObject(dst_object_sel->getSelectedObject());
			dst_object_sel->setSelectedObject(obj); });

		setMinimumSize(550,150);
	}
	catch(Exception &e)
	{
		throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e);
	}
}
Example #16
0
/*
    Initializes histogram representation
        span : the period of time to be taken into account
        width, height : dimensions
*/
Histogram::Histogram(const QWidget* new_window, unsigned short span, const QColor& new_color, unsigned short width, unsigned short height) : window(new_window), painter(NULL), data(span, 0.0), max(0.0), min(0.0), color(new_color), col_border(QColor(Qt::grey)), col_background(QColor(Qt::black)), timer(0) 
{
    setSizePolicy(QtGui::QSizePolicy(QtGui::QSizePolicy::Fixed, QtGui::QSizePolicy::Fixed));
    setMinimumSize(width, height);
}
/* 
 *  Constructs a DebugTreiberGUI which is a child of 'parent', with the 
 *  name 'name' and widget flags set to 'f' 
 */
DebugTreiberGUI::DebugTreiberGUI( QWidget* parent,  const char* name, WFlags fl )
    : QWidget( parent, name, fl )
{
    if ( !name )
	setName( "DebugTreiberGUI" );
    resize( 240, 300 ); 
    setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, sizePolicy().hasHeightForWidth() ) );
    setMinimumSize( QSize( 240, 300 ) );
    setMaximumSize( QSize( 240, 300 ) );
    setCaption( tr( "DebugTreiberGUI" ) );

    Tab = new QTabWidget( this, "Tab" );
    Tab->setEnabled( TRUE );
    Tab->setGeometry( QRect( 0, 0, 240, 300 ) ); 
    QToolTip::add(  Tab, tr( "" ) );

    SendenTab = new QWidget( Tab, "SendenTab" );

    TextLabel1 = new QLabel( SendenTab, "TextLabel1" );
    TextLabel1->setGeometry( QRect( 10, 10, 75, 20 ) ); 
    TextLabel1->setText( tr( "Operation:" ) );

    TextLabel1_3 = new QLabel( SendenTab, "TextLabel1_3" );
    TextLabel1_3->setGeometry( QRect( 10, 40, 141, 20 ) ); 
    TextLabel1_3->setText( tr( "Anzahl Datenbytes:" ) );

    sendButton = new QPushButton( SendenTab, "sendButton" );
    sendButton->setGeometry( QRect( 60, 220, 120, 32 ) ); 
    sendButton->setText( tr( "Senden!" ) );
    sendButton->setDefault( TRUE );
    QToolTip::add(  sendButton, tr( "Daten absenden" ) );

    DatenBytes = new QGroupBox( SendenTab, "DatenBytes" );
    DatenBytes->setGeometry( QRect( 10, 70, 220, 150 ) ); 
    DatenBytes->setTitle( tr( "DatenBytes" ) );

    byte12 = new QSpinBox( DatenBytes, "byte12" );
    byte12->setEnabled( FALSE );
    byte12->setGeometry( QRect( 10, 110, 50, 26 ) ); 
    byte12->setMaxValue( 255 );
    QToolTip::add(  byte12, tr( "Byte 12" ) );

    byte14 = new QSpinBox( DatenBytes, "byte14" );
    byte14->setEnabled( FALSE );
    byte14->setGeometry( QRect( 110, 110, 50, 26 ) ); 
    byte14->setMaxValue( 255 );
    QToolTip::add(  byte14, tr( "Byte 14" ) );

    byte5 = new QSpinBox( DatenBytes, "byte5" );
    byte5->setEnabled( FALSE );
    byte5->setGeometry( QRect( 60, 50, 50, 26 ) ); 
    byte5->setMaxValue( 255 );
    QToolTip::add(  byte5, tr( "Byte 5" ) );

    byte4 = new QSpinBox( DatenBytes, "byte4" );
    byte4->setEnabled( FALSE );
    byte4->setGeometry( QRect( 10, 50, 50, 26 ) ); 
    byte4->setMaxValue( 255 );
    QToolTip::add(  byte4, tr( "Byte 4" ) );

    byte8 = new QSpinBox( DatenBytes, "byte8" );
    byte8->setEnabled( FALSE );
    byte8->setGeometry( QRect( 10, 80, 50, 26 ) ); 
    byte8->setMaxValue( 255 );
    QToolTip::add(  byte8, tr( "Byte 8" ) );

    byte13 = new QSpinBox( DatenBytes, "byte13" );
    byte13->setEnabled( FALSE );
    byte13->setGeometry( QRect( 60, 110, 50, 26 ) ); 
    byte13->setMaxValue( 255 );
    QToolTip::add(  byte13, tr( "Byte 13" ) );

    byte9 = new QSpinBox( DatenBytes, "byte9" );
    byte9->setEnabled( FALSE );
    byte9->setGeometry( QRect( 60, 80, 50, 26 ) ); 
    byte9->setMaxValue( 255 );
    QToolTip::add(  byte9, tr( "Byte 9" ) );

    byte10 = new QSpinBox( DatenBytes, "byte10" );
    byte10->setEnabled( FALSE );
    byte10->setGeometry( QRect( 110, 80, 50, 26 ) ); 
    byte10->setMaxValue( 255 );
    QToolTip::add(  byte10, tr( "Byte 10" ) );

    byte1 = new QSpinBox( DatenBytes, "byte1" );
    byte1->setEnabled( FALSE );
    byte1->setGeometry( QRect( 60, 20, 50, 26 ) ); 
    byte1->setMaxValue( 255 );
    QToolTip::add(  byte1, tr( "Byte 1" ) );

    byte2 = new QSpinBox( DatenBytes, "byte2" );
    byte2->setEnabled( FALSE );
    byte2->setGeometry( QRect( 110, 20, 50, 25 ) ); 
    byte2->setMaxValue( 255 );
    QToolTip::add(  byte2, tr( "Byte 2" ) );

    byte3 = new QSpinBox( DatenBytes, "byte3" );
    byte3->setEnabled( FALSE );
    byte3->setGeometry( QRect( 160, 20, 50, 26 ) ); 
    byte3->setMaxValue( 255 );
    QToolTip::add(  byte3, tr( "Byte 3" ) );

    byte7 = new QSpinBox( DatenBytes, "byte7" );
    byte7->setEnabled( FALSE );
    byte7->setGeometry( QRect( 160, 50, 50, 26 ) ); 
    byte7->setMaxValue( 255 );
    QToolTip::add(  byte7, tr( "Byte 7" ) );

    byte11 = new QSpinBox( DatenBytes, "byte11" );
    byte11->setEnabled( FALSE );
    byte11->setGeometry( QRect( 160, 80, 50, 26 ) ); 
    byte11->setMaxValue( 255 );
    QToolTip::add(  byte11, tr( "Byte 11" ) );

    byte6 = new QSpinBox( DatenBytes, "byte6" );
    byte6->setEnabled( FALSE );
    byte6->setGeometry( QRect( 110, 50, 50, 26 ) ); 
    byte6->setMaxValue( 255 );
    QToolTip::add(  byte6, tr( "Byte 6" ) );

    byte0 = new QSpinBox( DatenBytes, "byte0" );
    byte0->setEnabled( FALSE );
    byte0->setGeometry( QRect( 10, 20, 50, 26 ) ); 
    byte0->setMaxValue( 255 );
    byte0->setValue( 0 );
    QToolTip::add(  byte0, tr( "Byte 0" ) );

    toOpId = new QSpinBox( SendenTab, "toOpId" );
    toOpId->setGeometry( QRect( 160, 10, 58, 25 ) ); 
    toOpId->setMaxValue( 64 );
    QToolTip::add(  toOpId, tr( QString::fromUtf8( "Die auf dem Gerät auszulösende Operation" ) ) );

    toLength = new QSpinBox( SendenTab, "toLength" );
    toLength->setGeometry( QRect( 160, 40, 58, 25 ) ); 
    toLength->setMaxValue( 15 );
    toLength->setValue( 0 );
    QToolTip::add(  toLength, tr( QString::fromUtf8( "Anzahl der zu übertragenden Datenbytes" ) ) );
    Tab->insertTab( SendenTab, tr( "Senden" ) );

    EmpfangenTab = new QWidget( Tab, "EmpfangenTab" );

    DatenBytes_Received = new QGroupBox( EmpfangenTab, "DatenBytes_Received" );
    DatenBytes_Received->setGeometry( QRect( 10, 70, 220, 150 ) ); 
    DatenBytes_Received->setTitle( tr( "DatenBytes" ) );

    rbyte1 = new QSpinBox( DatenBytes_Received, "rbyte1" );
    rbyte1->setEnabled( FALSE );
    rbyte1->setGeometry( QRect( 60, 20, 50, 26 ) ); 
    rbyte1->setMaxValue( 255 );
    QToolTip::add(  rbyte1, tr( "Byte 1" ) );

    rbyte2 = new QSpinBox( DatenBytes_Received, "rbyte2" );
    rbyte2->setEnabled( FALSE );
    rbyte2->setGeometry( QRect( 110, 20, 50, 25 ) ); 
    rbyte2->setMaxValue( 255 );
    QToolTip::add(  rbyte2, tr( "Byte 2" ) );

    rbyte3 = new QSpinBox( DatenBytes_Received, "rbyte3" );
    rbyte3->setEnabled( FALSE );
    rbyte3->setGeometry( QRect( 160, 20, 50, 26 ) ); 
    rbyte3->setMaxValue( 255 );
    QToolTip::add(  rbyte3, tr( "Byte 3" ) );

    rbyte5 = new QSpinBox( DatenBytes_Received, "rbyte5" );
    rbyte5->setEnabled( FALSE );
    rbyte5->setGeometry( QRect( 60, 50, 50, 26 ) ); 
    rbyte5->setMaxValue( 255 );
    QToolTip::add(  rbyte5, tr( "Byte 5" ) );

    rbyte6 = new QSpinBox( DatenBytes_Received, "rbyte6" );
    rbyte6->setEnabled( FALSE );
    rbyte6->setGeometry( QRect( 110, 50, 50, 26 ) ); 
    rbyte6->setMaxValue( 255 );
    QToolTip::add(  rbyte6, tr( "Byte 6" ) );

    rbyte7 = new QSpinBox( DatenBytes_Received, "rbyte7" );
    rbyte7->setEnabled( FALSE );
    rbyte7->setGeometry( QRect( 160, 50, 50, 26 ) ); 
    rbyte7->setMaxValue( 255 );
    QToolTip::add(  rbyte7, tr( "Byte 7" ) );

    rbyte10 = new QSpinBox( DatenBytes_Received, "rbyte10" );
    rbyte10->setEnabled( FALSE );
    rbyte10->setGeometry( QRect( 110, 80, 50, 26 ) ); 
    rbyte10->setMaxValue( 255 );
    QToolTip::add(  rbyte10, tr( "Byte 10" ) );

    rbyte11 = new QSpinBox( DatenBytes_Received, "rbyte11" );
    rbyte11->setEnabled( FALSE );
    rbyte11->setGeometry( QRect( 160, 80, 50, 26 ) ); 
    rbyte11->setMaxValue( 255 );
    QToolTip::add(  rbyte11, tr( "Byte 11" ) );

    rbyte9 = new QSpinBox( DatenBytes_Received, "rbyte9" );
    rbyte9->setEnabled( FALSE );
    rbyte9->setGeometry( QRect( 60, 80, 50, 26 ) ); 
    rbyte9->setMaxValue( 255 );
    QToolTip::add(  rbyte9, tr( "Byte 9" ) );

    rbyte14 = new QSpinBox( DatenBytes_Received, "rbyte14" );
    rbyte14->setEnabled( FALSE );
    rbyte14->setGeometry( QRect( 110, 110, 50, 26 ) ); 
    rbyte14->setMaxValue( 255 );
    QToolTip::add(  rbyte14, tr( "Byte 14" ) );

    rbyte13 = new QSpinBox( DatenBytes_Received, "rbyte13" );
    rbyte13->setEnabled( FALSE );
    rbyte13->setGeometry( QRect( 60, 110, 50, 26 ) ); 
    rbyte13->setMaxValue( 255 );
    QToolTip::add(  rbyte13, tr( "Byte 13" ) );

    rbyte12 = new QSpinBox( DatenBytes_Received, "rbyte12" );
    rbyte12->setEnabled( FALSE );
    rbyte12->setGeometry( QRect( 10, 110, 50, 26 ) ); 
    rbyte12->setMaxValue( 255 );
    QToolTip::add(  rbyte12, tr( "Byte 12" ) );

    rbyte8 = new QSpinBox( DatenBytes_Received, "rbyte8" );
    rbyte8->setEnabled( FALSE );
    rbyte8->setGeometry( QRect( 10, 80, 50, 26 ) ); 
    rbyte8->setMaxValue( 255 );
    QToolTip::add(  rbyte8, tr( "Byte 8" ) );

    rbyte4 = new QSpinBox( DatenBytes_Received, "rbyte4" );
    rbyte4->setEnabled( FALSE );
    rbyte4->setGeometry( QRect( 10, 50, 50, 26 ) ); 
    rbyte4->setMaxValue( 255 );
    QToolTip::add(  rbyte4, tr( "Byte 4" ) );

    rbyte0 = new QSpinBox( DatenBytes_Received, "rbyte0" );
    rbyte0->setEnabled( FALSE );
    rbyte0->setGeometry( QRect( 10, 20, 50, 26 ) ); 
    rbyte0->setMaxValue( 255 );
    rbyte0->setValue( 0 );
    QToolTip::add(  rbyte0, tr( "Byte 0" ) );

    receiveNumber = new QSpinBox( EmpfangenTab, "receiveNumber" );
    receiveNumber->setGeometry( QRect( 160, 10, 58, 25 ) ); 
    receiveNumber->setMaxValue( 0 );
    receiveNumber->setValue( 0 );
    QToolTip::add(  receiveNumber, tr( QString::fromUtf8( "Nummer der Übertragung" ) ) );
    QWhatsThis::add(  receiveNumber, tr( QString::fromUtf8( "Einstellen, welche der gespeicherten Übertragungen angezeiht werden soll" ) ) );

    TextLabel1_2 = new QLabel( EmpfangenTab, "TextLabel1_2" );
    TextLabel1_2->setGeometry( QRect( 10, 40, 80, 20 ) ); 
    TextLabel1_2->setText( tr( "Operation:" ) );

    TextLabel4 = new QLabel( EmpfangenTab, "TextLabel4" );
    TextLabel4->setGeometry( QRect( 10, 10, 80, 20 ) ); 
    TextLabel4->setText( tr( QString::fromUtf8( "Übertragung" ) ) );

    fromOpId = new QSpinBox( EmpfangenTab, "fromOpId" );
    fromOpId->setEnabled( FALSE );
    fromOpId->setGeometry( QRect( 160, 40, 58, 25 ) ); 
    QToolTip::add(  fromOpId, tr( "Die Empfangene Operation" ) );

    Pause = new QCheckBox( EmpfangenTab, "Pause" );
    Pause->setGeometry( QRect( 70, 230, 106, 24 ) ); 
    Pause->setText( tr( "Pause" ) );
    Tab->insertTab( EmpfangenTab, tr( "Empfangen" ) );

    SetupTab = new QWidget( Tab, "SetupTab" );

    GroupBox5 = new QGroupBox( SetupTab, "GroupBox5" );
    GroupBox5->setGeometry( QRect( 8, 10, 220, 90 ) ); 
    GroupBox5->setTitle( tr( QString::fromUtf8( "Geräte-ID" ) ) );

    DeviceID = new QSpinBox( GroupBox5, "DeviceID" );
    DeviceID->setGeometry( QRect( 140, 30, 59, 26 ) ); 
    DeviceID->setMaxValue( 32 );
    DeviceID->setValue( 1 );
    QToolTip::add(  DeviceID, tr( QString::fromUtf8( "ID des zu testenden Gerätes" ) ) );
    QWhatsThis::add(  DeviceID, tr( QString::fromUtf8( "Hier kann man die ID einstellen, für die sich die GUI zuständig fühlt, d.h. die, unter der man Senden und Emfangen möchte." ) ) );

    toDeviceLabel = new QLabel( GroupBox5, "toDeviceLabel" );
    toDeviceLabel->setGeometry( QRect( 12, 30, 70, 20 ) ); 
    toDeviceLabel->setText( tr( QString::fromUtf8( "Gerät" ) ) );

    broadcast = new QCheckBox( GroupBox5, "broadcast" );
    broadcast->setGeometry( QRect( 50, 60, 106, 24 ) ); 
    broadcast->setText( tr( "Broadcast" ) );
    QToolTip::add(  broadcast, tr( "Als Broadcast senden" ) );
    QWhatsThis::add(  broadcast, tr( QString::fromUtf8( "Dies wirkt sich nicht auf das empfangen von Daten aus, da Geräte keine Broadcasts senden können." ) ) );

    QuitButton = new QPushButton( SetupTab, "QuitButton" );
    QuitButton->setGeometry( QRect( 60, 110, 116, 31 ) ); 
    QuitButton->setText( tr( "Beenden" ) );
    QToolTip::add(  QuitButton, tr( "Beendet das Programm" ) );
    Tab->insertTab( SetupTab, tr( "Setup" ) );

    // signals and slots connections
    connect( sendButton, SIGNAL( clicked() ), this, SLOT( send() ) );
    connect( toLength, SIGNAL( valueChanged(int) ), this, SLOT( setNumberOfDataBytes(int) ) );
    connect( DeviceID, SIGNAL( valueChanged(int) ), this, SLOT( setID(int) ) );
    connect( receiveNumber, SIGNAL( valueChanged(int) ), this, SLOT( showReceivedWithNumber(int) ) );
    connect( broadcast, SIGNAL( toggled(bool) ), DeviceID, SLOT( setDisabled(bool) ) );
    connect( QuitButton, SIGNAL( clicked() ), this, SLOT( quit() ) );

    // tab order
    setTabOrder( Tab, sendButton );
}
Example #18
0
InstrumentRack::InstrumentRack( QWidget *pParent )
 : QWidget( pParent )
 , Object( __class_name )
{
	INFOLOG( "INIT" );

	resize( 290, 405 );
	setMinimumSize( width(), height() );
	setFixedWidth( width() );


// TAB buttons
	QWidget *pTabButtonsPanel = new QWidget( NULL );
	pTabButtonsPanel->setFixedHeight( 24 );
	pTabButtonsPanel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );

	// instrument editor button
	m_pShowInstrumentEditorBtn = new ToggleButton(
			pTabButtonsPanel,
			"/instrumentEditor/instrument_show_on.png",
			"/instrumentEditor/instrument_show_off.png",
			"/instrumentEditor/instrument_show_off.png",
			QSize( 130, 24 )
	);
	m_pShowInstrumentEditorBtn->setToolTip( trUtf8( "Show Instrument editor" ) );
	m_pShowInstrumentEditorBtn->setText( trUtf8( "Instrument" ) );
	connect( m_pShowInstrumentEditorBtn, SIGNAL( clicked( Button* ) ), this, SLOT( on_showInstrumentEditorBtnClicked() ) );

	// show sound library button
	m_pShowSoundLibraryBtn = new ToggleButton(
			pTabButtonsPanel,
			"/instrumentEditor/library_show_on.png",
			"/instrumentEditor/library_show_off.png",
			"/instrumentEditor/library_show_off.png",
			QSize( 150, 24 )
	);
	m_pShowSoundLibraryBtn->setToolTip( trUtf8( "Show sound library" ) );
	m_pShowSoundLibraryBtn->setText( trUtf8( "Sound library" ) );
	connect( m_pShowSoundLibraryBtn, SIGNAL( clicked( Button* ) ), this, SLOT( on_showSoundLibraryBtnClicked() ) );

	QHBoxLayout *pTabHBox = new QHBoxLayout();
	pTabHBox->setSpacing( 0 );
	pTabHBox->setMargin( 0 );
	pTabHBox->addWidget( m_pShowInstrumentEditorBtn );
	pTabHBox->addWidget( m_pShowSoundLibraryBtn );

	pTabButtonsPanel->setLayout( pTabHBox );

//~ TAB buttons


	InstrumentEditorPanel::get_instance()->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );

	m_pSoundLibraryPanel = new SoundLibraryPanel( NULL );

	// LAYOUT
	QGridLayout *pGrid = new QGridLayout();
	pGrid->setSpacing( 0 );
	pGrid->setMargin( 0 );

	pGrid->addWidget( pTabButtonsPanel, 0, 0, 1, 3 );
	pGrid->addWidget( InstrumentEditorPanel::get_instance(), 2, 1 );
	pGrid->addWidget( m_pSoundLibraryPanel, 2, 1 );

	this->setLayout( pGrid );

	on_showInstrumentEditorBtnClicked();	// show the instrument editor as default
}
Example #19
0
    VideoWidget::VideoWidget(GstBus *bus,  QWidget *parent, const QString &name, const QString &video_sink_name) 
        : Communication::VideoPlaybackWidgetInterface(parent), 
          bus_((GstBus *) gst_object_ref(bus)), 
          video_overlay_(0), 
          video_playback_element_(0),
          video_playback_bin_(0),
          name_(name),
          window_id_(0),
          on_element_added_g_signal_(0),
          on_sync_message_g_signal_(0)

    {
        qDebug() << "VideoWidget " << name << " INIT STARTED";
        setWindowTitle(name);

        // Element notifier init
        notifier_ = fs_element_added_notifier_new();
        on_element_added_g_signal_ = g_signal_connect(notifier_, "element-added", G_CALLBACK(&VideoWidget::OnElementAdded), this);

// UNIX -> autovideosink
       
#ifdef Q_WS_X11

        qt_x11_set_global_double_buffer(false);

        //video_playback_element_ = gst_element_factory_make(video_sink_name.toStdString().c_str(), 0);
        //gst_object_ref(video_playback_element_);
        //gst_object_sink(video_playback_element_);
        //fs_element_added_notifier_add(notifier_, GST_BIN(video_playback_element_));

#endif
        // WINDOWS -> autovideosink will chose one of there: glimagesink (best), directdrawsink (possible buffer errors), dshowvideosink (possible buffer errors)
        // X11 -> 
        video_playback_element_ = gst_element_factory_make(video_sink_name.toStdString().c_str(), 0);
        if (!video_playback_element_)
        {
            qDebug() << "VideoWidget " << name << " CANNOT CREATE video_playback_element_ (" << video_sink_name <<")";
            return;
        }

        // Video bin init
        const QString video_bin_name = "video_bin_for_" + name;
        video_playback_bin_ = gst_bin_new(video_bin_name.toStdString().c_str());
        if (!video_playback_bin_)
        {
            qDebug() << "VideoWidget " << name << " CANNOT CREATE video_bin_";
            return;
        }

        // Add playback element to video bin
        gst_bin_add(GST_BIN(video_playback_bin_), video_playback_element_);

        // Pad inits
        GstPad *static_sink_pad = gst_element_get_static_pad(video_playback_element_, "sink");
        GstPad *sink_ghost_pad = gst_ghost_pad_new("sink", static_sink_pad);

        // Add pad to video bin
        gst_element_add_pad(GST_ELEMENT(video_playback_bin_), sink_ghost_pad);
        gst_object_unref(G_OBJECT(static_sink_pad));
        gst_object_ref(video_playback_bin_);
        gst_object_sink(video_playback_bin_);

        fs_element_added_notifier_add(notifier_, GST_BIN(video_playback_bin_));

        gst_bus_enable_sync_message_emission(bus_);
        on_sync_message_g_signal_ = g_signal_connect(bus_, "sync-message", G_CALLBACK(&VideoWidget::OnSyncMessage), this);

        qDebug() << "VideoWidget " << name << " INIT COMPLETE";

        // QWidget properties
        QPalette palette;
        palette.setColor(QPalette::Background, Qt::black);
        palette.setColor(QPalette::Window, Qt::black);
        setPalette(palette);
        
        // Show nothing and lets put qwidgets as normal external windows
        //setAutoFillBackground(true);
        //setAttribute(Qt::WA_NoSystemBackground, true);
        //setAttribute(Qt::WA_PaintOnScreen, true);

        setWindowFlags(Qt::Dialog);
        resize(VIDEO_WIDTH, VIDEO_HEIGHT);
        setMinimumSize(VIDEO_WIDTH, VIDEO_HEIGHT);
    }
Example #20
0
MainWidget::MainWidget(QWidget *parent)
    : DropShadowWidget(parent)
{
	initLocalConnection();
    setMinimumSize(900, 600);
	setWindowIcon(QIcon(":/img/safe"));

	statked_widget = new QStackedWidget();
    title_widget = new TitleWidget();
    content_widget = new ContentWidget();
	kill_mummy_widget = new KillMummyWidget();
	main_menu = new MainMenu();
	character_widget = new CharacterWidget();
	about_us_dialog = new AboutUsDialog(this);
	setting_dialog = new SettingDialog(this);
	login_dialog = new LoginDialog(this);
	register_widget = new RegisterWidget(this); 
	skin_widget = new SkinWidget(this);
	system_tray = new SystemTray(this);

	QPalette palette;
	palette.setBrush(QPalette::Window, QBrush(Qt::white));
    statked_widget->setPalette(palette);
    statked_widget->setAutoFillBackground(true);

	statked_widget->addWidget(content_widget);
	statked_widget->addWidget(kill_mummy_widget);

	QVBoxLayout *center_layout = new QVBoxLayout();
	center_layout->addWidget(statked_widget);
	center_layout->setSpacing(0);
	center_layout->setContentsMargins(0, 0, 0, 0);

    QVBoxLayout *main_layout = new QVBoxLayout();
    main_layout->addWidget(title_widget);
    main_layout->addLayout(center_layout);
	main_layout->setSpacing(0);
	main_layout->setContentsMargins(SHADOW_WIDTH, SHADOW_WIDTH, SHADOW_WIDTH, SHADOW_WIDTH);

    setLayout(main_layout);

	connect(title_widget, SIGNAL(showSkin()), this, SLOT(showSkinWidget()));
	connect(title_widget, SIGNAL(showMainMenu()), this, SLOT(showMainMenu()));
	connect(title_widget, SIGNAL(showMin()), this, SLOT(showMinimized()));
	connect(title_widget, SIGNAL(closeWidget()), this, SLOT(hide()));
	connect(title_widget, SIGNAL(turnPage(int)), this, SLOT(turnPage(int)));

	connect(main_menu, SIGNAL(showSettingDialog()), this, SLOT(showSettingDialog()));
	connect(main_menu, SIGNAL(showNewCharacter()), this, SLOT(showNewCharacter()));
	connect(main_menu, SIGNAL(showAboutUs()), this, SLOT(showAboutUs()));

	connect(content_widget, SIGNAL(showLoginDialog()), this, SLOT(showLoginDialog()));
	connect(content_widget, SIGNAL(showRegisterDialog()), this, SLOT(showRegisterDialog()));

	connect(setting_dialog, SIGNAL(changeLanguage(LANGUAGE)), this, SLOT(changeLanguage(LANGUAGE)));

	connect(skin_widget, SIGNAL(changeSkin(QString)), this, SLOT(changeSkin(QString)));

	connect(system_tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconIsActived(QSystemTrayIcon::ActivationReason)));
	connect(system_tray, SIGNAL(showWidget()), this, SLOT(showWidget()));
	
	system_tray->show();

	title_widget->turnPage("0");

	skin_name = Util::getSkinName();
	if( QString::compare(skin_name, QString("")) == 0)
	{
		this->changeSkin(DEFAULT_SKIN);
	}
}
Example #21
0
PasswordDialog::PasswordDialog(const char *head, QWidget* parent, const char* name, bool modal, WFlags wflags)
   : QDialog(parent, name, modal, wflags)
{
    debugT("Here we go!!\n");
    
   _head = head;

   // (David) Layout management
   QVBoxLayout *vLay = new QVBoxLayout(this, 10 /* border */, 5);

   //
   // Bei Bedarf einen kleinen Kommentar als Label einfuegen
   // English please !!! David.
   if (_head)
   {
      QLabel *l;
      
      l = new QLabel(_head, this);
      l->adjustSize();
      l->setMinimumSize(l->size());
      vLay->addWidget(l);
      // l->setGeometry( 10, 10, 200, 20 );
   }

   // The horizontal layout for label + lineedit
   QHBoxLayout *hLay = new QHBoxLayout(5);
   vLay->addLayout(hLay);
   //
   // Die eine oder zwei Zeile(n) mit der Passwortabfrage
   //
   QLabel *l_password = new QLabel(klocale->translate("Password"), this);
   l_password->adjustSize();
   l_password->setMinimumSize(l_password->size());
   hLay->addWidget(l_password,0);
   //l_password->setGeometry( 10, 40, 80, 30 );
   
   _w_password = new QLineEdit( this );
   //_w_password->setGeometry( 90, 40, 100, 30 );
   _w_password->setEchoMode( QLineEdit::Password );
   _w_password->adjustSize();
   _w_password->setFixedHeight(_w_password->height());
   hLay->addWidget(_w_password,10);
   
   //
   // Connect vom LineEdit herstellen und Accelerator
   //
   QAccel *ac = new QAccel(this);
   ac->connectItem( ac->insertItem(Key_Escape), this, SLOT(reject()) );
   
   connect( _w_password, SIGNAL(returnPressed()), SLOT(accept()) );
   
   //
   // Eine vertikale Linie erzeugen
   //
   QFrame *f = new QFrame(this);
   f->setLineWidth(1);
   f->setMidLineWidth(1);
   f->setFrameStyle( QFrame::HLine|QFrame::Raised);
   //f->setGeometry( 10, 80, 180, 2 );
   f->setMinimumHeight(5);
   vLay->addWidget(f,0);
   
   //
   // Die Buttons "OK" & "Cancel" erzeugen
   //
   QHBoxLayout *hBLay = new QHBoxLayout(5);
   vLay->addLayout(hBLay);

   hBLay->addStretch();

   QPushButton *b1, *b2;
   b1 = new QPushButton(klocale->translate("OK"), this);
   //b1->setGeometry( 10, 90, 80, 30 );
   b1->adjustSize();
   b1->setFixedSize(b1->size());   
   hBLay->addWidget(b1);

   hBLay->addStretch();
   //or hBLay->addSpacing(10);
   
   b2 = new QPushButton(klocale->translate("Cancel"), this);
   //b2->setGeometry( 110, 90, 80, 30 );
   b2->adjustSize();
   b2->setFixedSize(b2->size());   
   hBLay->addWidget(b2);

   hBLay->addStretch();
   
   // Buttons mit Funktionaliataet belegen
   connect( b1, SIGNAL(clicked()), SLOT(accept()) );
   connect( b2, SIGNAL(clicked()), SLOT(reject()) );
   
   // Fenstertitel
   setCaption(klocale->translate("Password"));
   
   // Focus
   _w_password->setFocus();
   
   vLay->activate();
   setMinimumSize(200, 50);
   setMaximumSize(300, 100);

   debugT("Hi folks, thats it\n");
}
Example #22
0
CStatSummary::CStatSummary( QWidget* parent, const char* name )
	: QWidget( parent, name, 0 )
{
	QBoxLayout	*playoutTop		= new QVBoxLayout( this, 5 );

    QGridLayout *playoutSliders = new QGridLayout( playoutTop, 3, 4 );
    
    nSliderMax = 10;

    pEnv = new QLabel( "0", this );
    pCon = new QLabel( "0", this );
    pSta = new QLabel( "0", this );
    pDes = new QLabel( "0", this );

	playoutSliders->addWidget( pEnv, 0, 0 );
	playoutSliders->addWidget( pCon, 0, 1 );
	playoutSliders->addWidget( pSta, 0, 2 );
	playoutSliders->addWidget( pDes, 0, 3 );

    pEnvSlider = new QSlider( this );
    pConSlider = new QSlider( this );
    pStaSlider = new QSlider( this );
    pDesSlider = new QSlider( this );

//    pEnvSlider->setTickmarks( QSlider::Both );
//    pConSlider->setTickmarks( QSlider::Both );
//    pStaSlider->setTickmarks( QSlider::Both );
//    pDesSlider->setTickmarks( QSlider::Both );

    pEnvSlider->setMinValue( 0-nSliderMax );
    pConSlider->setMinValue( 0-nSliderMax );
    pStaSlider->setMinValue( 0-nSliderMax );
    pDesSlider->setMinValue( 0-nSliderMax );

    pEnvSlider->setMaxValue( 0 );
    pConSlider->setMaxValue( 0 );
    pStaSlider->setMaxValue( 0 );
    pDesSlider->setMaxValue( 0 );

	playoutSliders->addWidget( pEnvSlider, 1, 0 );
	playoutSliders->addWidget( pConSlider, 1, 1 );
	playoutSliders->addWidget( pStaSlider, 1, 2 );
	playoutSliders->addWidget( pDesSlider, 1, 3 );

    QLabel *p1 = new QLabel( "Env", this );
    QLabel *p2 = new QLabel( "Con", this );
    QLabel *p3 = new QLabel( "Sta", this );
    QLabel *p4 = new QLabel( "Des", this );

	playoutSliders->addWidget( p1, 2, 0 );
	playoutSliders->addWidget( p2, 2, 1 );
	playoutSliders->addWidget( p3, 2, 2 );
	playoutSliders->addWidget( p4, 2, 3 );

	resize( 400,300 );
	setMinimumSize( 0, 0 );
	setMaximumSize( 32767, 32767 );

    // SHARED MEM
    hStats = 0;

    // TIMER
    pTimer = new QTimer( this );
    connect( pTimer, SIGNAL(timeout()), SLOT(showStats()) );
    pTimer->start( 700, FALSE );
}
Example #23
0
void Clock::updateSize()
{
    Plasma::FormFactor f = formFactor();

    if (f != Plasma::Vertical && f != Plasma::Horizontal) {
        const QFontMetricsF metrics(KGlobalSettings::smallestReadableFont());
        // calculates based on size of "23:59"!
        const QString timeString = KGlobal::locale()->formatTime(QTime(23, 59), m_showSeconds);
        setMinimumSize(metrics.size(Qt::TextSingleLine, timeString));
    }

    // more magic numbers
    int aspect = 2;
    if (m_showSeconds) {
        aspect = 3;
    }

    int w, h;
    if (m_dateStyle || showTimezone()) {
        const QFont f(KGlobalSettings::smallestReadableFont());
        const QFontMetrics metrics(f);
        // if there's enough vertical space, wrap the words
        if (contentsRect().height() < f.pointSize() * 6) {
            QSize s = metrics.size(Qt::TextSingleLine, m_dateString);
            w = s.width() + metrics.width(" ");
            h = f.pointSize();
            //kDebug(96669) << "uS: singleline" << w;
        } else {
            QSize s = metrics.size(Qt::TextWordWrap, m_dateString);
            w = s.width();
            h = f.pointSize();
            //kDebug(96669) << "uS: wordwrap" << w;
        }

        if (!m_dateTimezoneBesides) {
            w = qMax(w, (int)(contentsRect().height() * aspect));
            h = h+(int)(contentsRect().width() / aspect);
        } else {
            w = w+(int)(contentsRect().height() * aspect);
            h = qMax(h, (int)(contentsRect().width() / aspect));
        }
    } else {
        w = (int)(contentsRect().height() * aspect);
        h = (int)(contentsRect().width() / aspect);
    }

    if (f == Plasma::Horizontal) {
        // We have a fixed height, set some sensible width
        setMinimumSize(QSize(w, 0));
        //kDebug() << "DR" << m_dateRect.width() << "CR" << contentsRect().height() * aspect;
        // kDebug(96669) << contentsRect();
    } else {
        // We have a fixed width, set some sensible height
        setMinimumSize(QSize(0, h));
    }

    setPreferredSize(QSize(w, h));
    emit sizeHintChanged(Qt::PreferredSize);
    //kDebug(96669) << "minZize: " << minimumSize() << preferredSize();

    if (m_isDefaultFont) {
        const QString fakeTimeString = KGlobal::locale()->formatTime(QTime(23,59,59), m_showSeconds);
        expandFontToMax(m_plainClockFont, fakeTimeString);
    }

    generatePixmap();
    update();
}
Example #24
0
void KBBGame::setMinSize()
{
  setMinimumSize( gr->wHint(), gr->hHint() + menu->height() + stat->height() +
      tool->height() );
}
Example #25
0
grapWidget::grapWidget(int circuitId,QWidget *parent)
{
    QGraphicsScene *scene = new QGraphicsScene(this);
    setScene(scene);
    scale(qreal(0.8), qreal(0.8));//比例
    setMinimumSize(1000, 618);
   // setMaximumSize(1000,618);
    QPixmap pixmap;
    setWindowTitle(tr("实验电路图"));
    switch (circuitId) {
    case 0:
        pixmap = QPixmap("E:\\circuit_images\\01.jpg");
        break;
    case 1:
        pixmap = QPixmap("E:\\circuit_images\\02.jpg");
        break;
    case 2:
        pixmap = QPixmap("E:\\circuit_images\\03.jpg");
        break;
    case 3:
        pixmap = QPixmap("E:\\circuit_images\\04.jpg");
        break;
    case 4:
        pixmap = QPixmap("E:\\circuit_images\\05.jpg");
        break;
    case 5:
        pixmap = QPixmap("E:\\circuit_images\\06.jpg");
        break;
    case 6:
        pixmap = QPixmap("E:\\circuit_images\\07.jpg");
        break;
    case 7:
        pixmap = QPixmap("E:\\circuit_images\\08.jpg");
        break;
    case 8:
        pixmap = QPixmap("E:\\circuit_images\\09.jpg");
        break;
    case 9:
        pixmap = QPixmap("E:\\circuit_images\\10.jpg");
        break;
    case 10:
        pixmap = QPixmap("E:\\circuit_images\\11.jpg");
        break;
    case 11:
        pixmap = QPixmap("E:\\circuit_images\\12.jpg");
        break;
    case 12:
        pixmap = QPixmap("E:\\circuit_images\\13.jpg");
        break;
    case 13:
        pixmap = QPixmap("E:\\circuit_images\\14.jpg");
        break;
    }
    scene->addPixmap(pixmap);

//    QPushButton *closeBtn = new QPushButton(this);
////    QPixmap pixmap2(":/images/close3.png");
//    closeBtn->setIcon(QIcon(":/images/close3.png"));
////    closeBtn->setSizeIncrement(40,40);
//    QSize iconSize(40,40);
//    closeBtn->setIconSize(iconSize);
//    closeBtn->setGeometry(closeBtn->width(),
////    closeBtn->

//    //生成一张位图
//    QBitmap objBitmap(size());
//    //QPainter用于在位图上绘画
//    QPainter painter(&objBitmap);
//    //填充位图矩形框(用白色填充)
//    painter.fillRect(rect(),Qt::white);
//    painter.setBrush(QColor(0,0,0));
//    //在位图上画圆角矩形(用黑色填充)
//    painter.drawRoundedRect(this->rect(),10,10);
//    //使用setmask过滤即可
//    setMask(objBitmap);
    }
SimulatorAnalogData::SimulatorAnalogData(QWidget *parent, const char *name)
: QWidget(parent, name, 0)
{
	QLabel *qtarch_Label_2 = new QLabel(this, "Label_2");
	qtarch_Label_2->setGeometry(10, 10, 120, 30);
	qtarch_Label_2->setMinimumSize(0, 0);
	qtarch_Label_2->setMaximumSize(32767, 32767);
	qtarch_Label_2->setFocusPolicy(QWidget::NoFocus);
	qtarch_Label_2->setBackgroundMode(QWidget::PaletteBackground);
	#if QT_VERSION < 300
	qtarch_Label_2->setFontPropagation(QWidget::SameFont);
	qtarch_Label_2->setPalettePropagation(QWidget::SameFont);
	#endif
	qtarch_Label_2->setFrameStyle( 0 );
	qtarch_Label_2->setLineWidth( 1 );
	qtarch_Label_2->setMidLineWidth( 0 );
	qtarch_Label_2->QFrame::setMargin( 0 );
	qtarch_Label_2->setText( tr( "Sampling Period" ) );
	qtarch_Label_2->setAlignment( AlignHCenter|AlignVCenter|ExpandTabs );
	qtarch_Label_2->setMargin( 0 );
	Time = new TIMEEDIT(this, "User_1");
	Time->setGeometry(40, 50, 70, 30);
	Time->setMinimumSize(0, 0);
	Time->setMaximumSize(32767, 32767);
	Time->setFocusPolicy(QWidget::StrongFocus);
	Time->setBackgroundMode(QWidget::PaletteBackground);
	#if QT_VERSION < 300
	Time->setFontPropagation(QWidget::SameFont);
	Time->setPalettePropagation(QWidget::SameFont);
	#endif
	QLabel *qtarch_Label_3 = new QLabel(this, "Label_3");
	qtarch_Label_3->setGeometry(150, 10, 90, 30);
	qtarch_Label_3->setMinimumSize(0, 0);
	qtarch_Label_3->setMaximumSize(32767, 32767);
	qtarch_Label_3->setFocusPolicy(QWidget::NoFocus);
	qtarch_Label_3->setBackgroundMode(QWidget::PaletteBackground);
	#if QT_VERSION < 300
	qtarch_Label_3->setFontPropagation(QWidget::SameFont);
	qtarch_Label_3->setPalettePropagation(QWidget::SameFont);
	#endif
	qtarch_Label_3->setFrameStyle( 0 );
	qtarch_Label_3->setLineWidth( 1 );
	qtarch_Label_3->setMidLineWidth( 0 );
	qtarch_Label_3->QFrame::setMargin( 0 );
	qtarch_Label_3->setText( tr( "Mean Value" ) );
	qtarch_Label_3->setAlignment( AlignHCenter|AlignVCenter|ExpandTabs );
	qtarch_Label_3->setMargin( 0 );
	QLabel *qtarch_Label_4 = new QLabel(this, "Label_4");
	qtarch_Label_4->setGeometry(260, 10, 100, 30);
	qtarch_Label_4->setMinimumSize(0, 0);
	qtarch_Label_4->setMaximumSize(32767, 32767);
	qtarch_Label_4->setFocusPolicy(QWidget::NoFocus);
	qtarch_Label_4->setBackgroundMode(QWidget::PaletteBackground);
	#if QT_VERSION < 300
	qtarch_Label_4->setFontPropagation(QWidget::SameFont);
	qtarch_Label_4->setPalettePropagation(QWidget::SameFont);
	#endif
	qtarch_Label_4->setFrameStyle( 0 );
	qtarch_Label_4->setLineWidth( 1 );
	qtarch_Label_4->setMidLineWidth( 0 );
	qtarch_Label_4->QFrame::setMargin( 0 );
	qtarch_Label_4->setText( tr( "Variation +/-" ) );
	qtarch_Label_4->setAlignment( AlignHCenter|AlignVCenter|ExpandTabs );
	qtarch_Label_4->setMargin( 0 );
	Mean = new INTEDIT(this, "User_2");
	Mean->setGeometry(160, 50, 70, 30);
	Mean->setMinimumSize(0, 0);
	Mean->setMaximumSize(32767, 32767);
	Mean->setFocusPolicy(QWidget::StrongFocus);
	Mean->setBackgroundMode(QWidget::PaletteBackground);
	#if QT_VERSION < 300
	Mean->setFontPropagation(QWidget::SameFont);
	Mean->setPalettePropagation(QWidget::SameFont);
	#endif
	Variation = new INTEDIT(this, "User_3");
	Variation->setGeometry(270, 50, 70, 30);
	Variation->setMinimumSize(0, 0);
	Variation->setMaximumSize(32767, 32767);
	Variation->setFocusPolicy(QWidget::StrongFocus);
	Variation->setBackgroundMode(QWidget::PaletteBackground);
	#if QT_VERSION < 300
	Variation->setFontPropagation(QWidget::SameFont);
	Variation->setPalettePropagation(QWidget::SameFont);
	#endif
	resize(400,100);
	setMinimumSize(0, 0);
	setMaximumSize(32767, 32767);
}
Example #27
0
FontPrefs::FontPrefs( QWidget* parent, bool Hdoc, QString PPath, ScribusDoc* doc ) : QTabWidget( parent )
{
	RList = PrefsManager::instance()->appPrefs.GFontSub;
	HomeP = PPath;
	DocAvail = Hdoc;
	UsedFonts.clear();
	CurrentPath = "";
	docc = doc;
	setMinimumSize(fontMetrics().width( tr( "Available Fonts" )+ tr( "Font Substitutions" )+ tr( "Additional Paths" ))+180, 200);
	tab1 = new QWidget( this );
	tab1Layout = new QVBoxLayout( tab1 );
	tab1Layout->setMargin(10);
	tab1Layout->setSpacing(5);

	fontList = new FontListView(tab1);
	fontList->setModel(new FontListModel(fontList));

	tab1Layout->addWidget( fontList );
	addTab( tab1, tr( "&Available Fonts" ) );

	tab = new QWidget( this );
	tabLayout = new QVBoxLayout( tab );
	tabLayout->setMargin(10);
	tabLayout->setSpacing(5);

	Table3 = new QTableWidget(0, 2, tab );
	Table3->setHorizontalHeaderItem(0, new QTableWidgetItem( tr("Font Name")));
	Table3->setHorizontalHeaderItem(1, new QTableWidgetItem( tr("Replacement")));
	Table3->setSortingEnabled(false);
	Table3->setSelectionBehavior( QAbstractItemView::SelectRows );
	QHeaderView *header = Table3->horizontalHeader();
	header->setMovable(false);
	header->setClickable(false);
	header->setResizeMode(QHeaderView::Stretch);
	Table3->verticalHeader()->hide();
	Table3->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
	tabLayout->addWidget( Table3 );
	Layout2a = new QHBoxLayout;
	Layout2a->setMargin(0);
	Layout2a->setSpacing(5);
	QSpacerItem* spacer1 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
	Layout2a->addItem( spacer1 );
	DelB = new QPushButton( tr( "&Delete" ), tab );
	DelB->setEnabled(false);
	Layout2a->addWidget( DelB );
	QSpacerItem* spacer2 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
	Layout2a->addItem( spacer2 );
	tabLayout->addLayout( Layout2a );
	addTab( tab, tr( "Font &Substitutions" ) );

	tab3 = new QWidget( this );
	tab3Layout = new QHBoxLayout( tab3 );
	tab3Layout->setMargin(10);
	tab3Layout->setSpacing(5);
	// If we're being called for global application preferences, not document
	// preferences, we let the user customize font search paths. Because things
	// go rather badly if paths are changed/removed while a doc is open, the
	// control is also not displayed if there is a document open.
	if (!DocAvail && !ScCore->primaryMainWindow()->HaveDoc)
	{
		PathList = new QListWidget( tab3 );
		readPaths();
		PathList->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
		tab3Layout->addWidget( PathList );
		LayoutR = new QVBoxLayout;
		LayoutR->setMargin(0);
		LayoutR->setSpacing(5);
		ChangeB = new QPushButton( tr( "C&hange..." ), tab3 );
		LayoutR->addWidget( ChangeB );
		AddB = new QPushButton( tr( "A&dd..." ), tab3 );
		LayoutR->addWidget( AddB );
		RemoveB = new QPushButton( tr( "&Remove" ), tab3 );
		LayoutR->addWidget( RemoveB );
		QSpacerItem* spacer_2 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
		LayoutR->addItem( spacer_2 );
		tab3Layout->addLayout( LayoutR );
		ChangeB->setEnabled(false);
		RemoveB->setEnabled(false);
		connect(PathList, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(SelectPath(QListWidgetItem*)));
		connect(AddB, SIGNAL(clicked()), this, SLOT(AddPath()));
		connect(ChangeB, SIGNAL(clicked()), this, SLOT(ChangePath()));
		connect(RemoveB, SIGNAL(clicked()), this, SLOT(DelPath()));
	}
Example #28
0
VCSlider::VCSlider(QWidget* parent, Doc* doc, OutputMap* outputMap, InputMap* inputMap, MasterTimer* masterTimer)
    : VCWidget(parent, doc, outputMap, inputMap, masterTimer)
{
    /* Set the class name "VCSlider" as the object name as well */
    setObjectName(VCSlider::staticMetaObject.className());

    m_hbox = NULL;
    m_topLabel = NULL;
    m_slider = NULL;
    m_bottomLabel = NULL;
    m_tapButton = NULL;

    m_sliderMode = Bus;
    m_valueDisplayStyle = ExactValue;

    m_levelLowLimit = 0;
    m_levelHighLimit = UCHAR_MAX;

    m_bus = Bus::defaultFade();
    m_busLowLimit = KDefaultBusLowLimit;
    m_busHighLimit = KDefaultBusHighLimit;

    m_levelValue = 0;
    m_levelValueChanged = false;

    m_playbackFunction = Function::invalidId();
    m_playbackValue = 0;
    m_playbackValueChanged = false;

    m_time = NULL;

    setCaption(QString());
    setFrameStyle(KVCFrameStyleSunken);

    /* Main VBox */
    new QVBoxLayout(this);

    /* Top label */
    m_topLabel = new QLabel(this);
    layout()->addWidget(m_topLabel);
    m_topLabel->setAlignment(Qt::AlignHCenter);

    /* Slider's HBox |stretch|slider|stretch| */
    m_hbox = new QHBoxLayout();
    layout()->addItem(m_hbox);

    /* Put stretchable space before the slider (to its left side) */
    m_hbox->addStretch();

    /* The slider */
    m_slider = new QSlider(this);
    m_slider->setStyle(App::saneStyle());
    m_hbox->addWidget(m_slider);
    m_slider->setRange(KDefaultBusLowLimit * MasterTimer::frequency(),
                       KDefaultBusHighLimit * MasterTimer::frequency());
    m_slider->setPageStep(1);
    m_slider->setInvertedAppearance(false);
    connect(m_slider, SIGNAL(valueChanged(int)),
            this, SLOT(slotSliderMoved(int)));
    m_externalMovement = false;

    /* Put stretchable space after the slider (to its right side) */
    m_hbox->addStretch();

    /* Tap button */
    m_tapButton = new QPushButton(this);
    layout()->addWidget(m_tapButton);
    connect(m_tapButton, SIGNAL(clicked()),
            this, SLOT(slotTapButtonClicked()));
    m_time = new QTime();

    /* Bottom label */
    m_bottomLabel = new QLabel(this);
    layout()->addWidget(m_bottomLabel);
    m_bottomLabel->setAlignment(Qt::AlignCenter);
    m_bottomLabel->hide();

    setMinimumSize(VCSlider::defaultSize);
    resize(VCSlider::defaultSize);

    /* Initialize to bus mode by default */
    setInvertedAppearance(true);
    setBus(Bus::defaultFade());
    setSliderMode(Bus);

    /* Update the slider according to current mode */
    slotModeChanged(mode());

    /* Listen to fixture removals so that LevelChannels can be removed when
       they no longer point to an existing fixture->channel */
    connect(m_doc, SIGNAL(fixtureRemoved(quint32)),
            this, SLOT(slotFixtureRemoved(quint32)));
}
TTMpeg2MainWnd::TTMpeg2MainWnd( QWidget* parent, const char* name, Qt::WFlags fl )
  : Q3MainWindow( parent, name, fl )
			      //      image0( (const char **) image0_data )
{
  if ( !name )
    setName( "TTMpeg2MainWnd" );

  // images
  // ---------------------------------------------------------------------------
  TTCut::imgDownArrow  = new QPixmap( (const char**)downarrow_18_xpm );
  TTCut::imgUpArrow    = new QPixmap( (const char**)uparrow_18_xpm );
  TTCut::imgDelete     = new QPixmap( (const char**)cancel_18_xpm );
  TTCut::imgFileOpen24 = new QPixmap( (const char**)fileopen_24_xpm );
  TTCut::imgFileNew    = new QPixmap( (const char**)filenew_16_xpm );
  TTCut::imgFileOpen   = new QPixmap( (const char**)fileopen_16_xpm );
  TTCut::imgFileSave   = new QPixmap( (const char**)filesave_16_xpm );;
  TTCut::imgFileSaveAs = new QPixmap( (const char**)filesaveas_16_xpm );
  TTCut::imgSaveImage  = new QPixmap( (const char**)saveimage_16_xpm );
  TTCut::imgSettings   = new QPixmap( (const char**)settings_16_xpm );
  TTCut::imgSettings18 = new QPixmap( (const char**)settings_18_xpm );
  TTCut::imgExit       = new QPixmap( (const char**)exit_16_xpm );
  TTCut::imgPlay       = new QPixmap( (const char**)play_18_xpm );
  TTCut::imgStop       = new QPixmap( (const char**)stop_18_xpm );
  TTCut::imgSearch     = new QPixmap( (const char**)search_18_xpm );
  TTCut::imgChapter    = new QPixmap( (const char**)chapter_18_xpm );
  TTCut::imgPreview    = new QPixmap( (const char**)preview_18_xpm );
  TTCut::imgCutAV      = new QPixmap( (const char**)cutav_18_xpm );
  TTCut::imgCutAudio   = new QPixmap( (const char**)cutaudio_18_xpm );
  TTCut::imgGoTo       = new QPixmap( (const char**)goto_18_xpm );
  TTCut::imgMarker     = new QPixmap( (const char**)note_18_xpm );
  TTCut::imgClock      = new QPixmap( (const char**)clock_16_xpm );
  TTCut::imgApply      = new QPixmap( (const char**)apply_18_xpm );
  TTCut::imgAddToList  = new QPixmap( (const char**)addtolist_18_xpm );
  TTCut::imgFileClose  = new QPixmap( (const char**)fileclose_18_xpm );

  slider_update = true;

  // min widgets size
  // --------------------------------------------------------------------------
  setMinimumSize( QSize( 860, 480 ) );
  setMaximumSize( QSize( 1600, 1280 ) );

  // central widget
  // --------------------------------------------------------------------------
  setCentralWidget( new QWidget( this, "qt_central_widget" ) );


  // --------------------------------------------------------------------------
  // menu-bar
  // --------------------------------------------------------------------------

  // menu actions
  // --------------------------------------------------------------------------

  // file-menu
  fileOpenAction       = new QAction( this, "fileOpenAction" );
  fileOpenAction->setIconSet( QIcon( *(TTCut::imgFileOpen) ) );
  fileSettingsAction   = new QAction( this, "fileSettingsAction" );
  fileSettingsAction->setIconSet( QIcon( *(TTCut::imgSettings) ) );
  fileAnalyzeAction    = new QAction( this, "fileAnalyzeAction" );
  fileAnalyzeAction->setIconSet( QIcon( *(TTCut::imgPreview) ) );
  fileExitAction       = new QAction( this, "fileExitAction" );
  fileExitAction->setIconSet( QIcon( *(TTCut::imgExit) ) );

  // menubar
  MenuBar = new QMenuBar( this, "MenuBar" );
  
  //file-menu
  fileMenu = new Q3PopupMenu( this );
  fileOpenAction->addTo( fileMenu );
  fileAnalyzeAction->addTo( fileMenu );
  fileMenu->insertSeparator();
  fileSettingsAction->addTo( fileMenu );
  fileMenu->insertSeparator();
  fileExitAction->addTo( fileMenu );
  MenuBar->insertItem( QString("File"), fileMenu,   1 );
  

  // ---------------------------------------------------------------------------
  // tool-bar
  // ---------------------------------------------------------------------------
  toolBar = new Q3ToolBar( this, "ToolBar" );

  tbStartAnalyzing = new QToolButton( toolBar, "StartAnalyze" );
  tbStartAnalyzing->setIconSet( QIcon( *(TTCut::imgPreview) ) );

  // ---------------------------------------------------------------------------
  // status-bar
  // ---------------------------------------------------------------------------
  (void)statusBar();


  // central layout manager (grid 4x2)
  // ---------------------------------------------------------------------------
  TTMpeg2MainWndLayout = new QGridLayout( centralWidget(), 
					  4, 1, 11, 6, 
					  "TTMpeg2MainWndLayout"); 

  // open stream section
  // ---------------------------------------------------------------------------
  gbStreamName = new Q3GroupBox( centralWidget(), "gbStreamName" );
  gbStreamName->setColumnLayout(0, Qt::Vertical );
  gbStreamName->layout()->setSpacing( 6 );
  gbStreamName->layout()->setMargin( 11 );
  gbStreamNameLayout = new QGridLayout( gbStreamName->layout() );
  gbStreamNameLayout->setAlignment( Qt::AlignTop );
  
  leStreamName = new QLineEdit( gbStreamName, "leStreamName" );
  
  gbStreamNameLayout->addWidget( leStreamName, 0, 1 );
  
  pbOpenStream = new QPushButton( gbStreamName, "pbOpenStream" );
  pbOpenStream->setMinimumSize( QSize( 24, 24 ) );
  pbOpenStream->setMaximumSize( QSize( 24, 24 ) );
  pbOpenStream->setPixmap( (QPixmap)*(TTCut::imgFileOpen) );
  
  gbStreamNameLayout->addWidget( pbOpenStream, 0, 0 );
  TTMpeg2MainWndLayout->addMultiCellWidget( gbStreamName, 0, 0, 0, 1 );


  // stream info section
  // ---------------------------------------------------------------------------
  layout10 = new QHBoxLayout( 0, 0, 6, "layout10"); 
  layout9 = new QVBoxLayout( 0, 0, 6, "layout9"); 

  // buffer statistics
  gbBufferStatistics = new Q3GroupBox( centralWidget(), "gbBufferStatistics" );
  gbBufferStatistics->setColumnLayout(0, Qt::Vertical );
  gbBufferStatistics->layout()->setSpacing( 6 );
  gbBufferStatistics->layout()->setMargin( 11 );
  gbBufferStatisticsLayout = new QGridLayout( gbBufferStatistics->layout() );
  gbBufferStatisticsLayout->setAlignment( Qt::AlignTop );
  
  layout1 = new QVBoxLayout( 0, 0, 6, "layout1"); 

  slFileLength = new QLabel( gbBufferStatistics, "slFileLength" );
  layout1->addWidget( slFileLength );
  
  slReadOps = new QLabel( gbBufferStatistics, "slReadOps" );
  layout1->addWidget( slReadOps );
  
  slFillOps = new QLabel( gbBufferStatistics, "slFillOps" );
  layout1->addWidget( slFillOps );
  
  slReadTime = new QLabel( gbBufferStatistics, "slReadTime" );
  layout1->addWidget( slReadTime );
  
  gbBufferStatisticsLayout->addLayout( layout1, 0, 0 );
  
  layout2 = new QVBoxLayout( 0, 0, 6, "layout2"); 
  
  laFileLength = new QLabel( gbBufferStatistics, "laFileLength" );
  layout2->addWidget( laFileLength );
  
  laReadOps = new QLabel( gbBufferStatistics, "laReadOps" );
  layout2->addWidget( laReadOps );
  
  laFillOps = new QLabel( gbBufferStatistics, "laFillOps" );
  layout2->addWidget( laFillOps );
  
  laReadTime = new QLabel( gbBufferStatistics, "laReadTime" );
  layout2->addWidget( laReadTime );
  
  gbBufferStatisticsLayout->addLayout( layout2, 0, 1 );
  layout9->addWidget( gbBufferStatistics );

  // stream statistics
  gbStreamStatistics = new Q3GroupBox( centralWidget(), "gbStreamStatistics" );
  gbStreamStatistics->setColumnLayout(0, Qt::Vertical );
  gbStreamStatistics->layout()->setSpacing( 6 );
  gbStreamStatistics->layout()->setMargin( 11 );
  gbStreamStatisticsLayout = new QGridLayout( gbStreamStatistics->layout() );
  gbStreamStatisticsLayout->setAlignment( Qt::AlignTop );

  line1 = new Q3Frame( gbStreamStatistics, "line1" );
  line1->setFrameShape( Q3Frame::HLine );
  line1->setFrameShadow( Q3Frame::Sunken );
  line1->setFrameShape( Q3Frame::HLine );
  
  gbStreamStatisticsLayout->addMultiCellWidget( line1, 1, 1, 0, 1 );
  
  layout5 = new QVBoxLayout( 0, 0, 6, "layout5"); 
  
  slTotalFrames = new QLabel( gbStreamStatistics, "slTotalFrames" );
  layout5->addWidget( slTotalFrames );
  
  slIFrames = new QLabel( gbStreamStatistics, "slIFrames" );
  layout5->addWidget( slIFrames );
  
  slPFrames = new QLabel( gbStreamStatistics, "slPFrames" );
  layout5->addWidget( slPFrames );
  
  slBFrames = new QLabel( gbStreamStatistics, "slBFrames" );
  layout5->addWidget( slBFrames );
  
  gbStreamStatisticsLayout->addLayout( layout5, 0, 0 );
  
  layout4 = new QVBoxLayout( 0, 0, 6, "layout4"); 
  
  slSeqHeader = new QLabel( gbStreamStatistics, "slSeqHeader" );
  layout4->addWidget( slSeqHeader );
  
  slGOPHeader = new QLabel( gbStreamStatistics, "slGOPHeader" );
  layout4->addWidget( slGOPHeader );
  
  slPicHeader = new QLabel( gbStreamStatistics, "slPicHeader" );
  layout4->addWidget( slPicHeader );
  
  slSeqEndHeader = new QLabel( gbStreamStatistics, "slSeqEndHeader" );
  layout4->addWidget( slSeqEndHeader );
  
  gbStreamStatisticsLayout->addLayout( layout4, 2, 0 );
  
  layout6 = new QVBoxLayout( 0, 0, 6, "layout6"); 
  
  laSequence = new QLabel( gbStreamStatistics, "laSequence" );
  layout6->addWidget( laSequence );
  
  laGOP = new QLabel( gbStreamStatistics, "laGOP" );
  layout6->addWidget( laGOP );
  
  laPicture = new QLabel( gbStreamStatistics, "laPicture" );
  layout6->addWidget( laPicture );
  
  laSequenceEnd = new QLabel( gbStreamStatistics, "laSequenceEnd" );
  layout6->addWidget( laSequenceEnd );
  
  gbStreamStatisticsLayout->addLayout( layout6, 2, 1 );

  layout7 = new QVBoxLayout( 0, 0, 6, "layout7"); 

  laFramesTotal = new QLabel( gbStreamStatistics, "laFramesTotal" );
  layout7->addWidget( laFramesTotal );
  
  laIFrames = new QLabel( gbStreamStatistics, "laIFrames" );
  layout7->addWidget( laIFrames );
  
  laPFrames = new QLabel( gbStreamStatistics, "laPFrames" );
  layout7->addWidget( laPFrames );
  
  laBFrames = new QLabel( gbStreamStatistics, "laBFrames" );
  layout7->addWidget( laBFrames );
  
  gbStreamStatisticsLayout->addLayout( layout7, 0, 1 );
  layout9->addWidget( gbStreamStatistics );
  layout10->addLayout( layout9 );

  // list view stream info
  gbStreamInfo = new Q3GroupBox( centralWidget(), "gbStreamInfo" );
  gbStreamInfo->setColumnLayout(0, Qt::Vertical );
  gbStreamInfo->layout()->setSpacing( 6 );
  gbStreamInfo->layout()->setMargin( 11 );
  gbStreamInfoLayout = new QGridLayout( gbStreamInfo->layout() );
  gbStreamInfoLayout->setAlignment( Qt::AlignTop );
  
  lvStreamInfo = new Q3ListView( gbStreamInfo, "lvStreamInfo" );
  lvStreamInfo->addColumn( tr( "Header" ) );
  lvStreamInfo->addColumn( tr( "Offset" ) );
  lvStreamInfo->addColumn( tr( "Type" ) );
  lvStreamInfo->addColumn( tr( "Temp Ref." ) );
  lvStreamInfo->addColumn( tr( "S-Order" ) );
  lvStreamInfo->addColumn( tr( "D-Order" ) );
  lvStreamInfo->addColumn( tr( "Time-code" ) );

  lvStreamInfo->setSorting( 5, TRUE );

  gbStreamInfoLayout->addWidget( lvStreamInfo, 0, 0 );
  layout10->addWidget( gbStreamInfo );
  
  TTMpeg2MainWndLayout->addLayout( layout10, 1, 0 );
  
  // sequence info
  gbSequenceInfo = new Q3GroupBox( centralWidget(), "gbSequenceInfo" );
  gbSequenceInfo->setColumnLayout(0, Qt::Vertical );
  gbSequenceInfo->layout()->setSpacing( 6 );
  gbSequenceInfo->layout()->setMargin( 11 );
  gbSequenceInfoLayout = new QGridLayout( gbSequenceInfo->layout() );
  gbSequenceInfoLayout->setAlignment( Qt::AlignTop );
  
  layout19 = new QVBoxLayout( 0, 0, 6, "layout19"); 
  
  slBitrate = new QLabel( gbSequenceInfo, "slBitrate" );
  layout19->addWidget( slBitrate );
  
  slFramerate = new QLabel( gbSequenceInfo, "slFramerate" );
  layout19->addWidget( slFramerate );
  
  slWidth = new QLabel( gbSequenceInfo, "slWidth" );
  layout19->addWidget( slWidth );
  
  slHeight = new QLabel( gbSequenceInfo, "slHeight" );
  layout19->addWidget( slHeight );
  
  gbSequenceInfoLayout->addLayout( layout19, 0, 0 );
  
  layout20 = new QVBoxLayout( 0, 0, 6, "layout20"); 
   
  laSeqBitrate = new QLineEdit( gbSequenceInfo, "laSeqBitrate" );
  laSeqBitrate->setEnabled( FALSE );
  laSeqBitrate->setReadOnly( TRUE );
  layout20->addWidget( laSeqBitrate );
  
  laSeqFramerate = new QLineEdit( gbSequenceInfo, "laSeqFramerate" );
  laSeqFramerate->setEnabled( FALSE );
  laSeqFramerate->setReadOnly( TRUE );
  layout20->addWidget( laSeqFramerate );
  
  laSeqPicWidth = new QLineEdit( gbSequenceInfo, "laSeqPicWidth" );
  laSeqPicWidth->setEnabled( FALSE );
  laSeqPicWidth->setReadOnly( TRUE );
  layout20->addWidget( laSeqPicWidth );
  
  laSeqPicHeight = new QLineEdit( gbSequenceInfo, "laSeqPicHeight" );
  laSeqPicHeight->setEnabled( FALSE );
  laSeqPicHeight->setReadOnly( TRUE );
  layout20->addWidget( laSeqPicHeight );
  
  gbSequenceInfoLayout->addLayout( layout20, 0, 1 );
  
  TTMpeg2MainWndLayout->addWidget( gbSequenceInfo, 1, 1 );
  
  // scroll-bar
  // ---------------------------------------------------------------------------
  sbFrames = new QScrollBar( centralWidget(), "sbFrames" );
  sbFrames->setOrientation( Qt::Horizontal );
  
  TTMpeg2MainWndLayout->addMultiCellWidget( sbFrames, 2, 2, 0, 1 );
  
  // current frame info and navigation
  // ---------------------------------------------------------------------------
  frameInfo = new TTCurrentFrameInfo( centralWidget() , "FrameInfo" );

  TTMpeg2MainWndLayout->addMultiCellWidget( frameInfo, 3, 3, 0 ,1 );

  // ready
  languageChange();
  resize( QSize(963, 725).expandedTo(minimumSizeHint()) );
  //Qt4.0: clearWState( WState_Polished );

  // initialize some attributes
  // ---------------------------------------------------------------------------
  step_frame     = 0;
  step_order     = 0;
  is_stream_open = false;

  // show the video window
  // ---------------------------------------------------------------------------
  mpeg2_window = new TTMPEG2Window( 0 );
  mpeg2_window->show();
  mpeg2_window->resize( 720, 576 );

  // show the chart window
  // ---------------------------------------------------------------------------
  //chart_window = new TTFrameChart( 0, "CHARTWND", 420, 120 );
  //chart_window->show();

  // mpeg2 info window
  // ---------------------------------------------------------------------------
  //info_window = new TTMpeg2InfoView( 0, "INFOWND" );
  //info_window->show();

  // signals and slots connections
  // ---------------------------------------------------------------------------
  // file-menu
  connect(fileOpenAction,     SIGNAL( activated() ),   this, SLOT(fileOpen()));
  connect(fileAnalyzeAction,  SIGNAL( activated() ),   this, SLOT(fileAnalyze()));
  connect(fileSettingsAction, SIGNAL( activated() ),   this, SLOT(fileSettings()));
  connect(fileExitAction,     SIGNAL( activated() ),   this, SLOT(fileExit()));

  // tool-bar
  connect(tbStartAnalyzing, SIGNAL(clicked()), this, SLOT(fileAnalyze()));

  // open file button
  connect(pbOpenStream,       SIGNAL( clicked() ),     this,   SLOT( fileOpen()));

  // video position slider
  connect( sbFrames,  SIGNAL( valueChanged(int) ), this, SLOT( videoSliderChanged(int) ) );
  
  // current frame info / navigation
  connect(frameInfo,          SIGNAL(nextFrame()),     this, SLOT(nextFrameAction()));
  connect(frameInfo,          SIGNAL(prevFrame()),     this, SLOT(prevFrameAction()));
  connect(frameInfo,          SIGNAL(orderAnyFrame()), this, SLOT(orderAnyFrame()));
  connect(frameInfo,          SIGNAL(orderIFrame()),   this, SLOT(orderIFrame()));
  connect(frameInfo,          SIGNAL(orderPFrame()),   this, SLOT(orderPFrame()));
  connect(frameInfo,          SIGNAL(orderBFrame()),   this, SLOT(orderBFrame()));
  connect(frameInfo,          SIGNAL(orderDisplay()),  this, SLOT(orderDisplay()));
  connect(frameInfo,          SIGNAL(orderStream()),   this, SLOT(orderStream()));

}
Example #30
0
ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel *metaInfo, SettingsModel *settings, QWidget *parent)
:
	QDialog(parent),
	ui(new Ui::ProcessingDialog),
	//m_aacEncoder(SettingsModel::getAacEncoder()),
	m_systemTray(new QSystemTrayIcon(QIcon(":/icons/cd_go.png"), this)),
	m_settings(settings),
	m_metaInfo(metaInfo),
	m_shutdownFlag(shutdownFlag_None),
	m_diskObserver(NULL),
	m_cpuObserver(NULL),
	m_ramObserver(NULL),
	m_progressViewFilter(-1),
	m_firstShow(true)
{
	//Init the dialog, from the .ui file
	ui->setupUi(this);
	setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
	
	//Update header icon
	ui->label_headerIcon->setPixmap(lamexp_app_icon().pixmap(ui->label_headerIcon->size()));
	
	//Setup version info
	ui->label_versionInfo->setText(QString().sprintf("v%d.%02d %s (Build %d)", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build()));
	ui->label_versionInfo->installEventFilter(this);

	//Register meta type
	qRegisterMetaType<QUuid>("QUuid");

	//Center window in screen
	QRect desktopRect = QApplication::desktop()->screenGeometry();
	QRect thisRect = this->geometry();
	move((desktopRect.width() - thisRect.width()) / 2, (desktopRect.height() - thisRect.height()) / 2);
	setMinimumSize(thisRect.width(), thisRect.height());

	//Enable buttons
	connect(ui->button_AbortProcess, SIGNAL(clicked()), this, SLOT(abortEncoding()));
	
	//Init progress indicator
	m_progressIndicator = new QMovie(":/images/Working.gif");
	m_progressIndicator->setCacheMode(QMovie::CacheAll);
	m_progressIndicator->setSpeed(50);
	ui->label_headerWorking->setMovie(m_progressIndicator);
	ui->progressBar->setValue(0);

	//Init progress model
	m_progressModel = new ProgressModel();
	ui->view_log->setModel(m_progressModel);
	ui->view_log->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
	ui->view_log->verticalHeader()->hide();
	ui->view_log->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
	ui->view_log->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
	ui->view_log->viewport()->installEventFilter(this);
	connect(m_progressModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(progressModelChanged()));
	connect(m_progressModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), this, SLOT(progressModelChanged()));
	connect(m_progressModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(progressModelChanged()));
	connect(m_progressModel, SIGNAL(modelReset()), this, SLOT(progressModelChanged()));
	connect(ui->view_log, SIGNAL(activated(QModelIndex)), this, SLOT(logViewDoubleClicked(QModelIndex)));
	connect(ui->view_log->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(logViewSectionSizeChanged(int,int,int)));

	//Create context menu
	m_contextMenu = new QMenu();
	QAction *contextMenuDetailsAction = m_contextMenu->addAction(QIcon(":/icons/zoom.png"), tr("Show details for selected job"));
	QAction *contextMenuShowFileAction = m_contextMenu->addAction(QIcon(":/icons/folder_go.png"), tr("Browse Output File Location"));
	m_contextMenu->addSeparator();

	//Create "filter" context menu
	m_progressViewFilterGroup = new QActionGroup(this);
	QAction *contextMenuFilterAction[5] = {NULL, NULL, NULL, NULL, NULL};
	if(QMenu *filterMenu = m_contextMenu->addMenu(QIcon(":/icons/filter.png"), tr("Filter Log Items")))
	{
		contextMenuFilterAction[0] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobRunning), tr("Show Running Only"));
		contextMenuFilterAction[1] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobComplete), tr("Show Succeeded Only"));
		contextMenuFilterAction[2] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobFailed), tr("Show Failed Only"));
		contextMenuFilterAction[3] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobSkipped), tr("Show Skipped Only"));
		contextMenuFilterAction[4] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobState(-1)), tr("Show All Items"));
		if(QAction *act = contextMenuFilterAction[0]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobRunning); }
		if(QAction *act = contextMenuFilterAction[1]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobComplete); }
		if(QAction *act = contextMenuFilterAction[2]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobFailed); }
		if(QAction *act = contextMenuFilterAction[3]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobSkipped); }
		if(QAction *act = contextMenuFilterAction[4]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(-1); act->setChecked(true); }
	}

	//Create info label
	if(m_filterInfoLabel = new QLabel(ui->view_log))
	{
		m_filterInfoLabel->setFrameShape(QFrame::NoFrame);
		m_filterInfoLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
		m_filterInfoLabel->setUserData(0, new IntUserData(-1));
		SET_FONT_BOLD(m_filterInfoLabel, true);
		SET_TEXT_COLOR(m_filterInfoLabel, Qt::darkGray);
		m_filterInfoLabel->setContextMenuPolicy(Qt::CustomContextMenu);
		connect(m_filterInfoLabel, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
		m_filterInfoLabel->hide();
	}
	if(m_filterInfoLabelIcon = new QLabel(ui->view_log))
	{
		m_filterInfoLabelIcon->setFrameShape(QFrame::NoFrame);
		m_filterInfoLabelIcon->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
		m_filterInfoLabelIcon->setContextMenuPolicy(Qt::CustomContextMenu);
		const QIcon &ico = m_progressModel->getIcon(ProgressModel::JobState(-1));
		m_filterInfoLabelIcon->setPixmap(ico.pixmap(16, 16));
		connect(m_filterInfoLabelIcon, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
		m_filterInfoLabelIcon->hide();
	}

	//Connect context menu
	ui->view_log->setContextMenuPolicy(Qt::CustomContextMenu);
	connect(ui->view_log, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
	connect(contextMenuDetailsAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuDetailsActionTriggered()));
	connect(contextMenuShowFileAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuShowFileActionTriggered()));
	for(size_t i = 0; i < 5; i++)
	{
		if(contextMenuFilterAction[i]) connect(contextMenuFilterAction[i], SIGNAL(triggered(bool)), this, SLOT(contextMenuFilterActionTriggered()));
	}
	SET_FONT_BOLD(contextMenuDetailsAction, true);

	//Enque jobs
	if(fileListModel)
	{
		for(int i = 0; i < fileListModel->rowCount(); i++)
		{
			m_pendingJobs.append(fileListModel->getFile(fileListModel->index(i,0)));
		}
	}

	//Translate
	ui->label_headerStatus->setText(QString("<b>%1</b><br>%2").arg(tr("Encoding Files"), tr("Your files are being encoded, please be patient...")));
	
	//Enable system tray icon
	connect(m_systemTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(systemTrayActivated(QSystemTrayIcon::ActivationReason)));

	//Init other vars
	m_runningThreads = 0;
	m_currentFile = 0;
	m_allJobs.clear();
	m_succeededJobs.clear();
	m_failedJobs.clear();
	m_skippedJobs.clear();
	m_userAborted = false;
	m_forcedAbort = false;
	m_timerStart = 0I64;
}