Пример #1
0
QFrame* MainWindow::initStatusBarFrame(QWidget *parent)
{
    QFrame *frame = new QFrame(parent);
    QHBoxLayout *mainLayout = new QHBoxLayout(frame);

    filesCountLabel->setStyleSheet("QLabel {"
                                   "font: bold 12px \"Arial\";"
                                   "color: rgb(123, 123, 123);"
                                   "border: none;"
                                   "background: transparent;"
                                   "image: url(:/resources/files_count.png);"
                                   "image-position: left;"
                                   "}");

    frame->setFixedHeight(30);
    frame->setStyleSheet("QFrame {"
                         "background: qlineargradient(x1:0.5, y1:0, x2:0.5, y2:1,"
                         "stop:0 rgb(245, 245, 245),"
                         "stop:1 rgb(205, 205, 205));"
                         "border-top: 1px solid rgb(217, 217, 217);"
                         "}");

    mainLayout->setAlignment(Qt::AlignCenter);
    mainLayout->setMargin(0);
    mainLayout->addWidget(filesCountLabel);

    return frame;
}
ImportPrivKeyDialog::ImportPrivKeyDialog(QWidget* parent)
    : QDialog(parent)
    , ui(new Ui::ImportPrivKeyDialog)
{
    ui->setupUi(this);

    GUIUtil::setupPrivKeyWidget(ui->privKeyEdit, this);

    ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Ok"));
    ui->buttonBox->button(QDialogButtonBox::Ok)->setCursor(Qt::PointingHandCursor);
    ui->buttonBox->button(QDialogButtonBox::Ok)->setStyleSheet(GULDEN_DIALOG_CONFIRM_BUTTON_STYLE_NOMARGIN);
    ui->buttonBox->button(QDialogButtonBox::Reset)->setText(tr("Cancel"));
    ui->buttonBox->button(QDialogButtonBox::Reset)->setCursor(Qt::PointingHandCursor);
    ui->buttonBox->button(QDialogButtonBox::Reset)->setStyleSheet(GULDEN_DIALOG_CANCEL_BUTTON_STYLE_NOMARGIN);
    QObject::connect(ui->buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked()), this, SLOT(reject()));

    QFrame* horizontalLine = new QFrame(this);
    horizontalLine->setFrameStyle(QFrame::HLine);
    horizontalLine->setFixedHeight(1);
    horizontalLine->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    horizontalLine->setStyleSheet(GULDEN_DIALOG_HLINE_STYLE_NOMARGIN);
    ui->verticalLayout->insertWidget(1, horizontalLine);

    setMinimumSize(300, 200);
}
Пример #3
0
SketchMainHelpPrivate::SketchMainHelpPrivate (
		const QString &viewString,
		const QString &htmlText,
		SketchMainHelp *parent)
	: QFrame()
{
	setObjectName("sketchMainHelp"+viewString);
	m_parent = parent;

	QFrame *main = new QFrame(this);
	QHBoxLayout *mainLayout = new QHBoxLayout(main);

	QLabel *imageLabel = new QLabel(this);
	QLabel *imageLabelAux = new QLabel(imageLabel);
	imageLabelAux->setObjectName(QString("inviewHelpImage%1").arg(viewString));
	QPixmap pixmap(QString(":/resources/images/helpImage%1.png").arg(viewString));
	imageLabelAux->setPixmap(pixmap);
	imageLabel->setFixedWidth(pixmap.width());
	imageLabel->setFixedHeight(pixmap.height());
	imageLabelAux->setFixedWidth(pixmap.width());
	imageLabelAux->setFixedHeight(pixmap.height());

	ExpandingLabel *textLabel = new ExpandingLabel(this);
	textLabel->setLabelText(htmlText);
	textLabel->setFixedWidth(430 - 41 - pixmap.width());
	textLabel->allTextVisible();
	setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
	textLabel->setToolTip("");
	textLabel->setAlignment(Qt::AlignLeft);

	mainLayout->setSpacing(6);
	mainLayout->setMargin(2);
	mainLayout->addWidget(imageLabel);
	mainLayout->addWidget(textLabel);
	setFixedWidth(430);

	QVBoxLayout *layout = new QVBoxLayout(this);
	m_closeButton = new SketchMainHelpCloseButton(viewString,this);
	connect(m_closeButton, SIGNAL(clicked()), this, SLOT(doClose()));

	QFrame *bottomMargin = new QFrame(this);
	bottomMargin->setFixedHeight(m_closeButton->height());

	layout->addWidget(m_closeButton);
	layout->addWidget(main);
	layout->addWidget(bottomMargin);

	layout->setSpacing(0);
	layout->setMargin(2);

	m_shouldGetTransparent = false;
	//m_closeButton->doHide();

	QFile styleSheet(":/resources/styles/inviewhelp.qss");
    if (!styleSheet.open(QIODevice::ReadOnly)) {
		qWarning("Unable to open :/resources/styles/inviewhelp.qss");
	} else {
		setStyleSheet(styleSheet.readAll());
	}
}
Пример #4
0
KompareListViewFrame::KompareListViewFrame( bool isSource,
                                            ViewSettings* settings,
                                            KompareSplitter* parent,
                                            const char* name ):
	QFrame ( parent ),
	m_view ( isSource, settings, this, name ),
	m_label ( isSource?"Source":"Dest", this ),
	m_layout ( this )
{
	setSizePolicy ( QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored) );
	m_label.setSizePolicy ( QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed) );
	QFrame *bottomLine = new QFrame(this);
	bottomLine->setFrameShape(QFrame::HLine);
	bottomLine->setFrameShadow ( QFrame::Plain );
	bottomLine->setSizePolicy ( QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed) );
	bottomLine->setFixedHeight(1);
	m_label.setMargin(3);
	m_layout.setSpacing(0);
	m_layout.setMargin(0);
	m_layout.addWidget(&m_label);
	m_layout.addWidget(bottomLine);
	m_layout.addWidget(&m_view);

	connect( &m_view, SIGNAL(differenceClicked(const Diff2::Difference*)),
	         parent, SLOT(slotDifferenceClicked(const Diff2::Difference*)) );

	connect( parent, SIGNAL(scrollViewsToId(int)), &m_view, SLOT(scrollToId(int)) );
	connect( parent, SIGNAL(setXOffset(int)), &m_view, SLOT(setXOffset(int)) );
	connect( &m_view, SIGNAL(resized()), parent, SLOT(slotUpdateScrollBars()) );
}
Пример #5
0
QFrame* AddLineSeparator(QWidget* parent)
{
    QFrame* line = new QFrame(parent);
    line->setObjectName(QString::fromUtf8("line"));
    line->setFrameShape(QFrame::HLine);
    line->setFrameShadow(QFrame::Sunken);
    line->setFixedHeight(10);
    return line;
}
Пример #6
0
void Toolbar::addsep(void)
{
  layout->addSpacing(3);
  QFrame *frame = new QFrame(this);
  frame->setLineWidth(1);
  frame->setMidLineWidth(0);
  frame->setFrameStyle(QFrame::VLine|QFrame::Sunken);
  frame->setFixedHeight(height()-4);
  layout->addWidget(frame);
  layout->addSpacing(3);
}
Пример #7
0
KPropDlg::KPropDlg( int dlgtype, int buttons, const char *title, QWidget *parent, const char *name, bool modal )
	: QDialog( parent, name, modal )
{
	// Set window props
	setCaption( title );

	// Set some characteristics
	PageList = new QList<QWidget>;
	DlgType = dlgtype;
	Buttons = buttons;
	TreeWidth = 150;
	ActivePage = 0;

	QFontMetrics fm( font() );
	//	int bbsize = fm.height() + fm.ascent() + 32;

	if( DlgType == TREE )
	{
		KPanner *panner = new KPanner( this );
		panner->setSeparator( 30 );
		TreeList = new KTreeList( panner->child0() );
		(new QHBoxLayout( panner->child0() ) )->addWidget( TreeList );
		connect(TreeList, SIGNAL(highlighted(int)),this,SLOT(showPage(int)));

		rpane = panner->child1() ;
		VLayout = new QVBoxLayout( rpane );

		// Page title label
		Title = new QLabel( "Unnamed Dialog", rpane );
		Title->setFrameStyle( QFrame::Panel|QFrame::Raised );
		Title->setFixedHeight( 20 );
		Title->setText( title );
		VLayout->addWidget( Title );

		PageFrame = new QFrame( rpane );
		PageFrame->setFrameStyle( QFrame::Panel|QFrame::Raised);
		PageFrame->installEventFilter( this );
		VLayout->addWidget( PageFrame );

		ButtonWidget = new QLabel( this );
		ButtonLayout = new QVBoxLayout( this );
		ButtonLayout->addWidget( panner, 0, AlignRight );
		QFrame *hline = new QFrame(this);
		hline->setFrameStyle(QFrame::Sunken|QFrame::HLine);
		hline->setFixedHeight(hline->sizeHint().height());
		//	hline->setMinimumWidth(hline->sizeHint().width());
		ButtonLayout->addWidget( hline );
		ButtonLayout->addWidget( ButtonWidget, 0, AlignRight );


	}
Пример #8
0
QFrame* MainWindow::initFilesFrame(QWidget *parent)
{
    QFrame *frame = new QFrame(parent);

    //QAbstractButton *addFilesButton = createIconButton(QString(":/resources/add_files_button%1.png"), "Add Files", frame);
    QAbstractButton *addFolderButton = createIconButton(QString(":/resources/add_folder_button%1.png"), "", frame);
    QAbstractButton *resetButton = createIconButton(QString(":/resources/reset_button%1.png"), "", frame);
    QAbstractButton *renameButton = createIconButton(QString(":/resources/rename_button%1.png"), "", frame);

    QHBoxLayout *layout = new QHBoxLayout(frame);

    frame->setFixedHeight(56);

    //addFolderButton->setFixedWidth(175);
    //resetButton->setFixedWidth(125);
    //renameButton->setFixedWidth(85);

    frame->setStyleSheet("QFrame {"
                             "background: qlineargradient(x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgb(60, 60, 60), stop:1 rgb(60, 60, 60));"
                             //"border-bottom: 1px solid rgb(198, 198, 198);"
                             "image: url(:/resources/frame_center.png);"
                         "}"
                         "QAbstractButton {"
                             "background: transparent;"
                             "font: bold 13px \"Arial\";"
                             "color: rgb(58, 58, 58);"
                         "}");

    layout->setContentsMargins(0, 2, 0, 2);
    layout->setSpacing(90);
    layout->setAlignment(Qt::AlignCenter);
    //layout->addWidget(addFilesButton);
    layout->addWidget(addFolderButton);
    layout->addWidget(resetButton);
    layout->addWidget(renameButton);

    //connect(addFilesButton, &QPushButton::clicked, this, [=](){ filesList->addFiles(QFileDialog::getOpenFileNames(this, "Select Files")); });
    connect(addFolderButton, &QPushButton::clicked, this, [=](){ filesList->addFolder(QFileDialog::getExistingDirectory(this, "Select Directory")); });
    connect(resetButton, SIGNAL(clicked()), filesList, SLOT(reset()));
    connect(renameButton, SIGNAL(clicked()), filesList, SLOT(renameFiles()));

    return frame;
}
Пример #9
0
QFrame* MainWindow::initRenameFrame(QWidget *parent)
{
    QFrame *frame = new QFrame(parent);

    QAbstractButton *copyDownButton = createIconButton(QString(":/resources/copy_down_button%1.png"), "Copy Down", frame);
    QCheckBox *autoRenameBox = new QCheckBox("Auto Rename", frame);

    QHBoxLayout *layout = new QHBoxLayout(frame);

    frame->setFixedHeight(36);
    frame->setStyleSheet("QFrame {"
                             "background: qlineargradient(x1:0.5, y1:0, x2:0.5, y2:0.6, x3:0.5, y3:1,"
                                                          "stop:0 rgb(245, 245, 245),"
                                                          "stop:0.6 rgb(236, 236, 236),"
                                                          "stop:1 rgb(220, 220, 220));"
                             "border-bottom: 1px solid rgb(185, 185, 185);"
                         "}"
                         "QCheckBox::indicator:unchecked { image: url(:/resources/check_box_unchecked.png); }"
                         "QCheckBox::indicator:unchecked:pressed { image: url(:/resources/check_box_unchecked_pressed.png); }"
                         "QCheckBox::indicator:checked { image: url(:/resources/check_box_checked.png); }"
                         "QCheckBox::indicator:checked:pressed { image: url(:/resources/check_box_checked_pressed.png); }"
                         "QAbstractButton {"
                             "background: transparent;"
                             "font: bold 11px \"Arial\";"
                             "color: rgb(58, 58, 58);"
                         "}");

    autoRenameBox->setCursor(Qt::PointingHandCursor);

    layout->setContentsMargins(0, 2, 0, 2);
    layout->setSpacing(20);
    layout->setAlignment(Qt::AlignCenter);
    layout->addWidget(copyDownButton);
    layout->addWidget(autoRenameBox);

    connect(copyDownButton, SIGNAL(clicked()), filesListWidget, SLOT(copyDown()));
    connect(autoRenameBox, SIGNAL(toggled(bool)), filesList, SLOT(setAutoRename(bool)));

    return frame;
}
Пример #10
0
ZLQtDialog::ZLQtDialog(QWidget *parent, const ZLResource &resource) : ZBaseDialog(parent, 0, true), myButtonNumber(0) {
	QFont f(qApp->font());
	f.setPointSize(15);
	setFont(f);

	QVBoxLayout *layout = new QVBoxLayout(this);
	QWidget *widget = new QVBox(this);
	layout->add(widget);
	
	QFrame *frmTitle = new QFrame(widget);
	frmTitle->setFixedHeight(25);
	QHBoxLayout *hblTitle = new QHBoxLayout(frmTitle);
	QLabel *lblTitle = new QLabel(::qtString("  " + resource[ZLDialogManager::DIALOG_TITLE].value()), frmTitle);
	hblTitle->addWidget(lblTitle);
	UTIL_Graph::makeTitle(lblTitle, 1);
	
	myTab = new ZLQtDialogContent(widget, resource);

	myButtonGroup = new QButtonGroup(this);
	layout->add(myButtonGroup);

	myButtonLayout = new QGridLayout(myButtonGroup, 1, 0, 0, 0);
}
Пример #11
0
QFrame * newLineWidget(const bool &pHorizontal, const QColor &pColor,
                       QWidget *pParent)
{
    // Create and return a 'real' line widget, i.e. one which is 1 pixel wide,
    // using a QFrame widget

    QFrame *res = new QFrame(pParent);

    res->setStyleSheet(QString("QFrame {"
                               "    border: 1px solid rgb(%1, %2, %3);"
                               "}").arg(QString::number(pColor.red()),
                                        QString::number(pColor.green()),
                                        QString::number(pColor.blue())));

    if (pHorizontal) {
        res->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
        res->setFixedHeight(1);
    } else {
        res->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
        res->setFixedWidth(1);
    }

    return res;
}
Пример #12
0
//
// Constructor
//                                                                  
MsgDialog::MsgDialog(QWidget *parent, const char *name, QStringList &list)
// : QDialog(parent, name)
 : QWidget(parent, name)
{
#ifdef DEBUGMSG
  qDebug("MsgDialog() '%s' List passed by ref with %d elements", 
       name, list.count());
#endif

   m_bScrollLock = FALSE;
   m_nButtons = 0;
   m_nIndent = 5;   // num of spaces to indent wrapped lines
   m_nLockIndex = 0;
   m_nIndex = 0;
   m_bUseIndexing = FALSE;
   m_bShowType = TRUE;
   m_nShown = 0;
   m_nEditItem = -1;
   m_bAdditiveFilter = FALSE;

#if 0
   m_pMsgTypeCheckBox = 0;
   m_pButtonsPanel = 0;
   m_pEdit = 0;
   m_pStatusBar = 0;
   m_pStatusBarLock = 0;
   m_pStatusBarMsgcount = 0;
   m_pStatusBarTotMsgcount = 0;
   m_pStatusBarFilter = 0;
   m_pButtonsLayout = 0;
   m_pMenu = 0;
   m_pStringList = 0;
#endif

//  Anyone want to explain to me why ShowEQ segfaults upon exit when I
//  uncomment out the following line.  This baffles me.... it acts like 
//  it causes something to get destroyed when it's not supposed to be
//     - Maerlyn
//   m_pButtonOver = 0;

   // use the shared list given to us
   m_pStringList = &list;

   // set Title
   setCaption(QString(name));

   // install event filter to catch right clicks to add buttons 
   installEventFilter(this);
   
   // top-level layout; a vertical box to contain all widgets and sublayouts
   QBoxLayout *topLayout = new QVBoxLayout(this);
  
   // Make an hbox that will hold the textbox and the row of filterbuttons
   QBoxLayout *middleLayout = new QHBoxLayout(topLayout);
  
   // add the edit
//   m_pEdit = new QMultiLineEdit(this, "edit"); 
   m_pEdit = new MyEdit(this, "edit"); 
   m_pEdit->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   m_pEdit->setReadOnly(TRUE);
   m_pEdit->setFont(QFont("Helvetica", 10));
   middleLayout->addWidget(m_pEdit);
  
   // add a vertical box to hold the button layout and the stretch 
   QBoxLayout *rightLayout = new QVBoxLayout(middleLayout);
  
   // add a vertical box to hold the filter buttons
   m_pButtonsPanel = new QWidget(this, "buttonPanel");
   rightLayout->addWidget(m_pButtonsPanel);
   m_pButtonsLayout = new QVBoxLayout(m_pButtonsPanel);
  
   // Make an hbox that will hold the tools 
   QBoxLayout *tools = new QHBoxLayout(m_pButtonsLayout);

   // Make an bbox that will hold the right tools 
   QBoxLayout *righttools = new QVBoxLayout(tools);

   // Add an 'additive' vs 'subtractive checkbox
   m_pAdditiveCheckBox = new QCheckBox("Additive", m_pButtonsPanel);
   m_pAdditiveCheckBox->setChecked(isAdditive());
   connect(m_pAdditiveCheckBox, SIGNAL (toggled(bool)), 
                this, SLOT (setAdditive(bool)));
   righttools->addWidget(m_pAdditiveCheckBox);
  
   // Add a 'scroll-lock' checkbox
   QCheckBox *pScrollLockCheckBox= new QCheckBox("Lock", m_pButtonsPanel);
   pScrollLockCheckBox->setChecked(FALSE);
   connect(pScrollLockCheckBox, SIGNAL (toggled(bool)),
                this, SLOT (scrollLock(bool)));
   righttools->addWidget(pScrollLockCheckBox);

   // Add a 'msg type' checkbox
   m_pMsgTypeCheckBox = new QCheckBox("Msg Type", m_pButtonsPanel);
   m_pMsgTypeCheckBox->setChecked(m_bShowType);
   connect(m_pMsgTypeCheckBox, SIGNAL (toggled(bool)),
                this, SLOT (showMsgType(bool)));
   righttools->addWidget(m_pMsgTypeCheckBox);

   // Add a decrorative frame seperator
   QFrame *frame = new QFrame(m_pButtonsPanel, "seperator");
   frame->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   frame->setFixedHeight(2);
   m_pButtonsLayout->addWidget(frame);
   
   // 
   // Status Bar
   //
   // create a label to look like a status bar
   QBoxLayout *statusLayout = new QHBoxLayout(topLayout);
   m_pStatusBarFilter = new QLabel(this);
   m_pStatusBarFilter->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   statusLayout->addWidget(m_pStatusBarFilter, 4);
   m_pStatusBarMsgcount = new QLabel(this);
   m_pStatusBarMsgcount->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   statusLayout->addWidget(m_pStatusBarMsgcount, 1);
   m_pStatusBarTotMsgcount = new QLabel(this);
   m_pStatusBarTotMsgcount->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   statusLayout->addWidget(m_pStatusBarTotMsgcount, 1);
   m_pStatusBarLock = new QLabel(this);
   m_pStatusBarLock->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   statusLayout->addWidget(m_pStatusBarLock, 1);
  

#if 0
   // Add some default filter buttons
   MyButton *but;
 
   for (int i = 0; i < 5; i++)
   {
      char temp[15];
      sprintf(temp, "Empty%d", i);
      QString name(temp);
      QString filter(temp);
      QString color("Black");
      newButton(name, filter, color, FALSE);
   } 
#endif

   // Add an empty widget to fill the space and stretch when resized
   rightLayout->addStretch(10);
  
   // Add popup menu
   m_pMenu = new QPopupMenu(this, "popup");
   m_pMenu->insertItem("&Add Button", this, SLOT(addButton()));
   m_pMenu->insertSeparator();
   m_pMenu->insertItem("&Toggle Controls", this, SLOT(toggleControls()));
   connect(m_pMenu, SIGNAL (aboutToShow(void)), 
              this, SLOT (menuAboutToShow(void)));
  
   // refresh the messages 
   refresh();
  
} // end constructor
Пример #13
0
MainWindow::MainWindow(DVRServerRepository *serverRepository, QWidget *parent)
    : QMainWindow(parent), m_serverRepository(serverRepository), m_trayIcon(0)
{
    Q_ASSERT(m_serverRepository);

    bcApp->mainWindow = this;
    connect(bcApp->eventDownloadManager(), SIGNAL(eventVideoDownloadAdded(EventVideoDownload*)),
            this, SLOT(showDownloadsWindow()));

    setUnifiedTitleAndToolBarOnMac(true);
	resize(1100, 750);
    createMenu();
    updateTrayIcon();
    setObjectName("MainWindow");

    statusBar()->addPermanentWidget(new StatusBandwidthWidget(statusBar()));
    statusBar()->addWidget(new StatusBarServerAlert(m_serverRepository, statusBar()));

#ifdef Q_OS_MAC
    statusBar()->setSizeGripEnabled(false);
    if (style()->inherits("QMacStyle"))
        statusBar()->setFixedHeight(24);
#endif

    /* Experimental toolbar */
    m_mainToolbar = new QToolBar(tr("Main"));
    m_mainToolbar->setMovable(false);
    m_mainToolbar->setIconSize(QSize(16, 16));
    m_mainToolbar->addAction(QIcon(QLatin1String(":/icons/cassette.png")), tr("Events"), this, SLOT(showEventsWindow()));
	m_expandAllServersAction = m_mainToolbar->addAction(QIcon(QLatin1String(":/icons/expand-all.png")), tr("Expand All Servers"));
	m_collapseAllServersAction = m_mainToolbar->addAction(QIcon(QLatin1String(":/icons/collapse-all.png")), tr("Collapse All Servers"));
    addToolBar(Qt::TopToolBarArea, m_mainToolbar);

    /* Splitters */
    m_leftSplit = new MacSplitter(Qt::Horizontal);
    m_centerSplit = new MacSplitter(Qt::Vertical);

    /* Live view */
    m_liveView = new LiveViewWindow(serverRepository, this);

    /* Recent events */
    QWidget *eventsWidget = createRecentEvents();

    /* Layouts */
    m_leftSplit->addWidget(createSourcesList());
    m_leftSplit->addWidget(m_centerSplit);
    m_leftSplit->setStretchFactor(1, 1);
    m_leftSplit->setCollapsible(0, false);
    m_leftSplit->setCollapsible(1, false);

    m_centerSplit->addWidget(m_liveView);
    m_centerSplit->addWidget(eventsWidget);
    m_centerSplit->setStretchFactor(0, 1);
    m_centerSplit->setCollapsible(0, false);
    m_centerSplit->setCollapsible(1, false);

    /* Set center widget */
    QWidget *center = new QWidget;
    QBoxLayout *centerLayout = new QVBoxLayout(center);
    centerLayout->setMargin(0);
    centerLayout->setSpacing(0);
    centerLayout->addWidget(m_leftSplit, 1);
    setCentralWidget(center);

#ifdef Q_OS_WIN
    /* There is no top border on the statusbar on Windows, and we need one. */
    if (style()->inherits("QWindowsStyle"))
    {
        QFrame *line = new QFrame;
        line->setFrameStyle(QFrame::Plain | QFrame::HLine);
        QPalette p = line->palette();
        p.setColor(QPalette::WindowText, QColor(171, 175, 183));
        line->setPalette(p);
        line->setFixedHeight(1);
        centerLayout->addWidget(line);
    }
#endif

    QSettings settings;
    bcApp->liveView->setBandwidthMode(settings.value(QLatin1String("ui/liveview/bandwidthMode")).toInt());
    restoreGeometry(settings.value(QLatin1String("ui/main/geometry")).toByteArray());
    if (!m_centerSplit->restoreState(settings.value(QLatin1String("ui/main/centerSplit")).toByteArray()))
    {
        m_centerSplit->setSizes(QList<int>() << 1000 << 130);
    }
    if (!m_leftSplit->restoreState(settings.value(QLatin1String("ui/main/leftSplit")).toByteArray()))
    {
#ifdef Q_OS_MAC
        m_leftSplit->setSizes(QList<int>() << 210 << 1000);
#else
        m_leftSplit->setSizes(QList<int>() << 190 << 1000);
#endif
    }

    m_leftSplit->setHandleWidth(2);
    m_centerSplit->setHandleWidth(2);

    QString lastLayout = settings.value(QLatin1String("ui/cameraArea/lastLayout"), tr("Default")).toString();
    m_liveView->setLayout(lastLayout);

    connect(m_liveView, SIGNAL(layoutChanged(QString)), SLOT(liveViewLayoutChanged(QString)));
    connect(m_leftSplit, SIGNAL(splitterMoved(int,int)), SLOT(updateToolbarWidth()));
    updateToolbarWidth();

    connect(bcApp, SIGNAL(sslConfirmRequired(DVRServer*,QList<QSslError>,QSslConfiguration)),
            SLOT(sslConfirmRequired(DVRServer*,QList<QSslError>,QSslConfiguration)));
    connect(bcApp, SIGNAL(queryLivePaused()), SLOT(queryLivePaused()));
    connect(m_serverRepository, SIGNAL(serverAdded(DVRServer*)), SLOT(onServerAdded(DVRServer*)));

    foreach (DVRServer *s, m_serverRepository->servers())
        onServerAdded(s);

    connect(qApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));

    m_sourcesList->setFocus(Qt::OtherFocusReason);

    connect(m_expandAllServersAction, SIGNAL(triggered()), m_sourcesList, SLOT(expandAll()));
    connect(m_collapseAllServersAction, SIGNAL(triggered()), m_sourcesList, SLOT(collapseAll()));

    retranslateUI();

    if (settings.value(QLatin1String("ui/saveSession"), false).toBool())
        m_liveView->restoreSession();
}
Пример #14
0
//
// Constructor
//                                                                  
MsgDialog::MsgDialog(QWidget *parent, const char *name, 
		     const QString& prefName, QStringList &list)
  : SEQWindow(prefName, name, parent, name)
{
#ifdef DEBUGMSG
  qDebug("MsgDialog() '%s' List passed by ref with %d elements", 
       name, list.count());
#endif

   m_bScrollLock = FALSE;
   m_nButtons = 0;
   m_nIndent = 5;   // num of spaces to indent wrapped lines
   m_nLockIndex = 0;
   m_nIndex = 0;
   m_bUseIndexing = FALSE;
   m_bShowType = TRUE;
   m_nShown = 0;
   m_nEditItem = -1;
   m_nDeleteItem = -1;
   m_bAdditiveFilter = FALSE;
   m_pButtonOver = NULL;
   m_buttonList.setAutoDelete(false);

   // use the shared list given to us
   m_pStringList = &list;

   // install event filter to catch right clicks to add buttons 
   installEventFilter(this);
   
   // top-level layout; a vertical box to contain all widgets and sublayouts
   QBoxLayout *topLayout = new QVBoxLayout(this);
  
   // Make an hbox that will hold the textbox and the row of filterbuttons
   QBoxLayout *middleLayout = new QHBoxLayout(topLayout);
  
   // add the edit
   m_pEdit = new MyEdit(this, "edit"); 
   m_pEdit->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   m_pEdit->setReadOnly(TRUE);
   m_pEdit->setWordWrap(QMultiLineEdit::WidgetWidth);
   m_pEdit->setWrapPolicy(QMultiLineEdit::AtWhiteSpace);
   middleLayout->addWidget(m_pEdit);
  
   // add a vertical box to hold the button layout and the stretch 
   QBoxLayout *rightLayout = new QVBoxLayout(middleLayout);
  
   // add a vertical box to hold the filter buttons
   m_pButtonsPanel = new QWidget(this, "buttonPanel");
   rightLayout->addWidget(m_pButtonsPanel);
   m_pButtonsLayout = new QVBoxLayout(m_pButtonsPanel);
  
   // Make an hbox that will hold the tools 
   QBoxLayout *tools = new QHBoxLayout(m_pButtonsLayout);

   // Make an bbox that will hold the right tools 
   QBoxLayout *righttools = new QVBoxLayout(tools);

   // Add an 'additive' vs 'subtractive checkbox
   m_pAdditiveCheckBox = new QCheckBox("Additive", m_pButtonsPanel);
   m_pAdditiveCheckBox->setChecked(isAdditive());
   connect(m_pAdditiveCheckBox, SIGNAL (toggled(bool)), 
                this, SLOT (setAdditive(bool)));
   righttools->addWidget(m_pAdditiveCheckBox);
  
   // Add a 'scroll-lock' checkbox
   QCheckBox *pScrollLockCheckBox= new QCheckBox("Lock", m_pButtonsPanel);
   pScrollLockCheckBox->setChecked(FALSE);
   connect(pScrollLockCheckBox, SIGNAL (toggled(bool)),
                this, SLOT (scrollLock(bool)));
   righttools->addWidget(pScrollLockCheckBox);

   // Add a 'msg type' checkbox
   m_pMsgTypeCheckBox = new QCheckBox("Msg Type", m_pButtonsPanel);
   m_pMsgTypeCheckBox->setChecked(m_bShowType);
   connect(m_pMsgTypeCheckBox, SIGNAL (toggled(bool)),
                this, SLOT (showMsgType(bool)));
   righttools->addWidget(m_pMsgTypeCheckBox);

   // Add a decrorative frame seperator
   QFrame *frame = new QFrame(m_pButtonsPanel, "seperator");
   frame->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   frame->setFixedHeight(2);
   m_pButtonsLayout->addWidget(frame);
   
   // 
   // Status Bar
   //
   // create a label to look like a status bar
   QBoxLayout *statusLayout = new QHBoxLayout(topLayout);
   m_pStatusBarFilter = new QLabel(this);
   m_pStatusBarFilter->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   statusLayout->addWidget(m_pStatusBarFilter, 4);
   m_pStatusBarMsgcount = new QLabel(this);
   m_pStatusBarMsgcount->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   statusLayout->addWidget(m_pStatusBarMsgcount, 1);
   m_pStatusBarTotMsgcount = new QLabel(this);
   m_pStatusBarTotMsgcount->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   statusLayout->addWidget(m_pStatusBarTotMsgcount, 1);
   m_pStatusBarLock = new QLabel(this);
   m_pStatusBarLock->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   statusLayout->addWidget(m_pStatusBarLock, 1);
  
   // Add an empty widget to fill the space and stretch when resized
   rightLayout->addStretch(10);
  
   // Add popup menu
   m_pMenu = new QPopupMenu(this, "popup");
   m_pMenu->insertItem("&Add Button", this, SLOT(addButton()));
   m_pMenu->insertSeparator();
   m_pMenu->insertItem("&Toggle Controls", this, SLOT(toggleControls()));
   connect(m_pMenu, SIGNAL (aboutToShow(void)), 
              this, SLOT (menuAboutToShow(void)));

   // load the preferences
   load();

   // refresh the messages 
   refresh();
  
} // end constructor
Пример #15
0
void LayerControlWidgetBase::initUi(bool hasContent, bool showRemove)
{
  // object name for custom stylesheets
  setObjectName("oeItem");

  // create the primary vertical layout
  _primaryLayout = new QVBoxLayout;
  _primaryLayout->setSpacing(0);
  _primaryLayout->setContentsMargins(0, 0, 0, 0);
  setLayout(_primaryLayout);


  //create drop decoration box
  _dropBox = new QFrame;
  QVBoxLayout* dbLayout = new QVBoxLayout();
  dbLayout->setSpacing(0);
  dbLayout->setContentsMargins(0, 0, 0, 0);
  _dropBox->setLayout(dbLayout);

  QFrame* dropBoxInternal = new QFrame();
  dropBoxInternal->setFixedHeight(40);
  dropBoxInternal->setObjectName("oeDropTarget");
  dbLayout->addWidget(dropBoxInternal);
  dbLayout->addSpacing(4);

  QGraphicsOpacityEffect* dbEffect = new QGraphicsOpacityEffect(_dropBox);
  dbEffect->setOpacity(0.35);
  _dropBox->setGraphicsEffect(dbEffect);
  _dropBox->setVisible(false);
  _primaryLayout->addWidget(_dropBox);


  // create the header boxes and layouts
  _headerBox = new QFrame;
  _headerBoxLayout = new QHBoxLayout;
  //_headerBoxLayout->setSpacing(4);
  //_headerBoxLayout->setContentsMargins(2, 2, 2, 2);
  _headerBox->setLayout(_headerBoxLayout);

  _headerTitleBox = new QFrame;
  _headerTitleBoxLayout = new QHBoxLayout;
  _headerTitleBoxLayout->setSpacing(4);
  _headerTitleBoxLayout->setContentsMargins(2, 2, 2, 2);
  _headerTitleBox->setLayout(_headerTitleBoxLayout);
  _headerBoxLayout->addWidget(_headerTitleBox);

  _headerBoxLayout->addStretch();

  _headerButtonBox = new QFrame;
  _headerButtonBoxLayout = new QHBoxLayout;
  //_headerButtonBoxLayout->setSpacing(4);
  _headerButtonBoxLayout->setContentsMargins(2, 2, 2, 2);
  _headerButtonBox->setLayout(_headerButtonBoxLayout);
  _headerBoxLayout->addWidget(_headerButtonBox);

  if (showRemove)
  {
    // add remove button to the header button box
    _removeButton = new QPushButton(QIcon(":/images/close.png"), tr(""));
    _removeButton->setFlat(true);
    _removeButton->setMaximumSize(16, 16);
    _headerButtonBoxLayout->addWidget(_removeButton);

    connect(_removeButton, SIGNAL(clicked(bool)), this, SLOT(onRemoveClicked(bool)));
  }

  _primaryLayout->addWidget(_headerBox);


  // create the content box and layout
  if (hasContent)
  {
    _headerBox->setObjectName("oeItemHeader");

    _contentBox = new QFrame();
    _contentBoxLayout = new QHBoxLayout;
    _contentBoxLayout->setContentsMargins(4, 4, 4, 4);
    _contentBox->setLayout(_contentBoxLayout);
    _primaryLayout->addWidget(_contentBox);
  }

  setAcceptDrops(true); 
}
Пример #16
0
SplitterGUI::SplitterGUI(QWidget* parent,  QUrl fileURL, QUrl defaultDir) :
    QDialog(parent),
    userDefinedSize(0x100000), lastSelectedDevice(-1),
    division(1)
{
    setModal(true);

    QGridLayout *grid = new QGridLayout(this);
    grid->setSpacing(6);
    grid->setContentsMargins(11, 11, 11, 11);

    QLabel *splitterLabel = new QLabel(this);
    splitterLabel->setText(i18n("Split the file %1 to folder:", fileURL.toDisplayString(QUrl::PreferLocalFile)));
    splitterLabel->setMinimumWidth(400);
    grid->addWidget(splitterLabel, 0 , 0);

    urlReq = new KUrlRequester(this);
    urlReq->setUrl(defaultDir);
    urlReq->setMode(KFile::Directory);
    grid->addWidget(urlReq, 1 , 0);

    QWidget *splitSizeLine = new QWidget(this);
    QHBoxLayout * splitSizeLineLayout = new QHBoxLayout;
    splitSizeLineLayout->setContentsMargins(0, 0, 0, 0);
    splitSizeLine->setLayout(splitSizeLineLayout);

    deviceCombo = new QComboBox(splitSizeLine);
    for (int i = 0; i != predefinedDevices().count(); i++)
        deviceCombo->addItem(predefinedDevices()[i].name);
    deviceCombo->addItem(i18n("User Defined"));
    splitSizeLineLayout->addWidget(deviceCombo);

    QLabel *spacer = new QLabel(splitSizeLine);
    spacer->setText(" ");
    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    splitSizeLineLayout->addWidget(spacer);

    QLabel *bytesPerFile = new QLabel(splitSizeLine);
    bytesPerFile->setText(i18n("Max file size:"));
    splitSizeLineLayout->addWidget(bytesPerFile);

    spinBox = new QDoubleSpinBox(splitSizeLine);
    spinBox->setMaximum(9999999999.0);
    spinBox->setMinimumWidth(85);
    spinBox->setEnabled(false);
    splitSizeLineLayout->addWidget(spinBox);

    sizeCombo = new QComboBox(splitSizeLine);
    sizeCombo->addItem(i18n("Byte"));
    sizeCombo->addItem(i18n("kByte"));
    sizeCombo->addItem(i18n("MByte"));
    sizeCombo->addItem(i18n("GByte"));
    splitSizeLineLayout->addWidget(sizeCombo);

    grid->addWidget(splitSizeLine, 2 , 0);

    overwriteCb = new QCheckBox(i18n("Overwrite files without confirmation"), this);
    grid->addWidget(overwriteCb, 3, 0);

    QFrame *separator = new QFrame(this);
    separator->setFrameStyle(QFrame::HLine | QFrame::Sunken);
    separator->setFixedHeight(separator->sizeHint().height());

    grid->addWidget(separator, 4 , 0);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
    buttonBox->button(QDialogButtonBox::Ok)->setText(i18n("&Split"));

    grid->addWidget(buttonBox, 5 , 0);

    setWindowTitle(i18n("Krusader::Splitter"));


    KConfigGroup cfg(KSharedConfig::openConfig(), QStringLiteral("Splitter"));
    overwriteCb->setChecked(cfg.readEntry("OverWriteFiles", false));

    connect(sizeCombo, SIGNAL(activated(int)), this, SLOT(sizeComboActivated(int)));
    connect(deviceCombo, SIGNAL(activated(int)), this, SLOT(predefinedComboActivated(int)));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    connect(buttonBox , SIGNAL(accepted()), this, SLOT(splitPressed()));

    predefinedComboActivated(0);
}
Пример #17
0
OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
    : QDialog(parent)
    , ui(new Ui::OptionsDialog)
    , model(0)
    , mapper(0)
{
    ui->setupUi(this);

    /* Main elements init */
    ui->databaseCache->setMinimum(nMinDbCache);
    ui->databaseCache->setMaximum(nMaxDbCache);
    ui->threadsScriptVerif->setMinimum(-GetNumCores());
    ui->threadsScriptVerif->setMaximum(MAX_SCRIPTCHECK_THREADS);

    QFrame* horizontalLine = new QFrame(this);
    horizontalLine->setFrameStyle(QFrame::HLine);
    horizontalLine->setFixedHeight(1);
    horizontalLine->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    horizontalLine->setStyleSheet(GULDEN_DIALOG_HLINE_STYLE_NOMARGIN);
    ui->verticalLayout->insertWidget(2, horizontalLine);

    setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);

    ui->okButton->setCursor(Qt::PointingHandCursor);
    ui->cancelButton->setCursor(Qt::PointingHandCursor);
    ui->resetButton->setCursor(Qt::PointingHandCursor);

