FormMain::FormMain(QWidget *parent)
  : QMainWindow(parent),
    m_statusProgress(new QProgressBar(this)),
    m_statusLabel(new QLabel(this)),
    m_centralArea(new QScrollArea(this)),
    m_centralLayout(new QVBoxLayout(m_centralArea)),
    m_firstTimeShow(true),
    m_ui(new Ui::FormMain),
    m_simulatorWindow(NULL) {
  m_ui->setupUi(this);

  m_normalTitle = APP_LONG_NAME;
  m_unsavedTitle = m_normalTitle + " *";

  m_statusProgress->setFixedHeight(m_ui->m_statusBar->sizeHint().height());

  // Addd necessary widgets to status.
  m_ui->m_statusBar->addWidget(m_statusProgress);
  m_ui->m_statusBar->addWidget(m_statusLabel, 1);
  m_statusLabel->setVisible(false);
  m_statusProgress->setVisible(false);

  setWindowTitle(m_normalTitle);

  // Disable "maximize" button.
  setWindowFlags(windowFlags() & ~Qt::WindowMaximizeButtonHint);

  m_centralArea->setFrameStyle(QFrame::NoFrame);

  setCentralWidget(m_centralArea);
  setupSimulatorWindow();
  setupActionShortcuts();
  setupIcons();
  setupTrayMenu();
  setupToolbar();
  loadSizeAndPosition();
  createConnections();

  //#if !defined(DEBUG)
#if defined(DISABLE_STORE)
  m_ui->m_actionUploadApplicationToStore->setVisible(false);
#else
  if (!qApp->settings()->value(APP_CFG_GEN, "enable_store", true).toBool()) {
    m_ui->m_actionUploadApplicationToStore->setVisible(false);
  }
#endif

#if defined(DISABLE_APK_GENERATION)
  m_ui->m_actionGenerateMobileApplication->setVisible(false);
#else
  if (!qApp->settings()->value(APP_CFG_GEN, "enable_apk_generation", true).toBool()) {
    m_ui->m_actionGenerateMobileApplication->setVisible(false);
  }
#endif
  //#endif

  // Make sure simulator window is displayed.
  m_ui->m_actionViewSimulatorWindow->setChecked(m_simulatorWindow->isVisibleOnStartup());
  m_ui->m_actionStickSimulatorWindow->setChecked(m_simulatorWindow->isSticked());
}
示例#2
0
//---------------------------------------------------------
// Implementations
//---------------------------------------------------------
//-------------------------------------
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), m_ui(new Ui::MainWindow), m_lblSongInfo(NULL) {
  m_ui->setupUi(this);
  m_ui->dockWidgetLyrics->setWindowTitle(tr("Lyrics"));
#ifdef Q_OS_WIN32
  if(QSysInfo::WindowsVersion == QSysInfo::WV_WINDOWS10)
    setStyleSheet("QToolBar { background-color: white;};");
#endif
  setupActions();
  setupTrayIcon();
  setupDockMenu();
  setupToolbar();
  connectSlots();
  restoreGeometryAndState();
  m_ui->stackedWidget->setCurrentIndex(PAGE_HOME);
  onPageChanged(PAGE_HOME);

  qApp->setWindowIcon(Icons::mellowPlayer());
  setWindowIcon(Icons::mellowPlayer());

  // Setup controllers
  new UpdateController(this);
  new PlayerController(this);
  new StreamingServicesController(this);
  new NotificationsController(this);
  new HotkeysController(this);
  new MPRIS2Controller(this);
  new LyricsController(this);
}
示例#3
0
Editor::Editor
(
	QWidget* parent,
	const char* name
)
    :
    QDialog( parent, name, true, 0 ), tiles(false)
{

    clean= true;
    numTiles=0;
    mode = insert;

    int sWidth = (BoardLayout::width+2)*(tiles.qWidth());
    int sHeight =( BoardLayout::height+2)*tiles.qHeight();

    sWidth += 4*tiles.shadowSize();

    drawFrame = new FrameImage( this, "drawFrame" );
    drawFrame->setGeometry( 10, 40 ,sWidth ,sHeight);
    drawFrame->setMinimumSize( 0, 0 );
    drawFrame->setMaximumSize( 32767, 32767 );
    drawFrame->setFocusPolicy( QWidget::NoFocus );
    drawFrame->setBackgroundMode( QWidget::PaletteBackground );
    drawFrame->setFrameStyle( 49 );
    drawFrame->setMouseTracking(true);

   // setup the tool bar
   setupToolbar();

   QVBoxLayout *layout = new QVBoxLayout(this, 1);
   layout->addWidget(topToolbar,0);
   layout->addWidget(drawFrame,1);
   layout->activate();

    resize( sWidth+60, sHeight+60);
    setMinimumSize( sWidth+60, sHeight+60);
    setMaximumSize( sWidth+60, sHeight+60);

   QString tile = Prefs::tileSet();
   tiles.loadTileset(tile);

   // tell the user what we do
   setCaption(kapp->makeStdCaption(i18n("Edit Board Layout")));


   connect( drawFrame, SIGNAL(mousePressed(QMouseEvent *) ),
		SLOT(drawFrameMousePressEvent(QMouseEvent *)));
   connect( drawFrame, SIGNAL(mouseMoved(QMouseEvent *) ),
		SLOT(drawFrameMouseMovedEvent(QMouseEvent *)));

   statusChanged();

   update();
}
示例#4
0
    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow( parent ),
        m_fileMenu{ menuBar()->addMenu( "&File" ) },
        m_preferenceMenu{ menuBar()->addMenu( "&Preference"  ) },

        m_toolbar{ addToolBar("Toolbar") },

        m_basicSearchAction{ new QAction( QIcon(":/images/search.png"), tr("&Search"), this ) },
        m_advancedSearchAction{ new QAction( QIcon(":/images/ad_search.png"), tr("Advanced Search"), this ) },
        m_directDownloadAction{ new QAction( QIcon(":/images/refresh.png"), tr("&Direct Download"), this ) },
        m_downloadAction{ new QAction( QIcon(":/images/download.png"), tr("&Download"),this ) },
        m_exitAction{ new QAction( QIcon(":/images/exit.png"), tr( "&Exit" ), this ) },
        m_aboutQt{ new QAction{ tr( "About Qt" ), this } },
        m_aboutHend{ new QAction{ tr( "About Hend" ), this } },

        m_toolbarViewMenu{ new QMenu{ "&Toolbar View" } },
        m_iconOnlyAction{ new QAction( tr( "Icon Only" ), this )},
        m_textOnlyAction{ new QAction("Text Only", this )},
        m_textBesideAction{ new QAction("Text Beside Icon", this )},
        m_textBelowAction{ new QAction("Text Below Icon", this )},
        m_hideToolbarAction{ new QAction("Hide Toolbar", this )},

        m_videoDisplayTable{ new QTableView },
        m_videoDetailsList{ new VideoDetails },
        m_filterList{ new QListWidget },

        m_filterByUploadDateButton{ new QPushButton("Filter by Upload Date") },
        m_filterByTypeButton{ new QPushButton("Filter by Type") },
        m_filterByDurationButton{ new QPushButton("Filter by Duration") },
        m_filterByFeaturesButton{ new QPushButton("Filter by Features") },
        m_filterBySortButton{ new QPushButton("Sort Videos") },

        m_networkManager{ new SyncNetworkAccessManager },
        m_proxyModel{ new CustomVideoFilterProxyModel },
        m_underlyingProxyTableModel{ nullptr }
    {
        setWindowTitle( tr( "Hend" ) );
        showMaximized();
        setWindowIcon( QIcon( ":/images/logo.png" ));

        setupMenubar();
        setupToolbar();
        setupActions();
        connectAllActions();

        setupWindowButtons();
        statusBar()->showMessage( "Done" );
    }
