void CClientMainWindow::_SetupUi() { this->setWindowIcon(QIcon(QObject::tr(DEF_VALUE_MainWidgetWindowIcon.c_str())));//任务栏中的图标 _CreateMenuBar(); _CreateToolBars(); _CreateMdiArea(); }
BoardWindow::BoardWindow(void) : BWindow(BRect(), "Puri - Master of Chess", /*B_DOCUMENT_WINDOW*/ B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE | B_AUTO_UPDATE_SIZE_LIMITS | B_OUTLINE_RESIZE), fEngineCanWrite(false), fIndex(0) { fICSMainWindow = NULL; fSkillSlider = new BSlider("slider", "", new BMessage(MSG_SKILLCHANGED), 0, 20, B_HORIZONTAL); fSkillSlider->SetValue(20); fSkillSlider->SetToolTip("Engine Skill: 20"); fSkillSlider->Value(); fSkillSlider->SetEnabled(true); fTabView = new BTabView("tab_view"); fTabView->SetTabWidth(B_WIDTH_FROM_LABEL); fMovesView = new MovesView(); fTabsVec.push_back(new BTab()); fTabView->AddTab(fMovesView, fTabsVec.back()); fTabsVec.back()->SetLabel("Moves"); //fTabsVec.push_back( new BTab() ); //fTabView->AddTab( new MovesView(), fTabsVec.back() ); //fTabsVec.back()->SetLabel( "Moves2" ); // Build the layout fChessBoard = new ChessBoardView(BRect(0, 0, 0, 0)); fSidebarView = new SidebarView(); fTimeView = new TimeView(REPLYCODE_TIMEVIEW); fNavigationView = new NavigationView(); fMaterialView = new MaterialView(); fEngineOutput = new EngineOutputView(fChessBoard->Board()); fCard = new BCardLayout(); BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .Add(fMenuBar = _CreateMenuBar()) .AddSplit(B_HORIZONTAL).GetSplitView(&fSplitView) .AddGroup(B_VERTICAL, 0, 3.5) .AddGroup(B_HORIZONTAL, 0, 4) .AddGroup(B_VERTICAL, 0, 1).GetLayout(&fLeftColumn) .Add(fSidebarView) .End() .AddGlue(0) .AddGroup(B_VERTICAL, 0, 12).GetLayout(&fMiddleColumn) .Add(fChessBoard, 12) .Add(fNavigationView) .End() .End() .End() .AddGroup(B_VERTICAL, 3, 1).GetLayout(&fRightColumn) // .AddGlue() .AddStrut(3) .Add(fTimeView) .AddSplit(B_VERTICAL).GetSplitView(&fMaterialSV) .AddGroup(B_VERTICAL, 0, 20) .Add(fTabView, 20) .End() .AddGroup(B_VERTICAL, 0, 3) .AddStrut(1) .Add(fMaterialView, 3) .End() .AddGroup(B_VERTICAL, 0, 3) .Add(fSkillSlider) .Add(fEngineOutput) .End() .End() // .AddGlue() .End() .End() //.AddGrid() // .Add( new BButton( "left4" , NULL ),0,0 ) //.Add( new BButton( "left5" , NULL ),2,2 ) ; /* fCard->AddView( new BButton( "test1", "test1",NULL) ); fCard->AddView( new BButton( "test2", "test2",NULL) ); fCard->AddView( new BButton( "test3", "test3",NULL) ); fCard->SetVisibleItem( 0L ); fCard->SetVisible(true); */ //fMiddleColumn->AlignLayoutWith( fRightColumn, B_VERTICAL); fSplitView->SetSplitterSize(9); fSplitView->SetSpacing(0); fMaterialSV->SetSplitterSize(9); fMaterialSV->SetSpacing(0); fChessBoard->MakeFocus(); fEngine = new Engine("stockfish", REPLYCODE_ENGINE, this, this, B_LOWEST_ACTIVE_PRIORITY); fEngine->PostMessage(MSG_ENG_START); _LoadSettings(); Show(); Hide(); PostMessage(MENU_GAME_NEWGAME); }
BoardWindow::BoardWindow(int index, bool userIsWhite, BString whiteName, BString blackName, ICSMainWindow* icswindow, ICS* ics) : BWindow(BRect(), " ", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS /* | B_QUIT_ON_WINDOW_CLOSE*/ | B_AUTO_UPDATE_SIZE_LIMITS | B_OUTLINE_RESIZE), fICSMainWindow(icswindow), fICS(ics), fSavedFrame(BRect()), fEngineCanWrite(true), fIndex(index) { fPlayerName[0] = whiteName; fPlayerName[1] = blackName; fMenuBar = _CreateMenuBar(); fMenuBar->Hide(); fICSConnectMI->SetMarked(true); fSkillSlider = new BSlider("slider", "", new BMessage(MSG_SKILLCHANGED), 0, 20, B_HORIZONTAL); fSkillSlider->SetValue(20); fSkillSlider->SetToolTip("Engine Skill: 20"); fSkillSlider->Value(); fSkillSlider->SetEnabled(true); fTabView = new BTabView("tab_view"); fTabView->SetTabWidth(B_WIDTH_FROM_LABEL); fMovesView = new MovesView(); fTabsVec.push_back(new BTab()); fTabView->AddTab(fMovesView, fTabsVec.back()); fTabsVec.back()->SetLabel("Moves"); //fTabsVec.push_back( new BTab() ); //fTabView->AddTab( new MovesView(), fTabsVec.back() ); //fTabsVec.back()->SetLabel( "Moves2" ); // Build the layout fChessBoard = new ChessBoardView(BRect(0, 0, 0, 0)); fSidebarView = new SidebarView; fTimeView = new TimeView(REPLYCODE_TIMEVIEW); fNavigationView = new NavigationView(); fMaterialView = new MaterialView; fChatView = new ICSChatView; BSplitView* fSplitView; BSplitView* fMaterialSV; fCard = new BCardLayout(); BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .AddSplit(B_HORIZONTAL).GetSplitView(&fSplitView) .AddGroup(B_VERTICAL, 0, 3.5) .Add(fMenuBar) .AddGroup(B_HORIZONTAL, 0, 4) //.AddGroup(B_VERTICAL, 0, 1).GetLayout(&fLeftColumn) //.Add(fSidebarView) //.End() //.AddGlue(0) .AddGroup(B_VERTICAL, 0, 12).GetLayout(&fMiddleColumn) .Add(fChessBoard, 12) //.Add(fNavigationView) .End() .End() .End() .AddGroup(B_VERTICAL, 5).GetLayout(&fRightColumn) // .AddGlue() .Add(fTimeView) .AddSplit(B_VERTICAL).GetSplitView(&fMaterialSV) .AddGroup(B_VERTICAL, 0, 12) .Add(fTabView, 20) //.Add(fSkillSlider) .End() .Add(fChatView, 8) .AddGroup(B_VERTICAL, 0, 3) .Add(fMaterialView, 3) .End() .End() // .AddGlue() .End() .End() //.AddGrid() // .Add( new BButton( "left4" , NULL ),0,0 ) //.Add( new BButton( "left5" , NULL ),2,2 ) ; /* fCard->AddView( new BButton( "test1", "test1",NULL) ); fCard->AddView( new BButton( "test2", "test2",NULL) ); fCard->AddView( new BButton( "test3", "test3",NULL) ); fCard->SetVisibleItem( 0L ); fCard->SetVisible(true); */ //fMiddleColumn->AlignLayoutWith( fRightColumn, B_VERTICAL); fSplitView->SetSplitterSize(9); fSplitView->SetSpacing(0); fSplitView->SetCollapsible(true); fMaterialSV->SetSplitterSize(9); fMaterialSV->SetSpacing(0); fMaterialSV->SetCollapsible(true); fChessBoard->MakeFocus(); //fMenuBar->Hide(); fEngine = NULL;/*new Engine("stockfish", REPLYCODE_ENGINE, this, this, B_LOWEST_ACTIVE_PRIORITY); //fEngine->PostMessage(MSG_ENG_START); //PostMessage(MENU_GAME_NEWGAME); */ fChessBoard->SetBoardTurned(!userIsWhite); if (userIsWhite) fChatView->AddTellTarget(fPlayerName[1]); else fChatView->AddTellTarget(fPlayerName[0]); fTimeView->Init(0); Zoom(); Show(); }