/* Network elements init */
#ifndef USE_UPNP
    ui->mapPortUpnp->setEnabled(false);
#endif

    ui->proxyIp->setEnabled(false);
    ui->proxyPort->setEnabled(false);
    ui->proxyPort->setValidator(new QIntValidator(1, 65535, this));

    ui->proxyIpTor->setEnabled(false);
    ui->proxyPortTor->setEnabled(false);
    ui->proxyPortTor->setValidator(new QIntValidator(1, 65535, this));

    connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, SLOT(setEnabled(bool)));
    connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool)));
    connect(ui->connectSocks, SIGNAL(toggled(bool)), this, SLOT(updateProxyValidationState()));

    connect(ui->connectSocksTor, SIGNAL(toggled(bool)), ui->proxyIpTor, SLOT(setEnabled(bool)));
    connect(ui->connectSocksTor, SIGNAL(toggled(bool)), ui->proxyPortTor, SLOT(setEnabled(bool)));
    connect(ui->connectSocksTor, SIGNAL(toggled(bool)), this, SLOT(updateProxyValidationState()));

/* Window elements init */
#ifdef Q_OS_MAC
    /* remove Window tab on Mac */
    ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow));
#endif

    /* remove Wallet tab in case of -disablewallet */
    if (!enableWallet) {
        ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWallet));
    }

    /* Display elements init */
    QDir translations(":translations");

    ui->bitcoinAtStartup->setToolTip(ui->bitcoinAtStartup->toolTip().arg(tr(PACKAGE_NAME)));
    ui->bitcoinAtStartup->setText(ui->bitcoinAtStartup->text().arg(tr(PACKAGE_NAME)));

    ui->lang->setToolTip(ui->lang->toolTip().arg(tr(PACKAGE_NAME)));
    ui->lang->addItem(QString("(") + tr("default") + QString(")"), QVariant(""));
    Q_FOREACH (const QString& langStr, translations.entryList()) {
        QLocale locale(langStr);

        /** check if the locale name consists of 2 parts (language_country) */
        if (langStr.contains("_")) {
#if QT_VERSION >= 0x040800
            /** display language strings as "native language - native country (locale name)", e.g. "Deutsch - Deutschland (de)" */
            ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") + locale.nativeCountryName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
#else
            /** display language strings as "language - country (locale name)", e.g. "German - Germany (de)" */
            ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" - ") + QLocale::countryToString(locale.country()) + QString(" (") + langStr + QString(")"), QVariant(langStr));