示例#5
0
FileBrowserWidget::FileBrowserWidget(KileDocument::Extensions *extensions, QWidget *parent) : QWidget(parent)
{
	m_configGroup = KConfigGroup(KGlobal::config(),"FileBrowserWidget");

	QVBoxLayout* layout = new QVBoxLayout(this);
	layout->setMargin(0);
	layout->setSpacing(0);
	setLayout(layout);

	m_toolbar = new KToolBar(this);
	m_toolbar->setMovable(false);
	m_toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
	m_toolbar->setContextMenuPolicy(Qt::NoContextMenu);
	layout->addWidget(m_toolbar);

	KFilePlacesModel* model = new KFilePlacesModel(this);
	m_urlNavigator = new KUrlNavigator(model, KUrl(QDir::homePath()), this);
	layout->addWidget(m_urlNavigator);
	connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)), SLOT(setDir(const KUrl&)));

	m_dirOperator = new KDirOperator(KUrl(), this);
	m_dirOperator->setViewConfig(m_configGroup);
	m_dirOperator->readConfig(m_configGroup);
	m_dirOperator->setView(KFile::Default);
	m_dirOperator->setMode(KFile::Files);
	setFocusProxy(m_dirOperator);

	connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)), m_dirOperator, SLOT(setFocus()));
	connect(m_dirOperator, SIGNAL(fileSelected(const KFileItem&)), this, SIGNAL(fileSelected(const KFileItem&)));
	connect(m_dirOperator, SIGNAL(urlEntered(const KUrl&)), this, SLOT(dirUrlEntered(const KUrl&)));

	// FileBrowserWidget filter for sidebar
	QString filter =  extensions->latexDocuments()
	                    + ' ' + extensions->latexPackages()
	                    + ' ' + extensions->bibtex()
	                    + ' ' +  extensions->metapost();
	filter.replace('.', "*.");
	m_dirOperator->setNameFilter(filter);

	setupToolbar();

	layout->addWidget(m_dirOperator);
	layout->setStretchFactor(m_dirOperator, 2);
	readConfig();
}
示例#6
0
Editor::Editor(QWidget *parent)
    : KDialog( parent ),
    tiles()
{
    setModal(true);
    clean = true;
    numTiles = 0;
    mode = insert;

    QWidget *mainWidget = new QWidget(this);
    setMainWidget(mainWidget);

    QGridLayout *gridLayout = new QGridLayout(mainWidget);
    QVBoxLayout *layout = new QVBoxLayout();

    // setup the tool bar
    setupToolbar();
    layout->addWidget(topToolbar);

    drawFrame = new FrameImage(this, QSize(0, 0));
    drawFrame->setFocusPolicy(Qt::NoFocus);
    drawFrame->setMouseTracking(true);

    layout->addWidget(drawFrame);
    gridLayout->addLayout(layout, 0, 0, 1, 1);

    //toolbar will set our minimum height
    setMinimumHeight(120);

    // tell the user what we do
    setCaption(i18n("Edit Board Layout"));

    connect(drawFrame, SIGNAL(mousePressed(QMouseEvent*)), this, SLOT(
        drawFrameMousePressEvent(QMouseEvent*)));
    connect(drawFrame, SIGNAL(mouseMoved(QMouseEvent*)), this, SLOT(
        drawFrameMouseMovedEvent(QMouseEvent*)));

    statusChanged();

    setButtons(KDialog::None);

    update();
}
示例#7
0
PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
    : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
{
    setCaption( QObject::tr("Opie Eye" ) );
    m_cfg = new Opie::Core::OConfig("opie-eye");
    m_cfg->setGroup("main" );
    readConfig();
    m_setDocCalled = false;
    m_polishDone = false;
    m_SmallWindow = QApplication::desktop()->size().width()<330;

    m_storage = new StorageInfo();
    connect(m_storage, SIGNAL(disksChanged() ),
            this, SLOT( dirChanged() ) );

    m_stack = new Opie::Ui::OWidgetStack( this );
    setCentralWidget( m_stack );

    m_view = new PIconView( m_stack, m_cfg );
    m_stack->addWidget( m_view, IconView );
    m_stack->raiseWidget( IconView );

    connect(m_view, SIGNAL(sig_display(const QString&)),
            this, SLOT(slotDisplay(const QString&)));
    connect(m_view, SIGNAL(sig_updateDisplay(const QString&)),
            this, SLOT(slotUpdateDisplay(const QString&)));
    connect(m_view, SIGNAL(sig_showInfo(const QString&)),
            this, SLOT(slotShowInfo(const QString&)) );
    connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int)));

    listviewMenu = 0;
    /* setup menu and toolbar */
    setupActions();
    setupToolbar();
    setupMenu();
    m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true));
    m_aAutoRotate->setEnabled(!m_aUnscaled->isOn());
    if (m_aForceSmall) {
        m_aForceSmall->setOn(m_cfg->readBoolEntry("dontshowseperate",true));
    }
    odebug << "mainwindow constructor done" << oendl;
}
示例#8
0
RTMainWindow::RTMainWindow(GameConfiguration& config, QWidget* parent) :
		QMainWindow(parent), popupTimer(NULL), popupNeedsRebuilding(true)
{
	setupButtons();
	setupToolbar();
	setupLayout(config);
	setWindowIcon(QIcon(QCoreApplication::applicationDirPath() +"/../img/logo.png"));
	setWindowTitle(QString("RoboTower GUI"));
	QObject::connect(startBtn, SIGNAL(clicked()), this, SLOT(startOnClick()));
	QObject::connect(stopBtn, SIGNAL(clicked()), this, SLOT(stopOnClick()));
	QObject::connect(newGameAction, SIGNAL(triggered()), this,
			SLOT(newGameClicked()));
	QObject::connect(currentGame, SIGNAL(togglePause()), this,
			SIGNAL(togglePause()));
	QFont font(this->font());
	font.setBold(true);
	font.setPointSize(font.pointSize() + 2);
	this->setFont(font);

}
示例#9
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui_(new Ui::MainWindow),
    swing_counter_(0),
    combo_counter_(0)
{
    ui_->setupUi(this);
    //int currentScreenWid = QApplication::desktop()->width();
    //int currentScreenHei = QApplication::desktop()->height();
    //setFixedSize(currentScreenWid, currentScreenHei);
    showMaximized();
    setupToolbar();
    setupSwingRightPopup();
    setupComboRightPopup();
    setupPositionsTab();
    setupWorkingOrdersTab();
    setupOrderHistoryTab();
    setupConnect();
//    setAttribute(Qt::WA_DeleteOnClose);
}
MainWindow::MainWindow(QWidget* parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    imageViewer = new ImageViewer(this);
    connect(imageViewer, SIGNAL(imageUpdated()), this, SLOT(updateTitle()));

    QScrollArea* scrollArea = new QScrollArea(this);
    scrollArea->setBackgroundRole(QPalette::NoRole);
    scrollArea->setWidget(imageViewer);
    this->setCentralWidget(scrollArea);

    setupToolbar();
    setWindowTitle(QString("%1 %2").arg(PROGRAM_NAME).arg(PROGRAM_VER));

    if (QFile(DEFAULT_IMG).exists())
        loadImage(DEFAULT_IMG);
}
示例#11
0
FileBrowserWidget::FileBrowserWidget(KileDocument::Extensions *extensions, QWidget *parent)
: QWidget(parent), m_extensions(extensions)
{
	m_configGroup = KConfigGroup(KSharedConfig::openConfig(),"FileBrowserWidget");

	QVBoxLayout* layout = new QVBoxLayout(this);
	layout->setMargin(0);
	layout->setSpacing(0);
	setLayout(layout);

	m_toolbar = new KToolBar(this);
	m_toolbar->setMovable(false);
	m_toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
	m_toolbar->setContextMenuPolicy(Qt::NoContextMenu);
	layout->addWidget(m_toolbar);

	KFilePlacesModel* model = new KFilePlacesModel(this);
	m_urlNavigator = new KUrlNavigator(model, QUrl::fromLocalFile(QDir::homePath()), this);
	layout->addWidget(m_urlNavigator);
	connect(m_urlNavigator, SIGNAL(urlChanged(const QUrl&)), SLOT(setDir(const QUrl&)));

	m_dirOperator = new KDirOperator(QUrl(), this);
	m_dirOperator->setViewConfig(m_configGroup);
	m_dirOperator->readConfig(m_configGroup);
	m_dirOperator->setView(KFile::Default);
	m_dirOperator->setMode(KFile::Files);
	setFocusProxy(m_dirOperator);

	connect(m_urlNavigator, SIGNAL(urlChanged(const QUrl&)), m_dirOperator, SLOT(setFocus()));
	connect(m_dirOperator, SIGNAL(fileSelected(const KFileItem&)), this, SIGNAL(fileSelected(const KFileItem&)));
	connect(m_dirOperator, SIGNAL(urlEntered(const QUrl&)), this, SLOT(dirUrlEntered(const QUrl&)));



	setupToolbar();

	layout->addWidget(m_dirOperator);
	layout->setStretchFactor(m_dirOperator, 2);
	readConfig();
}
示例#12
0
TreeView::TreeView(const QString &title, QWidget *parent, Qt::WindowFlags flags)
	: QDockWidget(title, parent, flags)
{
	setAllowedAreas(Qt::AllDockWidgetAreas);
	setObjectName("TreeView");

	setupTree();
	setupQuestionFrame();
	setupToolbar();


	frame = new QFrame();
	layout = new QVBoxLayout;  
	layout->setContentsMargins(4, 0, 4, 4);
	layout->addWidget(toolbar);
	layout->addWidget(questionFrame);
	layout->addWidget(tree);
	frame->setLayout(layout);
	setWidget(frame);

	updateActions();
}
示例#13
0
void KateFileSelector::readConfig(TDEConfig *config, const TQString & name)
{
  dir->setViewConfig( config, name + ":view" );
  dir->readConfig(config, name + ":dir");
  dir->setView( KFile::Default );
  dir->view()->setSelectionMode(KFile::Extended);
  config->setGroup( name );

  // set up the toolbar
  setupToolbar( config );

  cmbPath->setMaxItems( config->readNumEntry( "pathcombo history len", 9 ) );
  cmbPath->setURLs( config->readPathListEntry( "dir history" ) );
  // if we restore history
  if ( config->readBoolEntry( "restore location", true ) || kapp->isRestored() ) {
    TQString loc( config->readPathEntry( "location" ) );
    if ( ! loc.isEmpty() ) {
//       waitingDir = loc;
//       TQTimer::singleShot(0, this, TQT_SLOT(initialDirChangeHack()));
      setDir( loc );
    }
  }

  // else is automatic, as cmpPath->setURL is called when a location is entered.

  filter->setMaxCount( config->readNumEntry( "filter history len", 9 ) );
  filter->setHistoryItems( config->readListEntry("filter history"), true );
  lastFilter = config->readEntry( "last filter" );
  TQString flt("");
  if ( config->readBoolEntry( "restore last filter", true ) || kapp->isRestored() )
    flt = config->readEntry("current filter");
  filter->lineEdit()->setText( flt );
  slotFilterChange( flt );

  autoSyncEvents = config->readNumEntry( "AutoSyncEvents", 0 );
}
示例#14
0
/* GfxEntryPanel::GfxEntryPanel
 * GfxEntryPanel class constructor
 *******************************************************************/
