Esempio n. 1
0
PrefWindow::PrefWindow(const BMessenger &messenger)
	: BWindow(BRect(0, 0, 375, 185), B_TRANSLATE("Terminal settings"),
		B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
		B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_AUTO_UPDATE_SIZE_LIMITS),
	fPreviousPref(new PrefHandler(PrefHandler::Default())),
	fSavePanel(NULL),
	fDirty(false),
	fTerminalMessenger(messenger)
{
	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.AddGroup(B_VERTICAL)
		.SetInsets(10, 10, 10, 10)
			.Add(new AppearancePrefView(B_TRANSLATE("Appearance"),
				fTerminalMessenger))
			.AddGroup(B_HORIZONTAL)
				.Add(fSaveAsFileButton = new BButton("savebutton",
					B_TRANSLATE("Save to file" B_UTF8_ELLIPSIS),
					new BMessage(MSG_SAVEAS_PRESSED), B_WILL_DRAW))
				.AddGlue()
				.Add(fRevertButton = new BButton("revertbutton",
					B_TRANSLATE("Cancel"), new BMessage(MSG_REVERT_PRESSED),
					B_WILL_DRAW))
				.Add(fSaveButton = new BButton("okbutton", B_TRANSLATE("OK"),
					new BMessage(MSG_SAVE_PRESSED), B_WILL_DRAW))
			.End()
		.End();

	fSaveButton->MakeDefault(true);

	AddShortcut('Q', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
	AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));

	CenterOnScreen();
	Show();
}
Esempio n. 2
0
SaveIdea::SaveIdea(const BMessage &msg, const BMessenger &msgr, float mainX, float mainY, int currentID)
	:	BWindow(BRect(0, 0, 358, 60), "Save As", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS, B_CURRENT_WORKSPACE), updatetitleMessage(msg), updatetitleMessenger(msgr)
{
	// initialize controls
	AddShortcut(B_TAB, B_COMMAND_KEY, new BMessage(END_SAVE_IDEA));
	AddShortcut(B_ENTER, B_COMMAND_KEY, new BMessage(SAVE_IDEA));
	AddShortcut(B_ESCAPE, B_COMMAND_KEY, new BMessage(CANCEL_SAVE));
	SetDefaultButton(saveButton);
	BRect textFrame(0, 0, 300, 10);
	titleText = new BTextView(textFrame, NULL, textFrame, B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW);
	titleText->MakeResizable(false);
	titleText->SetWordWrap(false);
	titleText->DisallowChar(B_ENTER);
	titleString = new BStringView(BRect(10, 10, 200, 30), NULL, "Enter Thought Title:");
	saveButton = new BButton(BRect(190, 50, 270, 75), NULL, "Save", new BMessage(SAVE_IDEA));
	cancelButton = new BButton(BRect(190, 50, 270, 75), NULL, "Cancel", new BMessage(CANCEL_SAVE));
	backView = new BView(Bounds(), "backview", B_FOLLOW_ALL, B_WILL_DRAW);
	backView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(backView);
	// gui layout builder
	backView->SetLayout(new BGroupLayout(B_HORIZONTAL, 0.0));
	backView->AddChild(BGridLayoutBuilder()
		.Add(titleString, 0, 0, 2, 1)
		.Add(titleText, 2, 0, 3, 1)
		.Add(cancelButton, 3, 1)
		.Add(saveButton, 4, 1)
		.Add(BSpaceLayoutItem::CreateGlue(), 0, 2, 2, 1)
		.SetInsets(2, 5, 2, 2)
	);
	MoveTo(mainX, mainY); // move to window position
	
	currentideaID = currentID; // make current idea id available to 
}
Esempio n. 3
0
GX_BDirectWindow::GX_BDirectWindow(BRect window_rect, const char *pTitle)
: BDirectWindow(window_rect, pTitle, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_RESIZABLE|B_NOT_ZOOMABLE)
{
    m_pInstance = this;
	m_bConnected = false;
	m_bDirty = false;

	BView *view = g_pApp->CreateSubview(this);
	if (view)
	{
	   AddChild(view);
	}
	AddShortcut('\n', B_COMMAND_KEY, new BMessage(MSG_SYSAPPLICATION_SWITCHFS));
	AddShortcut('x', B_COMMAND_KEY, new BMessage(MSG_SYSAPPLICATION_CLOSE));

	m_SemID = create_sem(1, "BDirectWindow lock sem");

	m_DrawThread = spawn_thread(RenderThread, "drawing_thread", B_NORMAL_PRIORITY, (void *) this);
	if (m_DrawThread<0)
	{
		printf("Can't spawn drawing thread, bailing out...\n" );
	}
	Center();

	resume_thread(m_DrawThread);
}
Esempio n. 4
0
/***********************************************************
 * Constructor
 ***********************************************************/
HAddUrlDlg::HAddUrlDlg(BRect rect, const char* url)
	: BWindow(rect, _("Add URLs"), B_DOCUMENT_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NOT_ZOOMABLE) {
	InitGUI();
	AddShortcut(B_RETURN, 0, new BMessage(M_OK_MESSAGE));
	AddShortcut('W', 0, new BMessage(B_QUIT_REQUESTED));
	if (url)
		fURLView->Insert(url);
	fURLView->MakeFocus(true);
}
void WiimoteSettingsPage::AddAction() {
  emit SetWiimotedevInterfaceActived(false);
  WiimoteShortcutGrabber grabber(0, ui_->wiimotedev_device->value(), this);
  connect(&grabber, SIGNAL(AddShortcut(quint64, quint32)), this,
          SLOT(AddShortcut(quint64, quint32)), Qt::QueuedConnection);
  grabber.exec();
  emit SetWiimotedevInterfaceActived(true);

  ui_->list->sortItems(1, Qt::AscendingOrder);
}
Esempio n. 6
0
/*
 * BLSettingsWindow(BRect frame);
 *
 * The constructor of the window adds the child to the view chain
 */