#endif
        } else {
#if QT_VERSION >= 0x040800
            /** display language strings as "native language (locale name)", e.g. "Deutsch (de)" */
            ui->lang->addItem(locale.nativeLanguageName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
#else
            /** display language strings as "language (locale name)", e.g. "German (de)" */
            ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" (") + langStr + QString(")"), QVariant(langStr));
#endif
        }
    }
#if QT_VERSION >= 0x040700
    ui->thirdPartyTxUrls->setPlaceholderText("https://example.com/tx/%s");
#endif

    ui->unit->setModel(new BitcoinUnits(this));

    /* Widget-to-option mapper */
    mapper = new QDataWidgetMapper(this);
    mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
    mapper->setOrientation(Qt::Vertical);

    /* setup/change UI elements when proxy IPs are invalid/valid */
    ui->proxyIp->setCheckValidator(new ProxyAddressValidator(parent));
    ui->proxyIpTor->setCheckValidator(new ProxyAddressValidator(parent));
    connect(ui->proxyIp, SIGNAL(validationDidChange(QValidatedLineEdit*)), this, SLOT(updateProxyValidationState()));
    connect(ui->proxyIpTor, SIGNAL(validationDidChange(QValidatedLineEdit*)), this, SLOT(updateProxyValidationState()));
    connect(ui->proxyPort, SIGNAL(textChanged(const QString&)), this, SLOT(updateProxyValidationState()));
    connect(ui->proxyPortTor, SIGNAL(textChanged(const QString&)), this, SLOT(updateProxyValidationState()));
}
Пример #18
0
MainWindow::MainWindow(QWidget *parent, const char *title, const QSize &size, const char *path) :
	QMainWindow(parent), _status(statusBar()), _panelManager(new PanelManager()),
	_watcher(new QFutureWatcher<void>(this)) {
	/* Window setup. */
	setWindowTitle(title);
	resize(size);

	/* Actions. */
	_actionOpenDirectory = new QAction(this);
	_actionOpenFile = new QAction(this);
	_actionClose = new QAction(this);
	_actionQuit = new QAction(this);
	_actionAbout = new QAction(this);

	_actionOpenDirectory->setText(tr("&Open directory"));
	_actionOpenDirectory->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
	_actionOpenFile->setText(tr("Open &file"));
	_actionClose->setText(tr("&Close"));
	_actionClose->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W));
	_actionQuit->setText(tr("&Quit"));
	_actionQuit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
	_actionAbout->setText(tr("&About"));
	_actionAbout->setShortcut(QKeySequence(Qt::Key_F1));

	/* Menu. */
	_menuBar = new QMenuBar(this);
	_menuFile = new QMenu(_menuBar);
	_menuHelp = new QMenu(_menuBar);

	_menuBar->addAction(_menuFile->menuAction());
	_menuBar->addAction(_menuHelp->menuAction());
	_menuFile->addAction(_actionOpenDirectory);
	_menuFile->addAction(_actionOpenFile);
	_menuFile->addSeparator();
	_menuFile->addAction(_actionClose);
	_menuFile->addSeparator();
	_menuFile->addAction(_actionQuit);
	_menuFile->setTitle("&File");
	_menuHelp->addAction(_actionAbout);
	_menuHelp->setTitle("&Help");

	setMenuBar(_menuBar);

	/* Slots. */
	QObject::connect(_actionOpenDirectory, &QAction::triggered, this, &MainWindow::slotOpenDirectory);
	QObject::connect(_actionOpenFile, &QAction::triggered, this, &MainWindow::slotOpenFile);
	QObject::connect(_actionClose, &QAction::triggered, this, &MainWindow::slotClose);
	QObject::connect(_actionQuit, &QAction::triggered, this, &MainWindow::slotQuit);
	QObject::connect(_actionAbout, &QAction::triggered, this, &MainWindow::slotAbout);

	/* Layout. */
	_centralWidget = new QWidget(this);
	_centralLayout = new QGridLayout(_centralWidget);
	_splitterTopBottom = new QSplitter(_centralWidget);
	_splitterLeftRight = new QSplitter(_splitterTopBottom);
	_treeView = new QTreeView(_splitterLeftRight);
	QGroupBox *logBox = new QGroupBox(_splitterTopBottom);
	QWidget *previewWrapper = new QWidget(_splitterTopBottom); // Can't add a layout directly to a splitter.
	QVBoxLayout *previewWrapperLayout = new QVBoxLayout(previewWrapper);
	QFrame *resInfoFrame = new QFrame(previewWrapper);
	_resPreviewFrame = new QFrame(previewWrapper);
	_log = new QTextEdit(logBox);
	_log->setReadOnly(true);

	// Tree
	// 1:8 ratio; tree:preview/log
	{
		QSizePolicy sp(QSizePolicy::Expanding, QSizePolicy::Preferred);
		sp.setHorizontalStretch(1);
		_treeView->setSizePolicy(sp);
	}

	// Preview wrapper
	previewWrapper->setLayout(previewWrapperLayout);
	previewWrapper->setContentsMargins(0, 0, 0, 0);
	previewWrapperLayout->setParent(previewWrapper);
	previewWrapperLayout->setMargin(0);
	previewWrapperLayout->addWidget(resInfoFrame);
	previewWrapperLayout->addWidget(_resPreviewFrame);
	{
		QSizePolicy sp(QSizePolicy::Expanding, QSizePolicy::Preferred);
		sp.setHorizontalStretch(6);
		previewWrapper->setSizePolicy(sp);
	}

	// Log
	logBox->setTitle(tr("Log"));
	{
		QSizePolicy sp(QSizePolicy::Preferred, QSizePolicy::Preferred);
		sp.setVerticalStretch(1);
		logBox->setSizePolicy(sp);

		QHBoxLayout *hl = new QHBoxLayout(logBox);
		hl->addWidget(_log);
		hl->setContentsMargins(0, 5, 0, 0);
	}

	// Left/right splitter
	// 8:1 ratio, preview:log
	_splitterLeftRight->addWidget(_treeView);
	_splitterLeftRight->addWidget(previewWrapper);
	{
		QSizePolicy sp(QSizePolicy::Expanding, QSizePolicy::Preferred);
		sp.setVerticalStretch(5);
		_splitterLeftRight->setSizePolicy(sp);
	}

	// Top/bottom splitter
	_splitterTopBottom->setOrientation(Qt::Vertical);
	_splitterTopBottom->addWidget(_splitterLeftRight);
	_splitterTopBottom->addWidget(logBox);

	// Resource info frame
	_panelManager->registerPanel(new PanelPreviewEmpty(nullptr), Aurora::kResourceNone);
	_panelManager->registerPanel(new PanelPreviewSound(nullptr), Aurora::kResourceSound);
	_panelManager->registerPanel(new PanelPreviewImage(nullptr), Aurora::kResourceImage);
	_panelManager->registerPanel(new PanelPreviewText(nullptr), Aurora::kResourceText);
	_panelManager->registerPanel(new PanelPreviewTable(nullptr), Aurora::kResourceTable);
	_panelManager->setItem(nullptr);

	PanelPreviewText *textPanel = static_cast<PanelPreviewText *>(_panelManager->getPanelByType(Aurora::kResourceText));
	PanelPreviewTable *tablePanel = static_cast<PanelPreviewTable *>(_panelManager->getPanelByType(Aurora::kResourceTable));
	QObject::connect(textPanel, &PanelPreviewText::log, this, &MainWindow::slotLog);
	QObject::connect(tablePanel, &PanelPreviewTable::log, this, &MainWindow::slotLog);

	_panelResourceInfo = new PanelResourceInfo(this);
	QObject::connect(_panelResourceInfo, &PanelResourceInfo::closeDirClicked, this, &MainWindow::slotClose);
	QObject::connect(_panelResourceInfo, &PanelResourceInfo::saveClicked, this, &MainWindow::saveItem);
	QObject::connect(_panelResourceInfo, &PanelResourceInfo::exportTGAClicked, this, &MainWindow::exportTGA);
	QObject::connect(_panelResourceInfo, &PanelResourceInfo::exportBMUMP3Clicked, this, &MainWindow::exportBMUMP3);
	QObject::connect(_panelResourceInfo, &PanelResourceInfo::exportWAVClicked, this, &MainWindow::exportWAV);
	QObject::connect(_panelResourceInfo, &PanelResourceInfo::log, this, &MainWindow::slotLog);
	resInfoFrame->setFrameShape(QFrame::StyledPanel);
	resInfoFrame->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed));
	resInfoFrame->setFixedHeight(140);
	{
		QHBoxLayout *hl = new QHBoxLayout(resInfoFrame);
		hl->addWidget(_panelResourceInfo);
	}

	// Resource preview frame
	_resPreviewFrame->setFrameShape(QFrame::StyledPanel);
	{
		QHBoxLayout *hl = new QHBoxLayout(_resPreviewFrame);

		hl->setMargin(0);
		_panelManager->setLayout(hl);
	}

	setCentralWidget(_centralWidget);
	_centralLayout->addWidget(_splitterTopBottom);

	/* Open path. */
	const QString qpath = QString::fromUtf8(path);

	_treeModel = std::make_unique<ResourceTree>(this, _treeView);
	_proxyModel = std::make_unique<ProxyModel>(this);

	_panelManager->setItem(nullptr);

	_status.setText("Idle...");

	if (qpath.isEmpty())
		_actionClose->setEnabled(false);
	else
		open(qpath);
}
Пример #19
0
HWUploadVideoDialog::HWUploadVideoDialog(QWidget* parent, const QString &filename, QNetworkAccessManager* netManager) : QDialog(parent)
{
    this->filename = filename;
    this->netManager = netManager;

    setWindowTitle(tr("Upload video"));

    // Google requires us to display this, see https://developers.google.com/youtube/terms
    QString GoogleNotice =
        "<p>By clicking 'upload,' you certify that you own all rights to the content or that "
        "you are authorized by the owner to make the content publicly available on YouTube, "
        "and that it otherwise complies with the YouTube Terms of Service located at "
        "<a href=\"http://www.youtube.com/t/terms\" style=\"color: white;\">http://www.youtube.com/t/terms</a>.</p>";

    // youtube doesn't understand this characters, even when they are properly escaped
    // (either with CDATA or with &lt or &gt)
    QRegExp rx("[^<>]*");

    int row = 0;

    QGridLayout * layout = new QGridLayout(this);
    layout->setColumnStretch(0, 1);
    layout->setColumnStretch(1, 2);

    QLabel * lbLabel = new QLabel(this);
    lbLabel->setWordWrap(true);
    lbLabel->setText(QLabel::tr(
                         "Please provide either the YouTube account name "
                         "or the email address associated with the Google Account."));
    layout->addWidget(lbLabel, row++, 0, 1, 2);

    lbLabel = new QLabel(this);
    lbLabel->setText(QLabel::tr("Account name (or email): "));
    layout->addWidget(lbLabel, row, 0);

    leAccount = new QLineEdit(this);
    layout->addWidget(leAccount, row++, 1);

    lbLabel = new QLabel(this);
    lbLabel->setText(QLabel::tr("Password: "******"Save account name and password"));
    layout->addWidget(cbSave, row++, 0, 1, 2);

    QFrame * hr = new QFrame(this);
    hr->setFrameStyle(QFrame::HLine);
    hr->setLineWidth(3);
    hr->setFixedHeight(10);
    layout->addWidget(hr, row++, 0, 1, 2);

    lbLabel = new QLabel(this);
    lbLabel->setText(QLabel::tr("Video title: "));
    layout->addWidget(lbLabel, row, 0);

    leTitle = new QLineEdit(this);
    leTitle->setText(filename);
    leTitle->setValidator(new QRegExpValidator(rx, leTitle));
    layout->addWidget(leTitle, row++, 1);

    lbLabel = new QLabel(this);
    lbLabel->setText(QLabel::tr("Video description: "));
    layout->addWidget(lbLabel, row++, 0, 1, 2);

    teDescription = new QPlainTextEdit(this);
    layout->addWidget(teDescription, row++, 0, 1, 2);

    lbLabel = new QLabel(this);
    lbLabel->setText(QLabel::tr("Tags (comma separated): "));
    layout->addWidget(lbLabel, row, 0);

    leTags = new QLineEdit(this);
    leTags->setText("hedgewars");
    leTags->setMaxLength(500);
    leTags->setValidator(new QRegExpValidator(rx, leTags));
    layout->addWidget(leTags, row++, 1);

    cbPrivate = new QCheckBox(this);
    cbPrivate->setText(QCheckBox::tr("Video is private"));
    layout->addWidget(cbPrivate, row++, 0, 1, 2);

    hr = new QFrame(this);
        hr->setFrameStyle(QFrame::HLine);
        hr->setLineWidth(3);
        hr->setFixedHeight(10);
        layout->addWidget(hr, row++, 0, 1, 2);

    lbLabel = new QLabel(this);
    lbLabel->setWordWrap(true);
    lbLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
    lbLabel->setTextFormat(Qt::RichText);
    lbLabel->setOpenExternalLinks(true);
    lbLabel->setText(GoogleNotice);
    layout->addWidget(lbLabel, row++, 0, 1, 2);

    QDialogButtonBox* dbbButtons = new QDialogButtonBox(this);
    btnUpload = dbbButtons->addButton(tr("Upload"), QDialogButtonBox::ActionRole);
    QPushButton * pbCancel = dbbButtons->addButton(QDialogButtonBox::Cancel);
    layout->addWidget(dbbButtons, row++, 0, 1, 2);

   /* hr = new QFrame(this);
        hr->setFrameStyle(QFrame::HLine);
        hr->setLineWidth(3);
        hr->setFixedHeight(10);
        layout->addWidget(hr, row++, 0, 1, 2);*/

    connect(btnUpload, SIGNAL(clicked()), this, SLOT(upload()));
    connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject()));

    this->setWindowModality(Qt::WindowModal);
}
Пример #20
0
OptionsDetailed::OptionsDetailed( Config* _config, QWidget* parent )
    : QWidget( parent ),
    config( _config )
{
    const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height();

    int gridRow = 0;
    grid = new QGridLayout( this );

    QHBoxLayout *topBox = new QHBoxLayout();
    grid->addLayout( topBox, 0, 0 );

    QLabel *lFormat = new QLabel( i18n("Format:"), this );
    topBox->addWidget( lFormat );
    cFormat = new KComboBox( this );
    topBox->addWidget( cFormat );
    cFormat->addItems( config->pluginLoader()->formatList(PluginLoader::Encode,PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid)) );
    connect( cFormat, SIGNAL(activated(const QString&)), this, SLOT(formatChanged(const QString&)) );