GfxEntryPanel::GfxEntryPanel(wxWindow* parent)
	: EntryPanel(parent, "gfx")
{
	// Init variables
	prev_translation.addRange(TRANS_PALETTE, 0);
	offset_changing = false;

	// Add gfx canvas
	gfx_canvas = new GfxCanvas(this, -1);
	sizer_main->Add(gfx_canvas->toPanel(this), 1, wxEXPAND, 0);
	gfx_canvas->setViewType(GFXVIEW_DEFAULT);
	gfx_canvas->allowDrag(true);
	gfx_canvas->allowScroll(true);

	// Offsets
	spin_xoffset = new wxSpinCtrl(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxTE_PROCESS_ENTER, SHRT_MIN, SHRT_MAX, 0);
	spin_yoffset = new wxSpinCtrl(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxTE_PROCESS_ENTER, SHRT_MIN, SHRT_MAX, 0);
	spin_xoffset->SetMinSize(wxSize(64, -1));
	spin_yoffset->SetMinSize(wxSize(64, -1));
	sizer_bottom->Add(new wxStaticText(this, -1, "Offsets:"), 0, wxALIGN_CENTER_VERTICAL, 0);
	sizer_bottom->Add(spin_xoffset, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 4);
	sizer_bottom->Add(spin_yoffset, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);

	// Gfx (offset) type
	string offset_types[] ={ "Auto", "Graphic", "Sprite", "HUD" };
	choice_offset_type = new wxChoice(this, -1, wxDefaultPosition, wxDefaultSize, 4, offset_types);
	choice_offset_type->SetSelection(0);
	sizer_bottom->Add(choice_offset_type, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);

	// Auto offset
	btn_auto_offset = new wxBitmapButton(this, -1, Icons::getIcon(Icons::GENERAL, "offset"));
	btn_auto_offset->SetToolTip("Modify Offsets...");
	sizer_bottom->Add(btn_auto_offset, 0, wxALIGN_CENTER_VERTICAL);

	sizer_bottom->AddStretchSpacer();

	// Aspect ratio correction checkbox
	cb_arc = new wxCheckBox(this, -1, "Aspect Ratio Correction");
	cb_arc->SetValue(gfx_arc);
	sizer_bottom->Add(cb_arc, 0, wxEXPAND, 0);
	sizer_bottom->AddSpacer(8);

	// Tile checkbox
	cb_tile = new wxCheckBox(this, -1, "Tile");
	sizer_bottom->Add(cb_tile, 0, wxEXPAND, 0);
	sizer_bottom->AddSpacer(8);

	// Image selection buttons
	btn_nextimg = new wxBitmapButton(this, -1, Icons::getIcon(Icons::GENERAL, "right"));
	btn_previmg = new wxBitmapButton(this, -1, Icons::getIcon(Icons::GENERAL, "left"));
	text_curimg = new wxStaticText(this, -1, "Image XX/XX");
	btn_nextimg->Show(false);
	btn_previmg->Show(false);
	text_curimg->Show(false);

	// Palette chooser
	listenTo(theMainWindow->getPaletteChooser());

	// Custom menu
	menu_custom = new wxMenu();
	fillCustomMenu(menu_custom);
	custom_menu_name = "Graphic";

	// Custom toolbar
	custom_toolbar_actions = "pgfx_mirror;pgfx_flip;pgfx_rotate;pgfx_translate;pgfx_colourise;pgfx_tint;pgfx_pngopt";
	setupToolbar();

	// Bind Events
	slider_zoom->Bind(wxEVT_SLIDER, &GfxEntryPanel::onZoomChanged, this);
	spin_xoffset->Bind(wxEVT_SPINCTRL, &GfxEntryPanel::onXOffsetChanged, this);
	spin_yoffset->Bind(wxEVT_SPINCTRL, &GfxEntryPanel::onYOffsetChanged, this);
	spin_xoffset->Bind(wxEVT_TEXT_ENTER, &GfxEntryPanel::onXOffsetChanged, this);
	spin_yoffset->Bind(wxEVT_TEXT_ENTER, &GfxEntryPanel::onYOffsetChanged, this);
	choice_offset_type->Bind(wxEVT_CHOICE, &GfxEntryPanel::onOffsetTypeChanged, this);
	cb_tile->Bind(wxEVT_CHECKBOX, &GfxEntryPanel::onTileChanged, this);
	cb_arc->Bind(wxEVT_CHECKBOX, &GfxEntryPanel::onARCChanged, this);
	Bind(wxEVT_GFXCANVAS_OFFSET_CHANGED, &GfxEntryPanel::onGfxOffsetChanged, this, gfx_canvas->GetId());
	btn_nextimg->Bind(wxEVT_BUTTON, &GfxEntryPanel::onBtnNextImg, this);
	btn_previmg->Bind(wxEVT_BUTTON, &GfxEntryPanel::onBtnPrevImg, this);
	btn_auto_offset->Bind(wxEVT_BUTTON, &GfxEntryPanel::onBtnAutoOffset, this);

	// Apply layout
	Layout();
}
示例#15
0
// -----------------------------------------------------------------------------
// GfxEntryPanel class constructor
// -----------------------------------------------------------------------------
GfxEntryPanel::GfxEntryPanel(wxWindow* parent) : EntryPanel(parent, "gfx")
{
	// Init variables
	prev_translation_.addRange(TransRange::Type::Palette, 0);
	edit_translation_.addRange(TransRange::Type::Palette, 0);

	// Add gfx canvas
	gfx_canvas_ = new GfxCanvas(this, -1);
	sizer_main_->Add(gfx_canvas_->toPanel(this), 1, wxEXPAND, 0);
	gfx_canvas_->setViewType(GfxCanvas::View::Default);
	gfx_canvas_->allowDrag(true);
	gfx_canvas_->allowScroll(true);
	gfx_canvas_->setPalette(MainEditor::currentPalette());
	gfx_canvas_->setTranslation(&edit_translation_);

	// Offsets
	wxSize spinsize = { UI::px(UI::Size::SpinCtrlWidth), -1 };
	spin_xoffset_   = new wxSpinCtrl(
        this,
        -1,
        wxEmptyString,
        wxDefaultPosition,
        wxDefaultSize,
        wxSP_ARROW_KEYS | wxTE_PROCESS_ENTER,
        SHRT_MIN,
        SHRT_MAX,
        0);
	spin_yoffset_ = new wxSpinCtrl(
		this,
		-1,
		wxEmptyString,
		wxDefaultPosition,
		wxDefaultSize,
		wxSP_ARROW_KEYS | wxTE_PROCESS_ENTER,
		SHRT_MIN,
		SHRT_MAX,
		0);
	spin_xoffset_->SetMinSize(spinsize);
	spin_yoffset_->SetMinSize(spinsize);
	sizer_bottom_->Add(new wxStaticText(this, -1, "Offsets:"), 0, wxALIGN_CENTER_VERTICAL, 0);
	sizer_bottom_->Add(spin_xoffset_, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, UI::pad());
	sizer_bottom_->Add(spin_yoffset_, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, UI::pad());

	// Gfx (offset) type
	wxString offset_types[] = { "Auto", "Graphic", "Sprite", "HUD" };
	choice_offset_type_     = new wxChoice(this, -1, wxDefaultPosition, wxDefaultSize, 4, offset_types);
	choice_offset_type_->SetSelection(0);
	sizer_bottom_->Add(choice_offset_type_, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, UI::pad());

	// Auto offset
	btn_auto_offset_ = new SIconButton(this, "offset", "Modify Offsets...");
	sizer_bottom_->Add(btn_auto_offset_, 0, wxALIGN_CENTER_VERTICAL);

	sizer_bottom_->AddStretchSpacer();

	// Aspect ratio correction checkbox
	cb_arc_ = new wxCheckBox(this, -1, "Aspect Ratio Correction");
	cb_arc_->SetValue(gfx_arc);
	sizer_bottom_->Add(cb_arc_, 0, wxEXPAND, 0);
	sizer_bottom_->AddSpacer(UI::padLarge());

	// Tile checkbox
	cb_tile_ = new wxCheckBox(this, -1, "Tile");
	sizer_bottom_->Add(cb_tile_, 0, wxEXPAND, 0);
	sizer_bottom_->AddSpacer(UI::padLarge());

	// Image selection buttons
	btn_nextimg_ = new SIconButton(this, "right");
	btn_previmg_ = new SIconButton(this, "left");
	text_curimg_ = new wxStaticText(this, -1, "Image XX/XX");
	btn_nextimg_->Show(false);
	btn_previmg_->Show(false);
	text_curimg_->Show(false);

	// Palette chooser
	listenTo(theMainWindow->paletteChooser());

	// Custom menu
	menu_custom_ = new wxMenu();
	GfxEntryPanel::fillCustomMenu(menu_custom_);
	custom_menu_name_ = "Graphic";

	// Brushes menu
	menu_brushes_ = new wxMenu();
	fillBrushMenu(menu_brushes_);

	// Custom toolbar
	setupToolbar();

	// Bind Events
	cb_colour_->Bind(wxEVT_COLOURBOX_CHANGED, &GfxEntryPanel::onPaintColourChanged, this);
	spin_xoffset_->Bind(wxEVT_SPINCTRL, &GfxEntryPanel::onXOffsetChanged, this);
	spin_yoffset_->Bind(wxEVT_SPINCTRL, &GfxEntryPanel::onYOffsetChanged, this);
	spin_xoffset_->Bind(wxEVT_TEXT_ENTER, &GfxEntryPanel::onXOffsetChanged, this);
	spin_yoffset_->Bind(wxEVT_TEXT_ENTER, &GfxEntryPanel::onYOffsetChanged, this);
	choice_offset_type_->Bind(wxEVT_CHOICE, &GfxEntryPanel::onOffsetTypeChanged, this);
	cb_tile_->Bind(wxEVT_CHECKBOX, &GfxEntryPanel::onTileChanged, this);
	cb_arc_->Bind(wxEVT_CHECKBOX, &GfxEntryPanel::onARCChanged, this);
	Bind(wxEVT_GFXCANVAS_OFFSET_CHANGED, &GfxEntryPanel::onGfxOffsetChanged, this, gfx_canvas_->GetId());
	Bind(wxEVT_GFXCANVAS_PIXELS_CHANGED, &GfxEntryPanel::onGfxPixelsChanged, this, gfx_canvas_->GetId());
	Bind(wxEVT_GFXCANVAS_COLOUR_PICKED, &GfxEntryPanel::onColourPicked, this, gfx_canvas_->GetId());
	btn_nextimg_->Bind(wxEVT_BUTTON, &GfxEntryPanel::onBtnNextImg, this);
	btn_previmg_->Bind(wxEVT_BUTTON, &GfxEntryPanel::onBtnPrevImg, this);
	btn_auto_offset_->Bind(wxEVT_BUTTON, &GfxEntryPanel::onBtnAutoOffset, this);

	// Apply layout
	wxWindowBase::Layout();
}
示例#16
0
KateFileBrowser::KateFileBrowser(Kate::MainWindow *mainWindow,
                                 QWidget * parent, const char * name)
  : KVBox (parent)
  , m_mainWindow(mainWindow)
{
  setObjectName(name);

  m_toolbar = new KToolBar(this);
  m_toolbar->setMovable(false);
  m_toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
  m_toolbar->setContextMenuPolicy(Qt::NoContextMenu);

  // includes some actions, but not hooked into the shortcut dialog atm
  m_actionCollection = new KActionCollection(this);
  m_actionCollection->addAssociatedWidget(this);

  KFilePlacesModel* model = new KFilePlacesModel(this);
  m_urlNavigator = new KUrlNavigator(model, KUrl(QDir::homePath()), this);
  connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)), SLOT(updateDirOperator(const KUrl&)));

  m_dirOperator = new KDirOperator(KUrl(), this);
  m_dirOperator->setView(KFile::/* Simple */Detail);
  m_dirOperator->view()->setSelectionMode(QAbstractItemView::ExtendedSelection);
  m_dirOperator->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));