BLSettingsWindow::BLSettingsWindow(BRect frame, BLSettings* bls)
: BWindow(frame, SETTINGS_TITLE_WINDOW, B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE), Settings(bls)
{
	/* Offset to windows coordinates*/
	frame.OffsetTo(B_ORIGIN);
	BTab* tab;

	/* Create the background box (grey) */
	Box = new BBox(frame, "Background", B_FOLLOW_ALL_SIDES, B_PLAIN_BORDER);
	AddChild(Box);
	
	/* Create our rect and inset it by 5 px */
	BRect r = Bounds();
	r.InsetBy(5, 5);

	/* Create a TabView, and set its color. Then add it to the Box's Hierachy */
	TabView = new BTabView(r, "tabview");
	TabView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	Box->AddChild(TabView);

	/* Calc the size of the views and inset by 5 px*/
	r = TabView->Bounds();
	r.InsetBy(5, 5);
	r.bottom -= TabView->TabHeight();
	
	/* Create the users tab */
	tab = new BTab();
	UserView = new BLSettingsUserView(r, Settings);
	TabView->AddTab(UserView, tab);
	tab->SetLabel("Users");
	
	/* Create the Blocked tab */
	tab = new BTab();
	BlockedView = new BLSettingsBlockedView(r, Settings);
	TabView->AddTab(BlockedView, tab);
	tab->SetLabel("Blocked");

	/* Create the Runnable tab */
	tab = new BTab();
	RunnableView = new BLSettingsRunnableView(r, Settings);
	TabView->AddTab(RunnableView, tab);
	tab->SetLabel("Runnable");

	/* Select the first one (users) */
	TabView->Select(0);

	/* Add some shortcuts */
	AddShortcut('A', B_COMMAND_KEY, new BMessage(B_ABOUT_REQUESTED));
	AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
	AddShortcut('Q', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
}
void SSessionConsoleShortcutWindow::LoadShortcuts()
{
	//clear out list of commands
	Shortcuts.Empty();

	//read file
	FString Content;
	FFileHelper::LoadFileToString(Content, *GetShortcutFilename());

	TSharedPtr<FJsonObject> ShortcutStream;
	TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create( Content );
	bool bResult = FJsonSerializer::Deserialize( Reader, ShortcutStream );

	if (ShortcutStream.IsValid())
	{
		int32 CommandCount = ShortcutStream->GetNumberField(TEXT("Count"));
		for (int32 i = 0; i < CommandCount; ++i)
		{
			FString Name = ShortcutStream->GetStringField(FString::Printf(TEXT("Shortcut.%d.Name"), i));
			FString Command = ShortcutStream->GetStringField(FString::Printf(TEXT("Shortcut.%d.Command"), i));

			AddShortcut(Name, Command);
		}
	}
}
void GlobalShortcuts::AddRatingShortcut(const QString& id, const QString& name,
                                        QSignalMapper* mapper, int rating,
                                        const QKeySequence& default_key) {
  Shortcut shortcut = AddShortcut(id, name, default_key);
  connect(shortcut.action, SIGNAL(triggered()), mapper, SLOT(map()));
  mapper->setMapping(shortcut.action, rating);
}
void WiimoteSettingsPage::Load() {
  QSettings s;
  s.beginGroup(WiimotedevShortcuts::kSettingsGroup);
  ui_->wiimotedev_enable->setChecked(s.value("enabled", false).toBool());
  ui_->wiimotedev_active->setChecked(
      s.value("use_active_action", true).toBool());
  ui_->wiimotedev_focus->setChecked(
      s.value("only_when_focused", false).toBool());
  ui_->wiimotedev_notification->setChecked(
      s.value("use_notification", true).toBool());
  ui_->wiimotedev_device->setValue(s.value("device", 1).toUInt());
  bool first_conf = s.value("first_conf", true).toBool();
  s.endGroup();

  if (first_conf) {
    DefaultSettings();
    return;
  }

  s.beginGroup(WiimotedevShortcuts::kActionsGroup);
  ui_->list->clear();
  actions_.clear();

  quint64 fvalue, svalue;
  bool fvalid, svalid;

  for (const QString& str : s.allKeys()) {
    fvalue = str.toULongLong(&fvalid, 10);
    svalue = s.value(str, 0).toULongLong(&svalid);
    if (fvalid && svalid) AddShortcut(fvalue, svalue);
  }
  s.endGroup();

  ui_->list->sortItems(1, Qt::AscendingOrder);
}
Esempio n. 10
0
TTimeWindow::TTimeWindow(BRect rect)
	: BWindow(rect, "Time", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
{
	_InitWindow();
	_AlignWindow();

	AddShortcut('A', B_COMMAND_KEY, new BMessage(B_ABOUT_REQUESTED));
}
Esempio n. 11
0
MainWindow::MainWindow()
	:
	BWindow(BRect(0, 0, 300, 400), "Caya", B_TITLED_WINDOW, 0),
	fWorkspaceChanged(false)
{
	fStatusView = new StatusView("statusView");

	SearchBarTextControl* searchBox = 
		new SearchBarTextControl(new BMessage(kSearchContact));

	fListView = new RosterListView("buddyView");
	fListView->SetInvocationMessage(new BMessage(CAYA_OPEN_CHAT_WINDOW));
	BScrollView* scrollView = new BScrollView("scrollview", fListView,
		B_WILL_DRAW, false, true);

	// Wrench menu
	BPopUpMenu* wrenchMenu = new BPopUpMenu("Wrench");
	(void)wrenchMenu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS,
		new BMessage(B_ABOUT_REQUESTED)));
	(void)wrenchMenu->AddItem(new BSeparatorItem());
	(void)wrenchMenu->AddItem(new BMenuItem("Preferences" B_UTF8_ELLIPSIS,
		new BMessage(CAYA_SHOW_SETTINGS)));
	(void)wrenchMenu->AddItem(new BSeparatorItem());
	(void)wrenchMenu->AddItem(new BMenuItem("Quit",
		new BMessage(B_QUIT_REQUESTED)));
	wrenchMenu->SetTargetForItems(this);

	// Tool icon
	BResources* res = CayaResources();
	BBitmap* toolIcon = IconFromResources(res, kToolIcon);
	delete res;

	// Wrench tool button
	ToolButton* wrench = new ToolButton(NULL, NULL);
	wrench->SetBitmap(toolIcon);
	wrench->SetMenu(wrenchMenu);

	SetLayout(new BGridLayout(1, 2));
	AddChild(BGridLayoutBuilder(1, 2)
		.Add(searchBox, 0, 0)
		.Add(wrench, 1, 0)
		.Add(scrollView, 0, 1, 2)
		.Add(fStatusView, 0, 2, 2)
		.SetInsets(5, 5, 5, 10)
	);

	AddShortcut('a', B_COMMAND_KEY, new BMessage(B_ABOUT_REQUESTED));
	MoveTo(BAlert::AlertPosition(Bounds().Width(), Bounds().Height() / 2));

	// Filter messages using Server
	fServer = new Server();
	AddFilter(fServer);

	CenterOnScreen();

	//TODO check for errors here
	ReplicantStatusView::InstallReplicant();
}
Esempio n. 12
0
void HelpWindow::AddFurnitureManipulationInformation(int column)
{
    auto furnitureManiuplationGrid = new HelpWindowGridLayout();
    furnitureManiuplationGrid->AddHeading("Furniture Object Manipulation");
    furnitureManiuplationGrid->AddTitle("Movement");
    furnitureManiuplationGrid->AddDescription("");
    furnitureManiuplationGrid->AddShortcut("X + Left Click Drag\nY + Left Click Drag\nZ + Left Click Drag");
    furnitureManiuplationGrid->AddDescription(QString("<b>Move mouse up/down:</b> Move object ")
                                              .append("in the positive/negative direction of the axis ")
                                              .append("corresponding to X, Y, and Z"));
    furnitureManiuplationGrid->AddTitle("Rotation");
    furnitureManiuplationGrid->AddDescription("");
    furnitureManiuplationGrid->AddShortcut("X + Left Click Drag\nY + Left Click Drag\nZ + Left Click Drag");
    furnitureManiuplationGrid->AddDescription(QString("<b>Move mouse up/down:</b> rotate object ")
                                              .append("in the positive/negative angle direction of the axis ")
                                              .append("corresponding to X, Y, and Z"));
    furnitureManiuplationGrid->AddTitle("Scale");
    furnitureManiuplationGrid->AddDescription("");
    furnitureManiuplationGrid->AddShortcut("Left Click Drag");
    furnitureManiuplationGrid->AddDescription("<b>Move mouse up/down</b>: uniformly scale the object up/down");
    furnitureManiuplationGrid->AddShortcut("N");
    furnitureManiuplationGrid->AddDescription("Cycle wall-mounted furnitures between the walls");
    furnitureManiuplationGrid->AddShortcut("DELETE");
    furnitureManiuplationGrid->AddDescription("Remove the currently selected object from the scene");
    furnitureManiuplationGrid->AddShortcut("SPACE");
    furnitureManiuplationGrid->AddDescription("Cycle through exising objects");
    furnitureManiuplationGrid->AddShortcut("ESCAPE");
    furnitureManiuplationGrid->AddDescription("De-select the currently selected object");
    AddToColumn(furnitureManiuplationGrid, column);

}
HelperWindows::HelperWindows(BRect frame, const char* title)
	:	BWindow(frame, title, B_TITLED_WINDOW, B_NOT_H_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS, B_CURRENT_WORKSPACE)
{
	AddShortcut('q', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
	backView = new BView(Bounds(), "backview", B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE);
	backView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	backView->SetHighColor((rgb_color){0, 0, 0, 255});
	AddChild(backView);
}
Esempio n. 14
0
void HelpWindow::AddUtilitiesInformation(int column)
{
    auto utilitiesGrid = new HelpWindowGridLayout();
    utilitiesGrid->AddHeading("Utilities");
    utilitiesGrid->AddShortcut("B");
    utilitiesGrid->AddDescription("Display objects' oriented bounding boxes");
    utilitiesGrid->AddShortcut("SHIFT + B");
    utilitiesGrid->AddDescription("Display objects' axis-aligned bounding boxes");
    utilitiesGrid->AddShortcut("L");
    utilitiesGrid->AddDescription("Display objects' pivots");
    utilitiesGrid->AddShortcut("X\nY\nZ");
    utilitiesGrid->AddDescription(QString("Display <b>X, Y</b> or <b>Z</b> axis aligned to ")
                                  .append("the center of the room ")
                                  .append("or aligned to currently selected object's location"));
    utilitiesGrid->AddShortcut("Q");
    utilitiesGrid->AddDescription("Quit the application (no confirmation window!)");
    AddToColumn(utilitiesGrid, column);
}
Esempio n. 15
0
TTimeWindow::TTimeWindow()
	:
	BWindow(BRect(0, 0, 0, 0), B_TRANSLATE_SYSTEM_NAME("Time"), B_TITLED_WINDOW,
		B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{
	_InitWindow();
	_AlignWindow();

	AddShortcut('A', B_COMMAND_KEY, new BMessage(B_ABOUT_REQUESTED));
}
Esempio n. 16
0
void WiimoteSettingsPage::DefaultSettings() {
  ui_->list->clear();
  actions_.clear();

  AddShortcut(WIIMOTE_BTN_LEFT, WiimotedevShortcuts::PlayerPreviousTrack);
  AddShortcut(WIIMOTE_BTN_RIGHT, WiimotedevShortcuts::PlayerNextTrack);
  AddShortcut(WIIMOTE_BTN_SHIFT_LEFT, WiimotedevShortcuts::PlayerPreviousTrack);
  AddShortcut(WIIMOTE_BTN_SHIFT_RIGHT, WiimotedevShortcuts::PlayerNextTrack);
  AddShortcut(WIIMOTE_BTN_PLUS, WiimotedevShortcuts::PlayerIncVolume);
  AddShortcut(WIIMOTE_BTN_MINUS, WiimotedevShortcuts::PlayerDecVolume);
  AddShortcut(WIIMOTE_BTN_1, WiimotedevShortcuts::PlayerTogglePause);
  AddShortcut(WIIMOTE_BTN_2, WiimotedevShortcuts::PlayerShowOSD);
  AddShortcut(WIIMOTE_BTN_A, WiimotedevShortcuts::WiimotedevActiveDeactive);

  ui_->list->sortItems(1, Qt::AscendingOrder);
}
Esempio n. 17
0
PrefWindow::PrefWindow(const BMessenger& messenger)
	:
	BWindow(BRect(0, 0, 375, 185), "Terminal settings",
		B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
		B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
	fPreviousPref(new PrefHandler(PrefHandler::Default())),
	fSavePanel(NULL),
	fDirty(false),
	fTerminalMessenger(messenger)
{
	BString app = B_TRANSLATE_SYSTEM_NAME("Terminal");
	BString title = B_TRANSLATE_COMMENT("%app% settings", "window title");
	title.ReplaceFirst("%app%", app);
	SetTitle(title);

	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.AddGroup(B_VERTICAL)
		.SetInsets(10, 10, 10, 10)
			.Add(fAppearanceView = new AppearancePrefView(
				B_TRANSLATE("Appearance"), fTerminalMessenger))
			.AddGroup(B_HORIZONTAL)
				.Add(fDefaultsButton = new BButton("defaultsbutton",
					B_TRANSLATE("Defaults"), new BMessage(MSG_DEFAULTS_PRESSED),
					B_WILL_DRAW))
				.Add(fRevertButton = new BButton("revertbutton",
					B_TRANSLATE("Revert"), new BMessage(MSG_REVERT_PRESSED),
					B_WILL_DRAW))
				.AddGlue()
				.Add(fSaveAsFileButton = new BButton("savebutton",
					B_TRANSLATE("Save to file" B_UTF8_ELLIPSIS),
					new BMessage(MSG_SAVEAS_PRESSED), B_WILL_DRAW))
			.End()
		.End();

	fRevertButton->SetEnabled(fDirty);

	AddShortcut('Q', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
	AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));

	CenterOnScreen();
	Show();
}
Esempio n. 18
0
BrowserWindow::BrowserWindow()
	: BWindow(BRect(100, 100, 400, 400), "Tranquility", B_DOCUMENT_WINDOW, 0)
{
	fToolbar = new BrowserToolbar();
	fProxyView = new ProxyView(Bounds(), "Proxy");

	BGroupView *view = new BGroupView(B_VERTICAL, 10);
	view->SetViewColor(255, 255, 255);

	// Set the layout
	SetLayout(new BGroupLayout(B_HORIZONTAL));

	AddChild(BGroupLayoutBuilder(view)
		.Add(fToolbar)
		.Add(fProxyView)
	);
	ResizeTo(500, 500);

	AddShortcut('N', B_COMMAND_KEY, new BMessage(kMsgNewTab), this);
	AddShortcut('W', B_COMMAND_KEY, new BMessage(kMsgCloseTab), this);
}
Esempio n. 19
0
void ParameterWindow::_init() {
    D_INTERNAL(("ParameterWindow::_init()\n"));

    // offset to a new position
    _constrainToScreen();
    m_manualSize = Bounds().OffsetToCopy(0.0, 0.0);

    // add the hidden option to close this window when the
    // control panel has been started successfully
    BMessage *message = new BMessage(M_START_CONTROL_PANEL);
    message->AddBool("replace", true);
    AddShortcut('P', B_COMMAND_KEY | B_SHIFT_KEY | B_OPTION_KEY,
                message);
}
Esempio n. 20
0
AutoConfigWindow::AutoConfigWindow(BRect rect, ConfigWindow *parent)
	:
	BWindow(rect, B_TRANSLATE("Create new account"), B_TITLED_WINDOW_LOOK,
		B_MODAL_APP_WINDOW_FEEL,
		B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AVOID_FRONT, B_ALL_WORKSPACES),
	fParentWindow(parent),
	fAccount(NULL),
	fMainConfigState(true),
	fServerConfigState(false),
	fAutoConfigServer(true)
{
	fRootView = new BView(Bounds(), "root auto config view",
		B_FOLLOW_ALL_SIDES, B_NAVIGABLE);
	fRootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(fRootView);

	int32 buttonHeight = 25;
	int32 buttonWidth = 50;
	BRect buttonRect = Bounds();
	buttonRect.InsetBy(5,5);
	buttonRect.top = buttonRect.bottom - buttonHeight;
	buttonRect.left = buttonRect.right - 2 * buttonWidth - 5;
	buttonRect.right = buttonRect.left + buttonWidth;
	fBackButton = new BButton(buttonRect, "back", B_TRANSLATE("Back"),
		new BMessage(kBackMsg));
	fBackButton->SetEnabled(false);
	fRootView->AddChild(fBackButton);

	buttonRect.left += 5 + buttonWidth;
	buttonRect.right = buttonRect.left + buttonWidth;
	fNextButton = new BButton(buttonRect, "next", B_TRANSLATE("Next"),
		new BMessage(kOkMsg));
	fNextButton->MakeDefault(true);
	fRootView->AddChild(fNextButton);

	fBoxRect = Bounds();
	fBoxRect.InsetBy(5,5);
	fBoxRect.bottom-= buttonHeight + 5;

	fMainView = new AutoConfigView(fBoxRect, fAutoConfig);
	fMainView->SetLabel(B_TRANSLATE("Account settings"));
	fRootView->AddChild(fMainView);

	// Add a shortcut to close the window using Command-W
	AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
}
Esempio n. 21
0
BootManagerWindow::BootManagerWindow()
	: BWindow(BRect(100, 100, 500, 400), "Boot Manager", B_TITLED_WINDOW, 
		B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
{
	float minWidth, maxWidth, minHeight, maxHeight;
	GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
	SetSizeLimits(250, maxWidth, 250, maxHeight);
	
	fWizardView = new WizardView(Bounds(), "wizard", B_FOLLOW_ALL);
	AddChild(fWizardView);
	
	fController.Initialize(fWizardView);
	
	AddShortcut('A', B_COMMAND_KEY, new BMessage(B_ABOUT_REQUESTED));

	CenterOnScreen();
}
Esempio n. 22
0
TChmodWindow::TChmodWindow(float ix, float iy, const char *title)
	:	BWindow(BRect(ix, iy, ix + 275, iy + 170), title,
			B_FLOATING_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
			B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_RESIZABLE)
{
	BView *bgView = new BView(Bounds(), "", 0, 0);
	bgView->SetViewColor(217,217,217);
	AddChild(bgView);
	
	float r = 40, w = 70, x = 100, ow = 80, gr = 140, ot = 200, xd = 15, yd = 15;
	bgView->AddChild(new BStringView(BRect(10, r, ow - 2, r + yd + 3), "", "Read:"));
	bgView->AddChild(new BStringView(BRect(10, w, ow - 2, w + yd + 3), "", "Write:"));
	bgView->AddChild(new BStringView(BRect(10, x, ow - 2, x + yd + 3), "", "Execute:"));
	bgView->AddChild(new BStringView(BRect(ow - 10, r - 20, ow + 30, r - 3), "", "Owner"));
	bgView->AddChild(new BStringView(BRect(gr - 10, r - 20, gr + 30, r - 3), "", "Group"));
	bgView->AddChild(new BStringView(BRect(ot - 10, r - 20, ot + 30, r - 3), "", "Other"));
	fOwnerRead  = new BCheckBox(BRect(ow, r, ow + xd, r + yd), "OwnerRead", "", NULL);
	fOwnerWrite = new BCheckBox(BRect(ow, w, ow + xd, w + yd), "OwnerWrite", "", NULL);
	fOwnerExec  = new BCheckBox(BRect(ow, x, ow + xd, x + yd), "OwnerExec", "", NULL);
	fGroupRead  = new BCheckBox(BRect(gr, r, gr + xd, r + yd), "GroupRead", "", NULL);
	fGroupWrite = new BCheckBox(BRect(gr, w, gr + xd, w + yd), "GroupWrite", "", NULL);
	fGroupExec  = new BCheckBox(BRect(gr, x, gr + xd, x + yd), "GroupROwner", "", NULL);
	fOtherRead  = new BCheckBox(BRect(ot, r, ot + xd, r + yd), "OtherRead", "", NULL);
	fOtherWrite = new BCheckBox(BRect(ot, w, ot + xd, w + yd), "OtherWrite", "", NULL);
	fOtherExec  = new BCheckBox(BRect(ot, x, ot + xd, x + yd), "OtherExec", "", NULL);
	bgView->AddChild(fOwnerRead);
	bgView->AddChild(fOwnerWrite);
	bgView->AddChild(fOwnerExec);
	bgView->AddChild(fGroupRead);
	bgView->AddChild(fGroupWrite);
	bgView->AddChild(fGroupExec);
	bgView->AddChild(fOtherRead);
	bgView->AddChild(fOtherWrite);
	bgView->AddChild(fOtherExec);
	fOKButton = new BButton(BRect(10, 140, 100, 160), "", "Change", new BMessage(OK_CLICKED));
	bgView->AddChild(fOKButton);
	fCancelButton = new BButton(BRect(170, 140, 260, 160), "", "Cancel", new BMessage(B_QUIT_REQUESTED));
	bgView->AddChild(fCancelButton);
	
	AddShortcut('W', 0, new BMessage(B_QUIT_REQUESTED));
	
	fStatus = B_BUSY;
}
Esempio n. 23
0
TBarWindow::TBarWindow()
	:
	BWindow(BRect(-1000.0f, -1000.0f, -1000.0f, -1000.0f),
		B_TRANSLATE_SYSTEM_NAME("Deskbar"), B_BORDERED_WINDOW,
		B_WILL_ACCEPT_FIRST_CLICK | B_NOT_ZOOMABLE | B_NOT_CLOSABLE
		| B_NOT_MINIMIZABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE
		| B_AVOID_FRONT | B_ASYNCHRONOUS_CONTROLS,
		B_ALL_WORKSPACES)
{
	desk_settings* settings = ((TBarApp*)be_app)->Settings();
	if (settings->alwaysOnTop)
		SetFeel(B_FLOATING_ALL_WINDOW_FEEL);
	fBarView = new TBarView(Bounds(), settings->vertical, settings->left,
		settings->top, settings->state, settings->width);
	AddChild(fBarView);

	RemoveShortcut('H', B_COMMAND_KEY | B_CONTROL_KEY);
	AddShortcut('F', B_COMMAND_KEY, new BMessage(kFindButton));
}
Esempio n. 24
0
void CShortcutManager::SetShortcut(UINT nCmdID, WORD wVirtKeyCode, WORD wModifiers)
{
	UINT nOtherCmdID = 0;
	DWORD dwShortcut = MAKELONG(wVirtKeyCode, wModifiers);

	if (!dwShortcut)
	{
		m_mapShortcut2ID.RemoveKey(dwShortcut);
		return;
	}
	else 
	{
		if (m_mapShortcut2ID.Lookup(dwShortcut, nOtherCmdID))
		{
			m_mapShortcut2ID.RemoveKey(dwShortcut);
		}	
	}

	AddShortcut(nCmdID, wVirtKeyCode, wModifiers);
}
MarkupWindow::MarkupWindow(BRect frame, const char* title)
	:	BWindow(frame, title, B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS, B_CURRENT_WORKSPACE)
{
	// initialize controls      s
	AddShortcut('q', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
	BRect r = Bounds();
	topicListView = new BListView(BRect(10, 10, 30, 30), NULL, B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE);
	contentTextView = new BTextView(BRect(0, 0, r.right, 100), NULL, BRect(10, 10, r.right, 100), B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE);
	contentTextView->SetWordWrap(true);
	contentTextView->MakeEditable(false);
	backView = new BView(Bounds(), "backview", B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE);
	backView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	backView->SetHighColor((rgb_color){0, 0, 0, 255});
	AddChild(backView);
	// gui layout builder
	backView->SetLayout(new BGroupLayout(B_HORIZONTAL, 0.0));
	backView->AddChild(BGridLayoutBuilder()
		.Add(new BScrollView("scroll_topic", topicListView, B_FOLLOW_TOP | B_FOLLOW_LEFT, 0, false, true, B_FANCY_BORDER), 0, 0, 2, 3)
		.Add(new BScrollView("scroll_content", contentTextView, B_FOLLOW_ALL_SIDES, 0, false, true, B_FANCY_BORDER), 2, 0, 6, 10)
		.SetInsets(0, 0, 0, 0)
	);
	topicListView->SetSelectionMessage(new BMessage(LOAD_CONTENT));
}
Esempio n. 26
0
void
TFilePanel::SetTo(const entry_ref* ref)
{
	if (ref == NULL)
		return;

	entry_ref setToRef(*ref);

	bool isDesktop = SwitchDirToDesktopIfNeeded(setToRef);

	BEntry entry(&setToRef);
	if (entry.InitCheck() != B_OK || !entry.IsDirectory())
		return;

	SwitchDirMenuTo(&setToRef);

	PoseView()->SetIsDesktop(isDesktop);
	fPoseView->SwitchDir(&setToRef);

	AddShortcut('H', B_COMMAND_KEY, new BMessage(kSwitchToHome));
		// our shortcut got possibly removed because the home
		// menu item got removed - we shouldn't really have to do
		// this - this is a workaround for a kit bug.
}
Esempio n. 27
0
void HelpWindow::AddWorldAxisInformation(int column)
{
    auto worldAxisGrid = new HelpWindowGridLayout();
    worldAxisGrid->AddHeading("World (room) Axis/Pivot Controls");
    worldAxisGrid->AddTitle("");
    worldAxisGrid->AddDescription("(only when the axis is being displayed)");
    worldAxisGrid->AddShortcut("SHIFT + L");
    worldAxisGrid->AddDescription("Display room's pivot");
    worldAxisGrid->AddShortcut("{");
    worldAxisGrid->AddDescription("Move axis up");
    worldAxisGrid->AddShortcut("/");
    worldAxisGrid->AddDescription("Move axis down");
    worldAxisGrid->AddShortcut("'");
    worldAxisGrid->AddDescription("Move axis to the right");
    worldAxisGrid->AddShortcut(";");
    worldAxisGrid->AddDescription("Move axis to the left");
    worldAxisGrid->AddShortcut("SHIFT + /");
    worldAxisGrid->AddDescription("Reset axis' location to its original position");
    AddToColumn(worldAxisGrid, column);
}
void GlobalShortcuts::AddShortcut(const QString& id, const QString& name,
                                  const char* signal,
                                  const QKeySequence& default_key) {
  Shortcut shortcut = AddShortcut(id, name, default_key);
  connect(shortcut.action, SIGNAL(triggered()), this, signal);
}
GlobalShortcuts::GlobalShortcuts(QObject *parent)
  : QObject(parent),
    gnome_backend_(NULL),
    system_backend_(NULL),
    use_gnome_(false),
    rating_signals_mapper_(new QSignalMapper(this))
{
  settings_.beginGroup(kSettingsGroup);

  // Create actions
  AddShortcut("play", tr("Play"), SIGNAL(Play()));
  AddShortcut("pause", tr("Pause"), SIGNAL(Pause()));
  AddShortcut("play_pause", tr("Play/Pause"), SIGNAL(PlayPause()), QKeySequence(Qt::Key_MediaPlay));
  AddShortcut("stop", tr("Stop"), SIGNAL(Stop()), QKeySequence(Qt::Key_MediaStop));
  AddShortcut("stop_after", tr("Stop playing after current track"), SIGNAL(StopAfter()));
  AddShortcut("next_track", tr("Next track"), SIGNAL(Next()), QKeySequence(Qt::Key_MediaNext));
  AddShortcut("prev_track", tr("Previous track"), SIGNAL(Previous()), QKeySequence(Qt::Key_MediaPrevious));
  AddShortcut("inc_volume", tr("Increase volume"), SIGNAL(IncVolume()));
  AddShortcut("dec_volume", tr("Decrease volume"), SIGNAL(DecVolume()));
  AddShortcut("mute", tr("Mute"), SIGNAL(Mute()));
  AddShortcut("seek_forward", tr("Seek forward"), SIGNAL(SeekForward()));
  AddShortcut("seek_backward", tr("Seek backward"), SIGNAL(SeekBackward()));
  AddShortcut("show_hide", tr("Show/Hide"), SIGNAL(ShowHide()));
  AddShortcut("show_osd", tr("Show OSD"), SIGNAL(ShowOSD()));
  AddShortcut("toggle_pretty_osd", tr("Toggle Pretty OSD"), SIGNAL(TogglePrettyOSD())); // Toggling possible only for pretty OSD
  AddShortcut("shuffle_mode", tr("Change shuffle mode"), SIGNAL(CycleShuffleMode()));
  AddShortcut("repeat_mode", tr("Change repeat mode"), SIGNAL(CycleRepeatMode()));
  AddShortcut("toggle_last_fm_scrobbling", tr("Enable/disable Last.fm scrobbling"), SIGNAL(ToggleScrobbling()));
  AddShortcut("global_search_popup", tr("Show Global Search Popup"), SIGNAL(ShowGlobalSearch()));

  AddRatingShortcut("rate_zero_star", tr("Rate the current song 0 stars"), rating_signals_mapper_, 0);
  AddRatingShortcut("rate_one_star", tr("Rate the current song 1 star"), rating_signals_mapper_, 1);
  AddRatingShortcut("rate_two_star", tr("Rate the current song 2 stars"), rating_signals_mapper_, 2);
  AddRatingShortcut("rate_three_star", tr("Rate the current song 3 stars"), rating_signals_mapper_, 3);
  AddRatingShortcut("rate_four_star", tr("Rate the current song 4 stars"), rating_signals_mapper_, 4);
  AddRatingShortcut("rate_five_star", tr("Rate the current song 5 stars"), rating_signals_mapper_, 5);

  connect(rating_signals_mapper_, SIGNAL(mapped(int)), SIGNAL(RateCurrentSong(int)));

  // Create backends - these do the actual shortcut registration
  gnome_backend_ = new GnomeGlobalShortcutBackend(this);

#ifndef Q_OS_DARWIN
  system_backend_ = new QxtGlobalShortcutBackend(this);
#else
  system_backend_ = new MacGlobalShortcutBackend(this);
#endif

  ReloadSettings();
}
Esempio n. 30
0
void
TFilePanel::Init(const BMessage*)
{
	BRect windRect(Bounds());
	AddChild(fBackView = new BackgroundView(windRect));

	// add poseview menu bar
	fMenuBar = new BMenuBar(BRect(0, 0, windRect.Width(), 1), "MenuBar");
	fMenuBar->SetBorder(B_BORDER_FRAME);
	fBackView->AddChild(fMenuBar);

	AddMenus();
	AddContextMenus();

	FavoritesMenu* favorites = new FavoritesMenu(B_TRANSLATE("Favorites"),
		new BMessage(kSwitchDirectory), new BMessage(B_REFS_RECEIVED),
		BMessenger(this), IsSavePanel(), fPoseView->RefFilter());
	favorites->AddItem(new BMenuItem(B_TRANSLATE("Add current folder"),
		new BMessage(kAddCurrentDir)));
	favorites->AddItem(new BMenuItem(
		B_TRANSLATE("Edit favorites" B_UTF8_ELLIPSIS),
		new BMessage(kEditFavorites)));

	fMenuBar->AddItem(favorites);

	// configure menus
	BMenuItem* item = fMenuBar->FindItem(B_TRANSLATE("Window"));
	if (item) {
		fMenuBar->RemoveItem(item);
		delete item;
	}

	item = fMenuBar->FindItem(B_TRANSLATE("File"));
	if (item) {
		BMenu* menu = item->Submenu();
		if (menu) {
			item = menu->FindItem(kOpenSelection);
			if (item && menu->RemoveItem(item))
				delete item;

			item = menu->FindItem(kDuplicateSelection);
			if (item && menu->RemoveItem(item))
				delete item;

			// remove add-ons menu, identifier menu, separator
			item = menu->FindItem(B_TRANSLATE("Add-ons"));
			if (item) {
				int32 index = menu->IndexOf(item);
				delete menu->RemoveItem(index);
				delete menu->RemoveItem(--index);
				delete menu->RemoveItem(--index);
			}

			// remove separator
			item = menu->FindItem(B_CUT);
			if (item) {
				item = menu->ItemAt(menu->IndexOf(item)-1);
				if (item && menu->RemoveItem(item))
					delete item;
			}
		}
	}

	// add directory menu and menufield
	fDirMenu = new BDirMenu(0, this, kSwitchDirectory, "refs");

	font_height ht;
	be_plain_font->GetHeight(&ht);
	float f_height = ht.ascent + ht.descent + ht.leading;

	BRect rect;
	rect.top = fMenuBar->Bounds().Height() + 8;
	rect.left = windRect.left + 8;
	rect.right = rect.left + 300;
	rect.bottom = rect.top + (f_height > 22 ? f_height : 22);

	fDirMenuField = new BMenuField(rect, "DirMenuField", "", fDirMenu);
	fDirMenuField->MenuBar()->SetFont(be_plain_font);
	fDirMenuField->SetDivider(0);
	fDirMenuField->MenuBar()->SetMaxContentWidth(rect.Width() - 26.0f);
		// Make room for the icon

	fDirMenuField->MenuBar()->RemoveItem((int32)0);
	fDirMenu->SetMenuBar(fDirMenuField->MenuBar());
		// the above is a weird call from BDirMenu
		// ToDo: clean up

	BEntry entry(TargetModel()->EntryRef());
	if (entry.InitCheck() == B_OK)
		fDirMenu->Populate(&entry, 0, true, true, false, true);
	else
		fDirMenu->Populate(0, 0, true, true, false, true);

	fBackView->AddChild(fDirMenuField);

	// add file name text view
	if (fIsSavePanel) {
		BRect rect(windRect);
		rect.top = rect.bottom - 35;
		rect.left = 8;
		rect.right = rect.left + 170;
		rect.bottom = rect.top + 13;

		fTextControl = new BTextControl(rect, "text view",
			B_TRANSLATE("save text"), "", NULL,
			B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
		DisallowMetaKeys(fTextControl->TextView());
		DisallowFilenameKeys(fTextControl->TextView());
		fBackView->AddChild(fTextControl);
		fTextControl->SetDivider(0.0f);
		fTextControl->TextView()->SetMaxBytes(B_FILE_NAME_LENGTH - 1);

		fButtonText.SetTo(B_TRANSLATE("Save"));
	} else
		fButtonText.SetTo(B_TRANSLATE("Open"));

	rect = windRect;
	rect.OffsetTo(10, fDirMenuField->Frame().bottom + 10);
	rect.bottom = windRect.bottom - 60;
	rect.right -= B_V_SCROLL_BAR_WIDTH + 20;

	// re-parent the poseview to our backview
	// ToDo:
	// This is terrible, fix it up
	PoseView()->RemoveSelf();
	if (fIsSavePanel)
		fBackView->AddChild(PoseView(), fTextControl);
	else
		fBackView->AddChild(PoseView());

	PoseView()->MoveTo(rect.LeftTop());
	PoseView()->ResizeTo(rect.Width(), rect.Height());
	PoseView()->AddScrollBars();
	PoseView()->SetDragEnabled(false);
	PoseView()->SetDropEnabled(false);
	PoseView()->SetSelectionHandler(this);
	PoseView()->SetSelectionChangedHook(true);
	PoseView()->DisableSaveLocation();
	PoseView()->VScrollBar()->MoveBy(0, -1);
	PoseView()->VScrollBar()->ResizeBy(0, 1);


	AddShortcut('W', B_COMMAND_KEY, new BMessage(kCancelButton));
	AddShortcut('H', B_COMMAND_KEY, new BMessage(kSwitchToHome));
	AddShortcut('A', B_COMMAND_KEY | B_SHIFT_KEY,
		new BMessage(kShowSelectionWindow));
	AddShortcut('A', B_COMMAND_KEY, new BMessage(B_SELECT_ALL), PoseView());
	AddShortcut('S', B_COMMAND_KEY, new BMessage(kInvertSelection),
		PoseView());
	AddShortcut('Y', B_COMMAND_KEY, new BMessage(kResizeToFit), PoseView());
	AddShortcut(B_DOWN_ARROW, B_COMMAND_KEY, new BMessage(kOpenDir));
	AddShortcut(B_DOWN_ARROW, B_COMMAND_KEY | B_OPTION_KEY,
		new BMessage(kOpenDir));
	AddShortcut(B_UP_ARROW, B_COMMAND_KEY, new BMessage(kOpenParentDir));
	AddShortcut(B_UP_ARROW, B_COMMAND_KEY | B_OPTION_KEY,
		new BMessage(kOpenParentDir));

	// New code to make buttons font sensitive
	rect = windRect;
	rect.top = rect.bottom - 35;
	rect.bottom -= 10;
	rect.right -= 25;
	float default_width
		= be_plain_font->StringWidth(fButtonText.String()) + 20;
	rect.left = default_width > 75
		? rect.right - default_width : rect.right - 75;

	BButton* default_button = new BButton(rect, "default button",
		fButtonText.String(), new BMessage(kDefaultButton),
		B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
	fBackView->AddChild(default_button);

	rect.right = rect.left -= 10;
	float cancel_width
		= be_plain_font->StringWidth(B_TRANSLATE("Cancel")) + 20;
	rect.left = cancel_width > 75
		? rect.right - cancel_width : rect.right - 75;

	BButton* cancel_button = new BButton(rect, "cancel button",
		B_TRANSLATE("Cancel"), new BMessage(kCancelButton),
		B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM);
	fBackView->AddChild(cancel_button);

	if (!fIsSavePanel)
		default_button->SetEnabled(false);

	default_button->MakeDefault(true);

	RestoreState();

	PoseView()->ScrollTo(B_ORIGIN);
	PoseView()->UpdateScrollRange();
	PoseView()->ScrollTo(B_ORIGIN);

	if (fTextControl) {
		fTextControl->MakeFocus();
		fTextControl->TextView()->SelectAll();
	} else
		PoseView()->MakeFocus();

	app_info info;
	BString title;
	if (be_app->GetAppInfo(&info) == B_OK) {
		if (!gLocalizedNamePreferred
			|| BLocaleRoster::Default()->GetLocalizedFileName(
				title, info.ref, false) != B_OK)
			title = info.ref.name;
		title << ": ";
	}
	title << fButtonText;	// Open or Save

	SetTitle(title.String());

	SetSizeLimits(370, 10000, 200, 10000);
}