Exemplo n.º 1
0
MainFrame::MainFrame(const wxString &title, const wxPoint &pos, const wxSize &size)
	: wxFrame( NULL, -1, title, pos, size )
{
	/* set the global window handle */
	MAIN_FRAME = this;

	windowSize = size;

	/* set up the singleton object */
	fileHandler = FileListHandler::getInstance();

	wxImage::AddHandler( new wxPNGHandler );

	char *logoPath = (char *) malloc( MAX_PATH );
	strcpy(logoPath, APP_LOGO_NAME);
	MAIN_APP->getAbsoluteRunningPath( logoPath );

	wxIcon mainIcon(logoPath, wxBITMAP_TYPE_PNG, 32, 32);

	this->SetIcon(mainIcon);

	free(logoPath);

	mainMenuBar = new wxMenuBar();	/* create the main menu bar */

	file = new wxMenu;	/* create the "File" dropdown menu tab */
	file->Append( ID_FILE_ABOUT, "&About..");	/* add "About to the "File" dropdown menu */
	file->AppendSeparator();					/* adds a line separator to the menu beneath "File" */
	file->Append( ID_FILE_QUIT, "E&xit");

	view = new wxMenu;	/* create the "View" dropdown menu tab */
	view->AppendCheckItem( ID_VIEW_PERMISSIONS, "Permissions" );	/* adds a "checkable" menu item to "View" called "Permissions" */
	view->AppendSeparator();
	view->AppendCheckItem( ID_VIEW_SIZE, "File Size" );
	view->AppendSeparator();
	view->AppendCheckItem( ID_VIEW_MODIFIED, "Last Modified" );

	settings = new wxMenu;
	settings->Append( ID_SETTINGS_CONFIG, "Configuration" );

	newSync = new wxMenu;
	newSync->Append( ID_NEW_SYNC, "Add Sync Folder" );
	
	mainMenuBar->Append( file, "&File");	/* add the "File" dropdown tab to the main menu bar */
	mainMenuBar->Append( view, "&View");	
	mainMenuBar->Append( settings, "&Settings");
	mainMenuBar->Append( newSync, "&New");

	SetMenuBar( mainMenuBar );	/* set the main manu bar as the visible menu bar */

	this->CreateStatusBar();
	this->SetStatusText("File Syncing Complete");

	fileHandler->addColumn("File Name");
}
Exemplo n.º 2
0
void Ui::Ui_MainWindow::setupUi(){
  raw = 0;
	if (this->objectName().isEmpty())
		this->setObjectName(QString::fromUtf8("MainWindow"));
	QSettings settings(QSettings::IniFormat, QSettings::UserScope,"brainpower", "bp-nfoview");
	settings.setDefaultFormat(QSettings::IniFormat);
	resize(settings.value("general/width", 680).toInt(),settings.value("general/height", 720).toInt());
	QIcon mainIcon(":/img/logo.png");
	setWindowIcon(mainIcon);
	actionOpen = new QAction(this);
	actionOpen->setObjectName(QString::fromUtf8("actionOpen"));
	actionOpen->setShortcut(QKeySequence(QKeySequence::Open));
	actionSaveImage = new QAction(this);
	actionQuit = new QAction(this);
	actionQuit->setObjectName(QString::fromUtf8("actionQuit"));
	actionQuit->setShortcut(QKeySequence(QKeySequence::Quit));
	actionAbout = new QAction(this);
	actionAbout->setObjectName(QString::fromUtf8("actionAbout"));
	actionSB = new QAction(this);
	actionSB->setObjectName(QString::fromUtf8("actionSB"));
	actionSB->setCheckable(true);
	actionColor = new QAction(this);
	actionDefaultColor = new QAction(this);
	actionFont = new QAction(this);
	actionDefaultFont = new QAction(this);
	actionCodecUTF8 = new QAction(this);
	actionCodecUTF8->setCheckable(true);
	actionCodecCP437 = new QAction(this);
	actionCodecCP437->setCheckable(true);
	agCodec = new QActionGroup(this);
	actionCodecUTF8->setActionGroup(agCodec);
	actionCodecCP437->setActionGroup(agCodec);
	centralwidget = new QWidget(this);
	centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
	textEdit = new QTextEdit(centralwidget);
	textEdit->setObjectName(QString::fromUtf8("textEdit"));
	textEdit->setGeometry(QRect(0, 0, 671, 641));
	//sizePolicy.setHeightForWidth(textEdit->sizePolicy().hasHeightForWidth());
	//textEdit->setSizePolicy(sizePolicy);
	//QFont font = defaultFont;
	defaultFont.setFamily(QString::fromUtf8("DejaVu Sans Mono"));
	defaultFont.setPointSize(10);
	defaultFont.setStyleHint(QFont::Monospace);
	cFont = settings.value("GUI/font", defaultFont).value<QFont>();
	textEdit->setFont(cFont);
	textEdit->setAcceptDrops(false);
	textEdit->setFrameShape(QFrame::NoFrame);
	textEdit->setFrameShadow(QFrame::Plain);
	textEdit->setUndoRedoEnabled(false);
	textEdit->setReadOnly(true);
	textEdit->setLineWrapMode(QTextEdit::NoWrap);
	textEdit->setPalette(settings.value("GUI/colors", defaultPalette).value<QPalette>());
	//defaultPalette = textEdit->palette();
	setCentralWidget(centralwidget);
	menubar = new QMenuBar(this);
	menubar->setObjectName(QString::fromUtf8("menubar"));
	menubar->setGeometry(QRect(0, 0, 682, 28));
	menuFile = new QMenu(menubar);
	menuFile->setObjectName(QString::fromUtf8("menuFile"));
	menuView = new QMenu(menubar);
	menuViewCodec = new QMenu(menuView);
	menuHelp = new QMenu(menubar);
	menuHelp->setObjectName(QString::fromUtf8("menuHelp"));
	setMenuBar(menubar);
	statusbar = new QStatusBar(this);
	statusbar->setObjectName(QString::fromUtf8("statusbar"));
	//statusbar->setBackgroundRole(QPalette::Highlight);
	//statusbar->setAutoFillBackground(true);
	setStatusBar(statusbar);
	if(settings.value("general/sb", 23) == 23){
		actionSB->setChecked(true);
		sboffset = 23;
	} else{
		sboffset = 0;
		SBaction(false);
	}
	menubar->addAction(menuFile->menuAction());
	menubar->addAction(menuView->menuAction());
	menubar->addAction(menuHelp->menuAction());
	menuFile->addAction(actionOpen);
	menuFile->addAction(actionSaveImage);
	menuFile->addAction(actionQuit);
	menuView->addAction(actionSB);
	menuView->addAction(actionColor);
	menuView->addAction(actionDefaultColor);
	menuView->addAction(actionFont);
	menuView->addAction(actionDefaultFont);
	menuView->addAction(menuViewCodec->menuAction());
	menuHelp->addAction(actionAbout);
	menuViewCodec->addAction(actionCodecCP437);
	menuViewCodec->addAction(actionCodecUTF8);
	retranslateUi();
	updateGeometries();
	connect(actionSB, SIGNAL(toggled(bool)),this, SLOT(SBaction(bool)));
	connect(actionQuit, SIGNAL(triggered()),qApp, SLOT(quit()));
	connect(actionOpen, SIGNAL(triggered()),this, SLOT(OpenAction()));
	connect(actionAbout, SIGNAL(triggered()),this, SLOT(AboutAction()));
	connect(actionColor, SIGNAL(triggered()),this, SLOT(ColorAction()));
	connect(actionDefaultColor, SIGNAL(triggered()),this, SLOT(DefaultColorAction()));
	connect(actionFont, SIGNAL(triggered()),this, SLOT(FontAction()));
	connect(actionDefaultFont, SIGNAL(triggered()),this, SLOT(DefaultFontAction()));
	connect(actionSaveImage, SIGNAL(triggered()),this,SLOT(saveImageAction()));
	connect(actionCodecUTF8, SIGNAL(triggered()), this, SLOT(switchCodecUTF8Action()));
	connect(actionCodecCP437, SIGNAL(triggered()), this, SLOT(switchCodecCP437Action()));
	QMetaObject::connectSlotsByName(this);
} // setupUi