Beispiel #1
0
TilesetView::TilesetView(QWidget *parent)
    : QTableView(parent)
    , mZoomable(0)
    , mMapDocument(0)
    , mMarkAnimatedTiles(true)
    , mEditTerrain(false)
    , mEraseTerrain(false)
    , mTerrainId(-1)
    , mHoveredCorner(0)
    , mTerrainChanged(false)
{
    setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
    setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
    setItemDelegate(new TileDelegate(this, this));
    setShowGrid(false);

    QHeaderView *hHeader = horizontalHeader();
    QHeaderView *vHeader = verticalHeader();
    hHeader->hide();
    vHeader->hide();
    hHeader->setSectionResizeMode(QHeaderView::ResizeToContents);
    vHeader->setSectionResizeMode(QHeaderView::ResizeToContents);
    hHeader->setMinimumSectionSize(1);
    vHeader->setMinimumSectionSize(1);

    // Hardcode this view on 'left to right' since it doesn't work properly
    // for 'right to left' languages.
    setLayoutDirection(Qt::LeftToRight);

    Preferences *prefs = Preferences::instance();
    mDrawGrid = prefs->showTilesetGrid();

    grabGesture(Qt::PinchGesture);

    connect(prefs, SIGNAL(showTilesetGridChanged(bool)),
            SLOT(setDrawGrid(bool)));
}
// Constructor.
qjackctlInterfaceComboBox::qjackctlInterfaceComboBox ( QWidget *pParent )
	: QComboBox(pParent)
{
	QTreeView *pTreeView = new QTreeView(this);
	QHeaderView *pHeaderView = pTreeView->header();
	pHeaderView->hide();
#if QT_VERSION < 0x050000
	pHeaderView->setResizeMode(QHeaderView::ResizeToContents);
#endif
	pTreeView->setRootIsDecorated(false);
	pTreeView->setAllColumnsShowFocus(true);
	pTreeView->setSelectionBehavior(QAbstractItemView::SelectRows);
	pTreeView->setSelectionMode(QAbstractItemView::SingleSelection);
	pTreeView->setModel(new QStandardItemModel());
//	pTreeView->setMinimumWidth(320);
	QComboBox::setView(pTreeView);
}
Beispiel #3
0
Legend::Legend(QWidget* parent) :
   QTreeWidget(parent),
   mSecondaryObjects(false)
{
   setColumnCount(1);
   setRootIsDecorated(false);
   setSelectionMode(QAbstractItemView::NoSelection);
   setSortingEnabled(false);
   setFocusPolicy(Qt::NoFocus);

   QHeaderView* pHeader = header();
   if (pHeader != NULL)
   {
      pHeader->setMovable(false);
      pHeader->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
      pHeader->hide();
   }
}
Beispiel #4
0
//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
void tWorkProfilesDialog::Init()
{
    QSize iconSize( 68, 68 );

    m_pProfilesTable = new tTableWidget( 0, eColumnCount, this );
    m_pProfilesTable->setFrameShape( QFrame::NoFrame );
    m_pProfilesTable->SetSoleFocus( true );
    m_pProfilesTable->SetWrapping( false );

    QHeaderView* pHorizontalHeaderView = m_pProfilesTable->horizontalHeader();
    pHorizontalHeaderView->setClickable( false );
    pHorizontalHeaderView->resizeSection( eIconColumn, iconSize.width() );

    pHorizontalHeaderView->setResizeMode( eNameColumn, QHeaderView::Stretch );

    QString nameString = QString( tr( "Name" ) );
    QSize headerTextSize = pHorizontalHeaderView->fontMetrics().size( 0, nameString ); 
    int w = headerTextSize.width() + 10;
    pHorizontalHeaderView->resizeSection( eNameColumn, w );

    QStringList headings;
    headings << "" << nameString << tr( "Enabled" ) << tr( "Active" );
    m_pProfilesTable->setHorizontalHeaderLabels( headings );

    pHorizontalHeaderView->setDefaultAlignment( Qt::AlignLeft );

    QHeaderView* pVerticalHeaderView = m_pProfilesTable->verticalHeader();
    pVerticalHeaderView->hide();
    pVerticalHeaderView->setResizeMode( QHeaderView::Fixed );
    pVerticalHeaderView->setDefaultSectionSize( iconSize.height() );

    QVBoxLayout* pVLayout = new QVBoxLayout( this );
    pVLayout->setContentsMargins( 0, 0, 0, 0 );

    pVLayout->addWidget( m_pProfilesTable );

    setLayout( pVLayout );

    UpdateTable();

    m_pProfilesTable->selectRow( m_ProfileIndex );

}
Beispiel #5
0
PagePalette::PagePalette(QWidget* parent) : ScrPaletteBase( parent, "SP", false, 0)
{
	m_scMW=(ScribusMainWindow*)parent;
	PagePaletteLayout = new QVBoxLayout( this );
	PagePaletteLayout->setSpacing( 5 );
	PagePaletteLayout->setMargin( 5 );
	Splitter1 = new QSplitter( this );
	Splitter1->setOrientation( Qt::Vertical );
	QWidget* privateLayoutWidget = new QWidget( Splitter1 );
	Layout2 = new QVBoxLayout( privateLayoutWidget );
	Layout2->setMargin(0);
	Layout2->setSpacing(5);
	TextLabel1 = new QLabel( privateLayoutWidget );
	Layout2->addWidget( TextLabel1 );
	masterPageList = new SeList(privateLayoutWidget);
	masterPageList->setMinimumSize(QSize(130,70));
	masterPageList->Thumb = false;
	masterPageList->setIconSize(QSize(60, 60));
	Layout2->addWidget( masterPageList );
	QWidget* privateLayoutWidget_2 = new QWidget( Splitter1 );
	Layout3 = new QVBoxLayout( privateLayoutWidget_2);
	Layout3->setMargin(0);
	Layout3->setSpacing(5);
	TextLabel2 = new QLabel( privateLayoutWidget_2 );
	Layout3->addWidget( TextLabel2 );
	pageView = new SeView(privateLayoutWidget_2);
	QHeaderView *Header = pageView->verticalHeader();
	Header->setMovable(false);
	Header->setResizeMode(QHeaderView::Fixed);
	Header->hide();
	Header = pageView->horizontalHeader();
	Header->setMovable(false);
	Header->setResizeMode(QHeaderView::Fixed);
	Header->hide();
	pageView->setSortingEnabled(false);
	pageView->setSelectionMode( QAbstractItemView::NoSelection );
	pageView->setRowCount(1);
	pageView->setColumnCount(1);
	pageView->setIconSize(QSize(60, 60));
	pageView->setMinimumSize(QSize(130,120));
	Layout3->addWidget( pageView );
	PagePaletteLayout->addWidget( Splitter1 );

	Layout1 = new QHBoxLayout;
	Layout1->setSpacing( 5 );
	Layout1->setMargin( 0 );
	QList<PageSet> dummy;
	dummy.clear();
	struct PageSet pageS;
	pageS.Name = CommonStrings::trPageSet2;
	pageS.FirstPage = 0;
	pageS.Rows = 1;
	pageS.Columns = 1;
//	pageS.GapHorizontal = 0.0;
//	pageS.GapVertical = 0.0;
//	pageS.GapBelow = 40.0;
	pageS.pageNames.clear();
	pageS.pageNames.append(CommonStrings::trPageLocMiddleRight);
	dummy.append(pageS);
	pageLayout = new PageLayouts(this, dummy, false);
	Layout1->addWidget( pageLayout );

// 	QSpacerItem* spacer = new QSpacerItem( 15, 15, QSizePolicy::Expanding, QSizePolicy::Minimum );
// 	Layout1->addItem( spacer );

	Trash = new TrashBin( this );
	Trash->setMinimumSize(QSize(32,32));
	Trash->setMaximumSize(QSize(32,32));
	Layout1->addWidget( Trash );
	PagePaletteLayout->addLayout( Layout1 );
	pix = loadIcon("32/page-simple.png");
	currView = 0;
	Rebuild();
	languageChange();
	connect(masterPageList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(selMasterPage()));
	connect(masterPageList, SIGNAL(thumbnailChanged()), this, SLOT(rebuildMasters()));
	connect(masterPageList, SIGNAL(DelMaster(QString)), this, SLOT(deleteMasterPage(QString)));
	connect(pageView, SIGNAL(Click(int, int, int)), this, SLOT(pageView_gotoPage(int, int, int)));
	connect(pageView, SIGNAL(movePage(int, int)), this, SLOT(pageView_movePage(int, int)));
	connect(Trash, SIGNAL(DelMaster(QString)), this, SLOT(deleteMasterPage(QString)));
	connect(pageLayout, SIGNAL(selectedLayout(int )), this, SLOT(handlePageLayout(int )));
	connect(pageLayout, SIGNAL(selectedFirstPage(int )), this, SLOT(handleFirstPage(int )));
	connect(this, SIGNAL(EditTemp(QString)), m_scMW, SLOT(manageMasterPages(QString)));
	connect(pageView, SIGNAL(UseTemp(QString, int)), m_scMW, SLOT(Apply_MasterPage(QString, int)));
	connect(pageView, SIGNAL(NewPage(int, QString)), m_scMW, SLOT(slotNewPageP(int, QString)));
	connect(Trash, SIGNAL(DelPage(int)), m_scMW, SLOT(DeletePage2(int)));
	connect(pageView, SIGNAL(DelPage(int)), m_scMW, SLOT(DeletePage2(int)));
	connect(this, SIGNAL(gotoPage(int)), m_scMW, SLOT(selectPagesFromOutlines(int)));
}
Beispiel #6
0
PreFlightCheckListPage::PreFlightCheckListPage( QWidget* parent ) :
  QWidget( parent ),
  CheckListFileName("cumulus-checklist.txt")
{
  setObjectName("PreFlightCheckListPage");
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowTitle( tr("PreFlight - Checklist") );

  if( parent )
    {
      resize( parent->size() );
    }

  QVBoxLayout *contentLayout = new QVBoxLayout;
  setLayout(contentLayout);

  m_fileDisplay = new QLabel;
  m_fileDisplay->setWordWrap( true );
  m_fileDisplay->hide();
  contentLayout->addWidget( m_fileDisplay );

  QHBoxLayout *hbox = new QHBoxLayout;
  hbox->setMargin( 0 );
  contentLayout->addLayout( hbox );

  m_list = new QTableWidget( 0, 2, this );
  m_list->setSelectionBehavior( QAbstractItemView::SelectItems );
  m_list->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
  m_list->setAlternatingRowColors( true );
  m_list->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
  m_list->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );

  // calculates the needed icon size
  QFontMetrics qfm( font() );
  int iconSize = qfm.height();

  // Sets the icon size of a list entry
  m_list->setIconSize( QSize(iconSize, iconSize) );

  hbox->addWidget( m_list );

  connect( m_list, SIGNAL(cellDoubleClicked(int, int)),
           SLOT(slotEditCell(int, int)) );

  connect( m_list, SIGNAL(cellClicked(int, int)),
           SLOT(slotCellClicked(int, int)) );