#if KDE_IS_VERSION(4, 4, 60)
  // Mime filter for the KDirOperator
  QStringList filter;
  filter << "text/plain" << "text/html" << "inode/directory";
  m_dirOperator->setNewFileMenuSupportedMimeTypes(filter);
#endif

  setFocusProxy(m_dirOperator);
  connect(m_dirOperator, SIGNAL(viewChanged(QAbstractItemView *)),
          this, SLOT(selectorViewChanged(QAbstractItemView *)));
  connect(m_urlNavigator, SIGNAL(returnPressed()),
          m_dirOperator, SLOT(setFocus()));
  // now all actions exist in dir operator and we can use them in the toolbar
  setupActions();
  setupToolbar();

  KHBox* filterBox = new KHBox(this);

  QLabel* filterLabel = new QLabel(i18n("Filter:"), filterBox);
  m_filter = new KHistoryComboBox(true, filterBox);
  filterLabel->setBuddy(m_filter);
  m_filter->setMaxCount(10);
  m_filter->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));

  connect(m_filter, SIGNAL(editTextChanged(const QString&)),
          SLOT(slotFilterChange(const QString&)));
  connect(m_filter, SIGNAL(returnPressed(const QString&)),
          m_filter, SLOT(addToHistory(const QString&)));
  connect(m_filter, SIGNAL(returnPressed(const QString&)),
          m_dirOperator, SLOT(setFocus()));

  connect(m_dirOperator, SIGNAL(urlEntered(const KUrl&)),
          this, SLOT(updateUrlNavigator(const KUrl&)));

  // Connect the bookmark handler
  connect(m_bookmarkHandler, SIGNAL(openUrl(const QString&)),
          this, SLOT(setDir(const QString&)));

  m_filter->setWhatsThis(i18n("Enter a name filter to limit which files are displayed."));

  connect(m_dirOperator, SIGNAL(fileSelected(const KFileItem&)), this, SLOT(fileSelected(const KFileItem&)));
  connect(m_mainWindow, SIGNAL(viewChanged()), this, SLOT(autoSyncFolder()));
}
示例#17
0
/**
 * @brief MainWindow::MainWindow
 * @param parent
 */
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    MainWindow::m_instance = this;

    qDebug() << "MediaElch version" << QApplication::applicationVersion() << "starting up";

    for (int i=WidgetMovies ; i!=WidgetCertifications ; i++) {
        QMap<MainActions, bool> actions;
        for (int n=ActionSearch ; n!=ActionExport ; n++) {
            actions.insert(static_cast<MainActions>(n), false);
        }
        if (static_cast<MainWidgets>(i) == WidgetMovies || static_cast<MainWidgets>(i) == WidgetTvShows || static_cast<MainWidgets>(i) == WidgetConcerts)
            actions[ActionFilterWidget] = true;
        m_actions.insert(static_cast<MainWidgets>(i), actions);
    }

    m_aboutDialog = new AboutDialog(ui->centralWidget);
    m_supportDialog = new SupportDialog(ui->centralWidget);
    m_settingsWindow = new SettingsWindow(ui->centralWidget);
    m_filterWidget = new FilterWidget();
    m_fileScannerDialog = new FileScannerDialog(ui->centralWidget);
    m_xbmcSync = new XbmcSync(ui->centralWidget);
    m_renamer = new Renamer(ui->centralWidget);
    m_settings = Settings::instance(this);
    m_exportDialog = new ExportDialog(this);
    setupToolbar();

    MessageBox::instance(this)->reposition(this->size());
    Manager::instance();

    if (!m_settings->mainSplitterState().isNull()) {
        ui->movieSplitter->restoreState(m_settings->mainSplitterState());
        ui->tvShowSplitter->restoreState(m_settings->mainSplitterState());
        ui->setsWidget->splitter()->restoreState(m_settings->mainSplitterState());
        ui->concertSplitter->restoreState(m_settings->mainSplitterState());
        ui->genreWidget->splitter()->restoreState(m_settings->mainSplitterState());
        ui->certificationWidget->splitter()->restoreState(m_settings->mainSplitterState());
    }

    if (m_settings->mainWindowSize().isValid() && !m_settings->mainWindowPosition().isNull()) {
        #ifdef Q_OS_MAC
            // Ugly workaround from https://bugreports.qt-project.org/browse/QTBUG-3116
            // to fix invisible toolbar on mac
            bool workaround = !isVisible();
            if (workaround) {
                // make "invisible"
                setWindowOpacity(0); // let Qt update its frameStruts
                show();
            }
            resize(m_settings->mainWindowSize());
            if (workaround) {
                move(m_settings->mainWindowPosition());
                setWindowOpacity(1);
            }
        #else
        resize(m_settings->mainWindowSize());
        move(m_settings->mainWindowPosition());
        #endif
        #ifdef Q_OS_WIN32
        if (m_settings->mainWindowMaximized())
            showMaximized();
        #endif
    }
    // Size for Screenshots
    // resize(1121, 735);

    #ifdef Q_OS_MAC
        MacFullscreen::addFullscreen(this);
    #endif

    connect(ui->filesWidget, SIGNAL(movieSelected(Movie*)), ui->movieWidget, SLOT(setMovie(Movie*)));
    connect(ui->filesWidget, SIGNAL(movieSelected(Movie*)), ui->movieWidget, SLOT(setEnabledTrue(Movie*)));
    connect(ui->filesWidget, SIGNAL(noMovieSelected()), ui->movieWidget, SLOT(clear()));
    connect(ui->filesWidget, SIGNAL(noMovieSelected()), ui->movieWidget, SLOT(setDisabledTrue()));
    connect(ui->filesWidget, SIGNAL(sigStartSearch()), this, SLOT(onActionSearch()));

    connect(ui->concertFilesWidget, SIGNAL(concertSelected(Concert*)), ui->concertWidget, SLOT(setConcert(Concert*)));
    connect(ui->concertFilesWidget, SIGNAL(concertSelected(Concert*)), ui->concertWidget, SLOT(setEnabledTrue(Concert*)));
    connect(ui->concertFilesWidget, SIGNAL(noConcertSelected()), ui->concertWidget, SLOT(clear()));
    connect(ui->concertFilesWidget, SIGNAL(noConcertSelected()), ui->concertWidget, SLOT(setDisabledTrue()));

    connect(ui->tvShowFilesWidget, SIGNAL(sigTvShowSelected(TvShow*)), ui->tvShowWidget, SLOT(onTvShowSelected(TvShow*)));
    connect(ui->tvShowFilesWidget, SIGNAL(sigSeasonSelected(TvShow*,int)), ui->tvShowWidget, SLOT(onSeasonSelected(TvShow*,int)));
    connect(ui->tvShowFilesWidget, SIGNAL(sigEpisodeSelected(TvShowEpisode*)), ui->tvShowWidget, SLOT(onEpisodeSelected(TvShowEpisode*)));
    connect(ui->tvShowFilesWidget, SIGNAL(sigTvShowSelected(TvShow*)), ui->tvShowWidget, SLOT(onSetEnabledTrue(TvShow*)));
    connect(ui->tvShowFilesWidget, SIGNAL(sigSeasonSelected(TvShow*,int)), ui->tvShowWidget, SLOT(onSetEnabledTrue(TvShow*, int)));
    connect(ui->tvShowFilesWidget, SIGNAL(sigEpisodeSelected(TvShowEpisode*)), ui->tvShowWidget, SLOT(onSetEnabledTrue(TvShowEpisode*)));
    connect(ui->tvShowFilesWidget, SIGNAL(sigNothingSelected()), ui->tvShowWidget, SLOT(onClear()));
    connect(ui->tvShowFilesWidget, SIGNAL(sigNothingSelected()), ui->tvShowWidget, SLOT(onSetDisabledTrue()));

    connect(ui->movieWidget, SIGNAL(actorDownloadProgress(int,int,int)), this, SLOT(progressProgress(int,int,int)));
    connect(ui->movieWidget, SIGNAL(actorDownloadStarted(QString,int)), this, SLOT(progressStarted(QString,int)));
    connect(ui->movieWidget, SIGNAL(actorDownloadFinished(int)), this, SLOT(progressFinished(int)));

    connect(ui->tvShowWidget, SIGNAL(sigDownloadsStarted(QString,int)), this, SLOT(progressStarted(QString,int)));
    connect(ui->tvShowWidget, SIGNAL(sigDownloadsProgress(int,int,int)), this, SLOT(progressProgress(int,int,int)));
    connect(ui->tvShowWidget, SIGNAL(sigDownloadsFinished(int)), this, SLOT(progressFinished(int)));

    connect(m_filterWidget, SIGNAL(sigFilterChanged(QList<Filter*>,QString)), this, SLOT(onFilterChanged(QList<Filter*>,QString)));

    connect(ui->movieSplitter, SIGNAL(splitterMoved(int,int)), this, SLOT(moveSplitter(int,int)));
    connect(ui->tvShowSplitter, SIGNAL(splitterMoved(int,int)), this, SLOT(moveSplitter(int,int)));
    connect(ui->setsWidget->splitter(), SIGNAL(splitterMoved(int,int)), this, SLOT(moveSplitter(int,int)));
    connect(ui->genreWidget->splitter(), SIGNAL(splitterMoved(int,int)), this, SLOT(moveSplitter(int,int)));
    connect(ui->certificationWidget->splitter(), SIGNAL(splitterMoved(int,int)), this, SLOT(moveSplitter(int,int)));
    connect(ui->concertSplitter, SIGNAL(splitterMoved(int,int)), this, SLOT(moveSplitter(int,int)));

    connect(Manager::instance()->tvShowFileSearcher(), SIGNAL(tvShowsLoaded(int)), ui->tvShowFilesWidget, SLOT(renewModel()));
    connect(m_fileScannerDialog, SIGNAL(accepted()), this, SLOT(setNewMarks()));

    connect(m_xbmcSync, SIGNAL(sigTriggerReload()), this, SLOT(onTriggerReloadAll()));
    connect(m_xbmcSync, SIGNAL(sigFinished()), this, SLOT(onXbmcSyncFinished()));

    connect(m_renamer, SIGNAL(sigFilesRenamed(Renamer::RenameType)), this, SLOT(onFilesRenamed(Renamer::RenameType)));

    connect(m_settingsWindow, SIGNAL(sigSaved()), this, SLOT(onRenewModels()), Qt::QueuedConnection);

    connect(ui->setsWidget, SIGNAL(sigJumpToMovie(Movie*)), this, SLOT(onJumpToMovie(Movie*)));
    connect(ui->certificationWidget, SIGNAL(sigJumpToMovie(Movie*)), this, SLOT(onJumpToMovie(Movie*)));
    connect(ui->genreWidget, SIGNAL(sigJumpToMovie(Movie*)), this, SLOT(onJumpToMovie(Movie*)));

    MovieSearch::instance(ui->centralWidget);
    TvShowSearch::instance(ui->centralWidget);
    ImageDialog::instance(ui->centralWidget);
    MovieListDialog::instance(ui->centralWidget);
    ImagePreviewDialog::instance(ui->centralWidget);
    ConcertSearch::instance(ui->centralWidget);
    TrailerDialog::instance(ui->centralWidget);
    TvTunesDialog::instance(ui->centralWidget);
    NameFormatter::instance(this);
    MovieMultiScrapeDialog::instance(ui->centralWidget);

#ifdef Q_OS_WIN32
    setStyleSheet(styleSheet() + " #centralWidget { border-bottom: 1px solid rgba(0, 0, 0, 100); } ");

    QFont font = ui->labelMovies->font();
    font.setPointSize(font.pointSize()-3);
    font.setBold(true);
    ui->labelMovies->setFont(font);
    ui->labelConcerts->setFont(font);
    ui->labelShows->setFont(font);
#endif

    // hack. without only the fileScannerDialog pops up and blocks until it has finished
    show();
    onMenu(WidgetMovies);

    // Start scanning for files
    QTimer::singleShot(0, m_fileScannerDialog, SLOT(exec()));
}