//     connect( cFormat, SIGNAL(activated(const QString&)), this, SLOT(somethingChanged()) );

    topBox->addStretch();

    lPlugin = new QLabel( i18n("Use Plugin:"), this );
    topBox->addWidget( lPlugin );
    cPlugin = new KComboBox( this );
    topBox->addWidget( cPlugin );
    cPlugin->setSizeAdjustPolicy( QComboBox::AdjustToContents );
    connect( cPlugin, SIGNAL(activated(const QString&)), this, SLOT(encoderChanged(const QString&)) );
    connect( cPlugin, SIGNAL(activated(const QString&)), this, SLOT(somethingChanged()) );
    pConfigurePlugin = new KPushButton( KIcon("configure"), "", this );
    pConfigurePlugin->setFixedSize( cPlugin->sizeHint().height(), cPlugin->sizeHint().height() );
    pConfigurePlugin->setFlat( true );
    topBox->addWidget( pConfigurePlugin );
    topBox->setStretchFactor( pConfigurePlugin, 1 );
    connect( pConfigurePlugin, SIGNAL(clicked()), this, SLOT(configurePlugin()) );

    // draw a horizontal line
    QFrame *lineFrame = new QFrame( this );
    lineFrame->setFrameShape( QFrame::HLine );
    lineFrame->setFrameShadow( QFrame::Sunken );
    lineFrame->setFixedHeight( fontHeight );
    grid->addWidget( lineFrame, 1, 0 );

    // prepare the plugin widget
    wPlugin = 0;
    grid->setRowStretch( 2, 1 );
    grid->setRowMinimumHeight( 2, 20 );
    gridRow = 3;

    // draw a horizontal line
    lineFrame = new QFrame( this );
    lineFrame->setFrameShape( QFrame::HLine );
    lineFrame->setFrameShadow( QFrame::Sunken );
    lineFrame->setFixedHeight( fontHeight );
    grid->addWidget( lineFrame, gridRow++, 0 );

    int filterCount = 0;
    foreach( const QString& pluginName, config->data.backends.enabledFilters )
    {
        FilterPlugin *plugin = qobject_cast<FilterPlugin*>(config->pluginLoader()->backendPluginByName(pluginName));
        if( !plugin )
            continue;

        FilterWidget *widget = plugin->newFilterWidget();
        if( !widget )
            continue;

        wFilter.insert( widget, plugin );
        connect( widget, SIGNAL(optionsChanged()), this, SLOT(somethingChanged()) );
        grid->addWidget( widget, gridRow++, 0 );
        widget->show();
        filterCount++;
    }
    if( filterCount > 0 )
    {
        // draw a horizontal line
        lineFrame = new QFrame( this );
        lineFrame->setFrameShape( QFrame::HLine );
        lineFrame->setFrameShadow( QFrame::Sunken );
        lineFrame->setFixedHeight( fontHeight );
        grid->addWidget( lineFrame, gridRow++, 0 );
    }

    // the output directory
    QHBoxLayout *middleBox = new QHBoxLayout( );
    grid->addLayout( middleBox, gridRow++, 0 );

    QLabel *lOutput = new QLabel( i18n("Destination:"), this );
    middleBox->addWidget( lOutput );
    outputDirectory = new OutputDirectory( config, this );
    middleBox->addWidget( outputDirectory );

    QHBoxLayout *bottomBox = new QHBoxLayout();
    grid->addLayout( bottomBox, gridRow++, 0 );

    cReplayGain = new QCheckBox( i18n("Calculate Replay Gain tags"), this );
    bottomBox->addWidget( cReplayGain );
    //connect( cReplayGain, SIGNAL(toggled(bool)), this, SLOT(somethingChanged()) );
    bottomBox->addStretch();
    lEstimSize = new QLabel( QString(QChar(8776))+"? B / min." );
    lEstimSize->hide(); // hide for now because most plugins report inaccurate data
    bottomBox->addWidget( lEstimSize );
    pProfileSave = new KPushButton( KIcon("document-save"), "", this );
    bottomBox->addWidget( pProfileSave );
    pProfileSave->setFixedWidth( pProfileSave->height() );
    pProfileSave->setToolTip( i18n("Save current options as a profile") );
    connect( pProfileSave, SIGNAL(clicked()), this, SLOT(saveCustomProfile()) );
    pProfileLoad = new QToolButton( this );
    bottomBox->addWidget( pProfileLoad );
    pProfileLoad->setIcon( KIcon("document-open") );
    pProfileLoad->setPopupMode( QToolButton::InstantPopup );
    pProfileLoad->setFixedWidth( pProfileLoad->height() );
    pProfileLoad->setToolTip( i18n("Load saved profiles") );
}