#ifdef ANDROID
  QScrollBar* lvsb = m_list->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

#ifdef QSCROLLER
  QScroller::grabGesture(m_list->viewport(), QScroller::LeftMouseButtonGesture);
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture(m_list->viewport(), QtScroller::LeftMouseButtonGesture);
#endif

  QString style = "QTableView QTableCornerButton::section { background: gray }";
  m_list->setStyleSheet( style );
  QHeaderView *vHeader = m_list->verticalHeader();
  style = "QHeaderView::section { width: 2em }";
  vHeader->setStyleSheet( style );

  // set new row height from configuration
  int afMargin = GeneralConfig::instance()->getListDisplayAFMargin();
  rowDelegate = new RowDelegate( m_list, afMargin );
  m_list->setItemDelegate( rowDelegate );

  QHeaderView* hHeader = m_list->horizontalHeader();
  hHeader->setStretchLastSection( true );
  hHeader->hide();

  QTableWidgetItem *item = new QTableWidgetItem( tr(" Check Point ") );
  m_list->setHorizontalHeaderItem( 0, item );

#ifndef ANDROID
  int buttonSize = Layout::getButtonSize();
#else
  int buttonSize = Layout::getButtonSize(16);
#endif

  iconSize   = buttonSize - 5;

  QPushButton* toggleButton = new QPushButton(this);
  toggleButton->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("file-32.png")));
  toggleButton->setIconSize( QSize(iconSize, iconSize) );
  toggleButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  toggleButton->setMinimumSize(buttonSize, buttonSize);
  toggleButton->setMaximumSize(buttonSize, buttonSize);

  QPushButton *addButton = new QPushButton;
  addButton->setIcon( QIcon( GeneralConfig::instance()->loadPixmap( "add.png" ) ) );
  addButton->setIconSize(QSize(iconSize, iconSize));
  addButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  addButton->setMinimumSize(buttonSize, buttonSize);
  addButton->setMaximumSize(buttonSize, buttonSize);

  m_editButton = new QPushButton(this);
  m_editButton->setIcon( QIcon(GeneralConfig::instance()->loadPixmap("edit_new.png")) );
  m_editButton->setIconSize( QSize(iconSize, iconSize) );
  m_editButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  m_editButton->setMinimumSize(buttonSize, buttonSize);
  m_editButton->setMaximumSize(buttonSize, buttonSize);

  m_deleteButton = new QPushButton;
  m_deleteButton->setIcon( QIcon( GeneralConfig::instance()->loadPixmap( "delete.png" ) ) );
  m_deleteButton->setIconSize( QSize(iconSize, iconSize) );
  m_deleteButton->setEnabled(false);
  m_deleteButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  m_deleteButton->setMinimumSize(buttonSize, buttonSize);
  m_deleteButton->setMaximumSize(buttonSize, buttonSize);

  QPushButton *cancel = new QPushButton(this);
  cancel->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png")));
  cancel->setIconSize(QSize(iconSize, iconSize));
  cancel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  cancel->setMinimumSize(buttonSize, buttonSize);
  cancel->setMaximumSize(buttonSize, buttonSize);

  m_ok = new QPushButton(this);
  m_ok->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png")));
  m_ok->setIconSize(QSize(iconSize, iconSize));
  m_ok->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  m_ok->setMinimumSize(buttonSize, buttonSize);
  m_ok->setMaximumSize(buttonSize, buttonSize);

  QLabel *titlePix = new QLabel(this);
  titlePix->setAlignment( Qt::AlignCenter );
  titlePix->setPixmap( _globalMapConfig->createGlider(315, 1.6) );

  connect( addButton, SIGNAL(pressed()), SLOT(slotAddRow()) );
  connect( toggleButton, SIGNAL(pressed()), SLOT(slotToogleFilenameDisplay()) );
  connect( m_editButton, SIGNAL(pressed()), SLOT(slotEdit()) );
  connect( m_deleteButton, SIGNAL(pressed()), SLOT(slotDeleteRows()) );
  connect( m_ok, SIGNAL(pressed()), SLOT(slotAccept()) );
  connect( cancel, SIGNAL(pressed()), SLOT(slotReject()) );

  QVBoxLayout *buttonBox = new QVBoxLayout;
  hbox->addLayout(buttonBox);

  buttonBox->setSpacing(0);
  buttonBox->addWidget(toggleButton);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(addButton);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(m_editButton);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(m_deleteButton);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(cancel);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(m_ok);
  buttonBox->addStretch(2);
  buttonBox->addWidget(titlePix);
}
MatrixDsp::MatrixDsp(QWidget *parent) :
    QWidget(parent)
{
    QHeaderView *vHeader;
    QHeaderView *hHeader;

    // set up quantization and compression ratio labels
    whichQM = new QLabel(tr("non-uniform quantization"));
    whichQM->setAlignment(Qt::AlignCenter);
    cmpRate = new QLabel(tr("compression ratio: unavailable"));
    cmpRate->setAlignment(Qt::AlignCenter);
    qmLabel = new QLabel(tr("Quantization Table"));
    qmLabel->setAlignment(Qt::AlignCenter);
    oriLabel = new QLabel(tr("DCT (8x8 block)"));
    oriLabel->setAlignment(Qt::AlignCenter);
    qtzLabel = new QLabel(tr("Quantized 8x8 block"));
    qtzLabel->setAlignment(Qt::AlignCenter);

    // init a grid layout
    mainLayout = new QGridLayout(this);
    mainLayout->setSpacing(6);

    // init matrices
    QMMatrix = new QTableWidget(8, 8, this);
    vHeader = QMMatrix->verticalHeader();
    vHeader->sectionResizeMode(QHeaderView::Fixed);
    vHeader->setDefaultSectionSize(22);
    vHeader->hide();
    hHeader = QMMatrix->horizontalHeader();
    hHeader->sectionResizeMode(QHeaderView::Fixed);
    hHeader->setDefaultSectionSize(40);
    hHeader->hide();

    oriMatrix = new QTableWidget(8, 8, this);
    vHeader = oriMatrix->verticalHeader();
    vHeader->sectionResizeMode(QHeaderView::Fixed);
    vHeader->setDefaultSectionSize(22);
    vHeader->hide();
    hHeader = oriMatrix->horizontalHeader();
    hHeader->sectionResizeMode(QHeaderView::Fixed);
    hHeader->setDefaultSectionSize(40);
    hHeader->hide();

    qtzMatrix = new QTableWidget(8, 8, this);
    vHeader = qtzMatrix->verticalHeader();
    vHeader->sectionResizeMode(QHeaderView::Fixed);
    vHeader->setDefaultSectionSize(22);
    vHeader->hide();
    hHeader = qtzMatrix->horizontalHeader();
    hHeader->sectionResizeMode(QHeaderView::Fixed);
    hHeader->setDefaultSectionSize(40);
    hHeader->hide();

    // put quantization and compression ratio labels into the grid layout
    mainLayout->addWidget(whichQM, 0, 0, 1, 1);
    mainLayout->addWidget(cmpRate, 1, 0, 1, 1);
    mainLayout->addWidget(QMMatrix, 2, 0, 7, 1);
    mainLayout->addWidget(qmLabel, 9, 0, 1, 1);
    mainLayout->addWidget(oriMatrix, 10, 0, 7, 1);
    mainLayout->addWidget(oriLabel, 17, 0, 1, 1);
    mainLayout->addWidget(qtzMatrix, 18, 0, 7, 1);
    mainLayout->addWidget(qtzLabel, 25, 0, 1, 1);

    for (int i = 0; i < 8; i++)
        for (int j = 0; j < 8; j++) {
            oriMatrix->setItem(i, j, new QTableWidgetItem(""));
            qtzMatrix->setItem(i, j, new QTableWidgetItem(""));
            QMMatrix->setItem(i, j, new QTableWidgetItem(""));
        }
}
//--------------------------------------------------------------------------------------
//! The AIS Safety and DSC distress message page
//--------------------------------------------------------------------------------------
tVesselMessagesTabPage::tVesselMessagesTabPage( int numKeys, bool soleFocus, QWidget* pParent )
: QWidget( pParent ), m_NumKeys(numKeys)
{
    m_pTableTitle = new QLabel( tr( "Messages", "[title]" ), this );
    m_pTableTitle->hide();

    CreateActions();

    m_pMessageTable = new tTableWidget( 0, columnCount, this );
    m_pMessageTable->setFrameShape( QFrame::NoFrame );
    m_pMessageTable->SetSoleFocus( soleFocus );
    m_pMessageTable->SetWrapping( soleFocus == true );
    m_pMessageTable->hideColumn( mmsiColumn );
    m_pMessageTable->hideColumn( sourceTypeColumn );
    m_pMessageTable->hideColumn( uidColumn );
    Connect( m_pMessageTable, SIGNAL( itemClicked( QTableWidgetItem* ) ), m_pDetailsAct, SLOT( trigger() ) );

    QHeaderView* pHorizontalHeaderView = m_pMessageTable->horizontalHeader();
    pHorizontalHeaderView->setClickable( false );
    pHorizontalHeaderView->setResizeMode( timeColumn, QHeaderView::Fixed );
    pHorizontalHeaderView->setResizeMode( messageColumn, QHeaderView::Stretch );

    QString timeString = QString( tr( "Time", "[title]" ) );
    QSize headerTextSize = pHorizontalHeaderView->fontMetrics().size( 0, timeString );
    m_maxTimeWidth = headerTextSize.width() + 10;
    pHorizontalHeaderView->resizeSection( timeColumn, m_maxTimeWidth );

    QStringList headings;
    headings << timeString << tr( "Message", "[title]" );
    m_pMessageTable->setHorizontalHeaderLabels( headings );
    SetHeaderFont();

    // Prevents header bold font
    pHorizontalHeaderView->setHighlightSections( false );
    pHorizontalHeaderView->setDefaultAlignment( Qt::AlignLeft );

    QHeaderView* pVerticalHeaderView = m_pMessageTable->verticalHeader();
    pVerticalHeaderView->hide();
    pVerticalHeaderView->setResizeMode( QHeaderView::Fixed );
    pVerticalHeaderView->setDefaultSectionSize( QFontMetrics( QApplication::font() ).height() * 2 + 10 );

    QVBoxLayout* pVLayout = new QVBoxLayout( this );
    pVLayout->setContentsMargins( 0, 0, 0, 0 );

    pVLayout->addWidget( m_pTableTitle );
    pVLayout->addWidget( m_pMessageTable );

    setLayout( pVLayout );

    m_pResizeTimer = new QTimer( this );
    Connect( m_pResizeTimer, SIGNAL(timeout()), this, SLOT( Resize() ) );

    RefreshTable();
    m_pMessageTable->selectRow( 0 );

    if ( tProductSettings::Instance().AISAllowed() == true )
    {
        tAisEngine* pAisEngine = tGlobal<tAisEngine>::Instance();
        Connect( pAisEngine, SIGNAL( NewSafetyMessage( tAisSafetyMessage ) ), this, SLOT( NewAisSafetyMessage( const tAisSafetyMessage& ) ) );
        Connect( pAisEngine, SIGNAL( RemoveSafetyMessage( int ) ), this, SLOT( RemoveAisSafetyMessage( int ) ) );
    }
Beispiel #9
0
void MainWindow::setupUi()
{
	bool useSystemTheme;
	Ui_MainWindow::setupUi(this);
	
	m_dropBox = new DropBox(this);
	
	m_modelTransfers = new TransfersModel(this);
	treeTransfers->setModel(m_modelTransfers);
	treeTransfers->setItemDelegate(new ProgressDelegate(treeTransfers));
	
	m_trayIcon.setIcon(QIcon(":/fatrat/fatrat.png"));
	showTrayIcon();
	
	statusbar->addWidget(&m_labelStatus);
	statusbar->addPermanentWidget(new SpeedLimitWidget(statusbar));
	
	m_nStatusWidgetsLeft = m_nStatusWidgetsRight = 1;
	
	m_log = new LogManager(this, textTransferLog, textGlobalLog);
	
	useSystemTheme = getSettingsValue("gui/systemtheme").toBool();

#ifdef WITH_DOCUMENTATION
	QAction* action;
	QIcon xicon;
	if (useSystemTheme)
		xicon = QIcon::fromTheme("help-contents", QIcon(":/menu/about.png"));
	else
		xicon = QIcon(":/menu/about.png");
	action = new QAction(xicon, tr("Help"), menuHelp);
	menuHelp->insertAction(actionAboutQt, action);
	menuHelp->insertSeparator(actionAboutQt);
	connect(action, SIGNAL(triggered()), this, SLOT(showHelp()));
#endif
	
	QHeaderView* hdr = treeQueues->header();
	treeQueues->setColumnCount(1);
	hdr->hide();
	
	if(getSettingsValue("css").toBool())
		loadCSS();

#ifdef WITH_JPLUGINS
	if (JVM::JVMAvailable())
	{
		m_premiumAccounts = new ClickableLabel(this);

		m_premiumAccounts->setToolTip(tr("Premium account status..."));
		m_premiumAccounts->setScaledContents(true);
		m_premiumAccounts->setPixmap(QPixmap(":/fatrat/premium.png"));
		m_premiumAccounts->setMaximumSize(16, 16);
		m_premiumAccounts->setCursor(Qt::PointingHandCursor);
		statusbar->insertPermanentWidget(1, m_premiumAccounts);
		m_premiumAccounts->show();

		m_updates = new ClickableLabel(this);
		m_updates->setScaledContents(true);
		m_updates->setToolTip(tr("Extension updates: %1").arg(0));
		m_updates->setPixmap(QPixmap(":/fatrat/updates.png"));
		m_updates->setMaximumSize(16, 16);
		m_updates->setCursor(Qt::PointingHandCursor);
		statusbar->insertPermanentWidget(1, m_updates);
		m_updates->show();

		m_extensionMgr = new ExtensionMgr;
		connect(&m_extensionCheckTimer, SIGNAL(timeout()), m_extensionMgr, SLOT(loadFromServer()));
		connect(m_extensionMgr, SIGNAL(loaded()), this, SLOT(updatesChecked()));

		m_bUpdatesBubbleManuallyClosed = false;
		m_extensionCheckTimer.setInterval(60*60*1000);

		if (getSettingsValue("java/check_updates").toBool())
		{
			m_extensionCheckTimer.start();
			QTimer::singleShot(20*1000, m_extensionMgr, SLOT(loadFromServer()));
		}

		connect(m_updates, SIGNAL(clicked()), this, SLOT(showSettings()));
	}
#endif
	
	connectActions();
	
	for(int i=0;i<m_statusWidgets.size();i++)
	{
		if(m_statusWidgets[i].second)
			statusbar->insertPermanentWidget(m_nStatusWidgetsRight++, m_statusWidgets[i].first);
		else
			statusbar->insertWidget(m_nStatusWidgetsLeft++, m_statusWidgets[i].first);
		m_statusWidgets[i].first->show();
	}

	filterLineEdit = new Utils::FilterLineEdit(labelTransfers);
	QSize ss = labelTransfers->size();

	filterLineEdit->move(ss.width()-2-200,2);
	filterLineEdit->resize(200, ss.height()-12);
	connect(filterLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(filterTextChanged(const QString&)));
	filterLineEdit->setFrame(false);
	filterLineEdit->show();

	fillSettingsMenu();
	if (useSystemTheme)
		applySystemTheme();
}
Beispiel #10
0
ExtImageProps::ExtImageProps( QWidget* parent, ImageInfoRecord *info, PageItem *item, ScribusView *view )
	: QDialog( parent )
{
	setModal(true);
	setWindowTitle( tr( "Extended Image Properties" ) );
	setWindowIcon(QIcon(loadIcon ( "AppIcon.png" )));
	ExtImagePropsLayout = new QVBoxLayout( this );
	ExtImagePropsLayout->setMargin(6);
	ExtImagePropsLayout->setSpacing(6);
	viewWidget = view;
	currentItem = item;
	currentLayer = 0;
	originalInfo = *info;
	originalImageClip = item->imageClip.copy();
	blendModes.clear();
	blendModes.insert("norm", tr("Normal"));
	blendModes.insert("dark", tr("Darken"));
	blendModes.insert("lite", tr("Lighten"));
	blendModes.insert("hue ", tr("Hue"));
	blendModes.insert("sat ", tr("Saturation"));
	blendModes.insert("colr", tr("Color"));
	blendModes.insert("lum ", tr("Luminosity"));
	blendModes.insert("mul ", tr("Multiply"));
	blendModes.insert("scrn", tr("Screen"));
	blendModes.insert("diss", tr("Dissolve"));
	blendModes.insert("over", tr("Overlay"));
	blendModes.insert("hLit", tr("Hard Light"));
	blendModes.insert("sLit", tr("Soft Light"));
	blendModes.insert("diff", tr("Difference"));
	blendModes.insert("smud", tr("Exclusion"));
	blendModes.insert("div ", tr("Color Dodge"));
	blendModes.insert("idiv", tr("Color Burn"));
	blendModesRev.clear();
	blendModesRev.insert( tr("Normal"), "norm");
	blendModesRev.insert( tr("Darken"), "dark");
	blendModesRev.insert( tr("Lighten"), "lite");
	blendModesRev.insert( tr("Hue"), "hue ");
	blendModesRev.insert( tr("Saturation"), "sat ");
	blendModesRev.insert( tr("Color"), "colr");
	blendModesRev.insert( tr("Luminosity"), "lum ");
	blendModesRev.insert( tr("Multiply"), "mul ");
	blendModesRev.insert( tr("Screen"), "scrn");
	blendModesRev.insert( tr("Dissolve"), "diss");
	blendModesRev.insert( tr("Overlay"), "over");
	blendModesRev.insert( tr("Hard Light"), "hLit");
	blendModesRev.insert( tr("Soft Light"), "sLit");
	blendModesRev.insert( tr("Difference"), "diff");
	blendModesRev.insert( tr("Exclusion"), "smud");
	blendModesRev.insert( tr("Color Dodge"), "div ");
	blendModesRev.insert( tr("Color Burn"), "idiv");
	propsTab = new QTabWidget( this );
	QPalette palette;
	palette.setColor(backgroundRole(), Qt::white);
	if (info->layerInfo.count() != 0)
	{
		tab = new QWidget( propsTab );
		tabLayout = new QVBoxLayout( tab );
		tabLayout->setMargin(6);
		tabLayout->setSpacing(6);
		layout1 = new QHBoxLayout;
		layout1->setMargin(0);
		layout1->setSpacing(6);
		textLabel1 = new QLabel( tab );
		textLabel1->setText( tr( "Blend Mode:" ) );
		layout1->addWidget( textLabel1 );
		blendMode = new ScComboBox( tab );
		blendMode->clear();
		blendMode->addItem( tr("Normal"));
		blendMode->addItem( tr("Darken"));
		blendMode->addItem( tr("Lighten"));
		blendMode->addItem( tr("Hue"));
		blendMode->addItem( tr("Saturation"));
		blendMode->addItem( tr("Color"));
		blendMode->addItem( tr("Luminosity"));
		blendMode->addItem( tr("Multiply"));
		blendMode->addItem( tr("Screen"));
		blendMode->addItem( tr("Dissolve"));
		blendMode->addItem( tr("Overlay"));
		blendMode->addItem( tr("Hard Light"));
		blendMode->addItem( tr("Soft Light"));
		blendMode->addItem( tr("Difference"));
		blendMode->addItem( tr("Exclusion"));
		blendMode->addItem( tr("Color Dodge"));
		blendMode->addItem( tr("Color Burn"));
		layout1->addWidget( blendMode );
		textLabel2 = new QLabel( tab );
		textLabel2->setText( tr( "Opacity:" ) );
		layout1->addWidget( textLabel2 );
		opacitySpinBox = new QSpinBox( tab );
		opacitySpinBox->setMinimum(0);
		opacitySpinBox->setMaximum(100);
		opacitySpinBox->setSingleStep(10);
		opacitySpinBox->setSuffix( tr(" %"));
		layout1->addWidget( opacitySpinBox );
		tabLayout->addLayout( layout1 );
		layerTable = new QTableWidget(info->layerInfo.count(), 3, tab );
		layerTable->setHorizontalHeaderItem(0, new QTableWidgetItem(QIcon(loadIcon("16/show-object.png")), ""));
		layerTable->setHorizontalHeaderItem(1, new QTableWidgetItem(""));
		layerTable->setHorizontalHeaderItem(2, new QTableWidgetItem( tr("Name")));
		QHeaderView* headerH = layerTable->horizontalHeader();
		headerH->setStretchLastSection(true);
		headerH->setMovable(false);
		headerH->setClickable(false);
		if (info->layerInfo.count() == 1)
		{
			layerTable->setColumnWidth(1, 40);
			layerTable->setColumnWidth(0, 24);
		}
		layerTable->setSortingEnabled(false);
		layerTable->setSelectionBehavior( QAbstractItemView::SelectRows );
		QHeaderView *Header = layerTable->verticalHeader();
		Header->setMovable(false);
		Header->setResizeMode(QHeaderView::Fixed);
		Header->hide();
		FlagsSicht.clear();
		int col2Width = 0;
		int col1Width = 0;
		if (info->layerInfo.count() != 0)
		{
			if ((info->isRequest) && (info->RequestProps.contains(0)))
			{
				opacitySpinBox->setValue(qRound(info->RequestProps[0].opacity / 255.0 * 100));
				setCurrentComboItem(blendMode, blendModes[info->RequestProps[0].blend]);
			}
			else
			{
				opacitySpinBox->setValue(qRound(info->layerInfo[0].opacity / 255.0 * 100));
				setCurrentComboItem(blendMode, blendModes[info->layerInfo[0].blend]);
			}
			opacitySpinBox->setEnabled(true);
			blendMode->setEnabled(true);
			QString tmp;
			QList<PSDLayer>::iterator it2;
			uint counter = 0;
			for (it2 = info->layerInfo.begin(); it2 != info->layerInfo.end(); ++it2)
			{
				QCheckBox *cp = new QCheckBox((*it2).layerName, this);
				cp->setPalette(palette);
				QPixmap pm;
				pm=QPixmap::fromImage((*it2).thumb);
				col1Width = qMax(col1Width, pm.width());
				cp->setIcon(pm);
				FlagsSicht.append(cp);
				connect(cp, SIGNAL(clicked()), this, SLOT(changedLayer()));
				layerTable->setCellWidget(info->layerInfo.count()-counter-1, 0, cp);
				if ((info->isRequest) && (info->RequestProps.contains(counter)))
					cp->setChecked(info->RequestProps[counter].visible);
				else
					cp->setChecked(!((*it2).flags & 2));
				if (!(*it2).thumb_mask.isNull())
				{
					QCheckBox *cp2 = new QCheckBox((*it2).layerName, this);
					cp2->setPalette(palette);
					QPixmap pm2;
					pm2=QPixmap::fromImage((*it2).thumb_mask);
					col2Width = qMax(col2Width, pm2.width());
					cp2->setIcon(pm2);
					connect(cp2, SIGNAL(clicked()), this, SLOT(changedLayer()));
					layerTable->setCellWidget(info->layerInfo.count()-counter-1, 1, cp2);
					if ((info->isRequest) && (info->RequestProps.contains(counter)))
						cp2->setChecked(info->RequestProps[counter].useMask);
					else
						cp2->setChecked(true);
					FlagsMask.append(cp2);
				}
				else
					FlagsMask.append(0);
				QTableWidgetItem *tW = new QTableWidgetItem((*it2).layerName);
				tW->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
				layerTable->setItem(info->layerInfo.count()-counter-1, 2, tW);
				layerTable->setRowHeight(info->layerInfo.count()-counter-1, 40);
				counter++;
			}
		}
		tabLayout->addWidget( layerTable );
		layerTable->setColumnWidth(1, 24 + col2Width);
		layerTable->setColumnWidth(0, 24 + col1Width);
		blendMode->setCurrentIndex(0);
// 		headerH->setResizeMode(QHeaderView::Fixed);
		propsTab->addTab( tab,  tr( "Layers" ) );
	}
	tab_2 = new QWidget( propsTab );
	tabLayout_2 = new QVBoxLayout( tab_2 );
	tabLayout_2->setMargin(6);
	tabLayout_2->setSpacing(6);
	pathList = new QListWidget( tab_2 );
	pathList->clear();
	pathList->setIconSize(QSize(40, 40));
	QMap<QString, FPointArray>::Iterator it;
	if (info->PDSpathData.count() != 0)
	{
		for (it = info->PDSpathData.begin(); it != info->PDSpathData.end(); ++it)
		{
			QImage pixm(40, 40, QImage::Format_ARGB32);
			ScPainter *p = new ScPainter(&pixm, 40, 40);
			p->clear();
			p->translate(3.0, 3.0);
			if (it.key() == info->clipPath)
			{
				pixm.fill(Qt::green);
				p->clear(Qt::green);
			}
			else
				pixm.fill(Qt::white);
			FPointArray Path;
			Path.resize(0);
			Path = info->PDSpathData[it.key()].copy();
			FPoint min = getMinClipF(&Path);
			Path.translate(-min.x(), -min.y());
			FPoint max = Path.WidthHeight();
			QMatrix mm;
			mm.scale(34.0 / qMax(max.x(), max.y()), 34.0 / qMax(max.x(), max.y()));
			Path.map(mm);
			p->setupPolygon(&Path);
			p->setPen(Qt::black);
			p->setBrush(Qt::white);
			p->setFillMode(0);
			p->setLineWidth(1.0);
			p->strokePath();
			p->end();
			delete p;
			QPixmap pm;
			pm=QPixmap::fromImage(pixm);
			new QListWidgetItem(QIcon(pm), it.key(), pathList);
			if (it.key() == info->usedPath)
			{
				pathList->setCurrentRow(pathList->count()-1);
				pathList->currentItem()->setSelected(true);
			}
		}
	}
	tabLayout_2->addWidget( pathList );
	resetPath = new QPushButton( tr("Don't use any Path"), tab_2);
	tabLayout_2->addWidget( resetPath );
	propsTab->addTab( tab_2, tr( "Paths" ) );
	ExtImagePropsLayout->addWidget( propsTab );

	layoutBottom = new QHBoxLayout;
	layoutBottom->setMargin(0);
	layoutBottom->setSpacing(6);
	livePreview = new QCheckBox( this );
	livePreview->setText( tr( "Live Preview" ) );
	livePreview->setChecked(true);
	doPreview = true;
	layoutBottom->addWidget( livePreview );
	QSpacerItem* spacer = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
	layoutBottom->addItem( spacer );
	okButton = new QPushButton( CommonStrings::tr_OK, this );
	layoutBottom->addWidget( okButton );
	cancelButton = new QPushButton( CommonStrings::tr_Cancel, this );
	cancelButton->setDefault( true );
	layoutBottom->addWidget( cancelButton );
	ExtImagePropsLayout->addLayout( layoutBottom );
	resize(330, 320);

	connect(pathList, SIGNAL( itemClicked(QListWidgetItem*) ), this, SLOT( selPath(QListWidgetItem*) ) );
	connect(resetPath, SIGNAL(clicked()), this, SLOT(noPath()));
	connect(livePreview, SIGNAL(clicked()), this, SLOT(changePreview()));
	connect(okButton, SIGNAL(clicked()), this, SLOT(leaveOK()));
	connect(cancelButton, SIGNAL(clicked()), this, SLOT(leaveCancel()));
	if (info->layerInfo.count() != 0)
	{
		connect(layerTable, SIGNAL(cellClicked(int, int)), this, SLOT(selLayer(int)));
		connect(opacitySpinBox, SIGNAL(valueChanged(int)), this, SLOT(changedLayer()));
		connect(blendMode, SIGNAL(activated(int)), this, SLOT(changedLayer()));
	}