//------------------------------------------------------------------------------------------------- bool ExportFile( const QString& filepath, quint32 serialNumber ) { //TODO: should probably recombine this with the original code tFile file( filepath ); if ( !file.open( QIODevice::WriteOnly ) ) { //DbgPrintf( QString("Failed to open output file %1").arg( filepath ) ); return false; } QDataStream out( &file ); // we must set the version to 4.4 so newer builds with greater versions can build export files for older products. // even if we are sending in the 4.8 version a 4.4 build doesn't know what to do with it. out.setVersion( QDataStream::Qt_4_4 ); out.setByteOrder( QDataStream::LittleEndian ); // To match the user data file out << (qint32)SettingsFileVersion; out << (qint32)out.version(); // Qt QDataStream version QString titleString("Mercury exported settings file"); qint32 titleStringLength = titleString.length(); out << titleStringLength; out.writeRawData( titleString.toAscii(), titleStringLength ); QDateTime currentDateTime = QDateTime::currentDateTime(); QString dateString = currentDateTime.toString( tSystemSettings::Instance()->DateFormatString() ); qint32 dateStringLength = dateString.length(); out << dateStringLength; out.writeRawData( dateString.toAscii(), dateStringLength ); out << currentDateTime; out << serialNumber; tFile settingsFile( tPath::SettingsIniFile() ); if (settingsFile.open( QIODevice::ReadOnly | QIODevice::Text ) == false) { //DbgPrintf( "Failed to open Settings.ini file" ); return false; } QTextStream settingsFileStream( &settingsFile ); QString line; int length; while ( !settingsFileStream.atEnd() ) { line = settingsFileStream.readLine(); line.append("\n"); length = line.length(); out.writeRawData( line.toAscii(), length ); } settingsFile.close(); file.close(); QFileInfo fileInfo( filepath ); tFile::syncdir( fileInfo.absolutePath() ); return true; }
CStr JSound::ToString(JSContext* UNUSED(cx), uintN UNUSED(argc), jsval* UNUSED(argv)) { #if CONFIG2_AUDIO CStrW titleString( m_SndItem->GetName()->string() ); return "[object Sound: " + (m_SndItem ? titleString.ToUTF8() : "(null)") + "]"; #else // !CONFIG2_AUDIO return "[object Sound: audio disabled]"; #endif // !CONFIG2_AUDIO }
void ContextHistoryClientEfl::didUpdateHistoryTitle(WKContextRef, WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef, const void* clientInfo) { const ContextHistoryClientEfl* historyClient = toContextHistoryClientEfl(clientInfo); if (!historyClient->m_titleUpdated) return; WKEinaSharedString titleString(title); WKEinaSharedString stringURL(URL); historyClient->m_titleUpdated(EwkViewImpl::viewFromPageViewMap(page), titleString, stringURL, historyClient->m_userData); }
void ApplicationCore::slotCurrentBackendStatusChanged(const QString &text) { const QString title = titleString(text); // FIXME why can't this be done on stateChanged()? and if not, is // maybe an app-wide metadataChanged() or configurationChanged() // missing? (the latter exists) // MIRKO_TEMP_REM /* m_mainWindow.setWindowTitle( title ); */ m_trayIcon.setToolTip(title); }
void MVJoinTable::print(FILE* ofd, const char* indent, const char* title)const { char buffer[20]; const char *deltaTypeText = NULL; switch (deltaType_) { case EMPTY_DELTA : deltaTypeText = "Empty Delta"; break; case INSERTONLY_DELTA: deltaTypeText = "InsertOnly Delta"; break; case NONEMPTY_DELTA : deltaTypeText = "Nonempty Delta"; break; } fprintf(ofd, "Table no. %d: %s (%s),\n", tableIndex_, tableName_.data(), deltaTypeText); NAString titleString(" "); CollIndex lastBit; predicateBitmap_.lastUsed(lastBit); #pragma nowarn(1506) // warning elimination for (Int32 i=lastBit; i>=0 ; i--) #pragma warn(1506) // warning elimination { snprintf( buffer, 20, "%d", i ); titleString += buffer; titleString += ", "; } NAString predicateString(" "); NAString inRiString(" "); NAString outRiString(" "); BitmapToString(predicateBitmap_, predicateString); BitmapToString(incomingRiBitmap_, inRiString); BitmapToString(outgoingRiBitmap_, outRiString); fprintf(ofd, "\tTableIndices : %s.\n", titleString.data()); fprintf(ofd, "\tPredicates to: %s.\n", predicateString.data()); fprintf(ofd, "\tIncoming RIs : %s.\n", inRiString.data()); fprintf(ofd, "\tOutgoing RIs : %s.\n", outRiString.data()); }
void BColumnTitle::Draw(BView *view, bool pressed) { BRect bounds(Bounds()); BPoint loc(0, bounds.bottom - 4); if (pressed) { if (be_control_look != NULL) { bounds.bottom--; BRect rect(bounds); rect.right--; rgb_color base = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT); be_control_look->DrawButtonBackground(view, rect, rect, base, 0, BControlLook::B_TOP_BORDER | BControlLook::B_BOTTOM_BORDER); } else { view->SetLowColor(sDarkTitleBackground); view->FillRect(bounds, B_SOLID_LOW); } } BString titleString(fColumn->Title()); view->TruncateString(&titleString, B_TRUNCATE_END, bounds.Width() - kTitleColumnExtraMargin); float resultingWidth = view->StringWidth(titleString.String()); switch (fColumn->Alignment()) { case B_ALIGN_LEFT: default: loc.x = bounds.left + 1 + kTitleColumnLeftExtraMargin; break; case B_ALIGN_CENTER: loc.x = bounds.left + (bounds.Width() / 2) - (resultingWidth / 2); break; case B_ALIGN_RIGHT: loc.x = bounds.right - resultingWidth - kTitleColumnRightExtraMargin; break; } view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), 1.75)); view->DrawString(titleString.String(), loc); // show sort columns bool secondary = (fColumn->AttrHash() == fParent->PoseView()->SecondarySort()); if (secondary || (fColumn->AttrHash() == fParent->PoseView()->PrimarySort())) { BPoint center(loc.x - 6, roundf((bounds.top + bounds.bottom) / 2.0)); BPoint triangle[3]; if (fParent->PoseView()->ReverseSort()) { triangle[0] = center + BPoint(-3.5, 1.5); triangle[1] = center + BPoint(3.5, 1.5); triangle[2] = center + BPoint(0.0, -2.0); } else { triangle[0] = center + BPoint(-3.5, -1.5); triangle[1] = center + BPoint(3.5, -1.5); triangle[2] = center + BPoint(0.0, 2.0); } uint32 flags = view->Flags(); view->SetFlags(flags | B_SUBPIXEL_PRECISE); if (secondary) { view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), 1.3)); view->FillTriangle(triangle[0], triangle[1], triangle[2]); } else { view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), 1.6)); view->FillTriangle(triangle[0], triangle[1], triangle[2]); } view->SetFlags(flags); } if (be_control_look != NULL) { view->SetHighColor(sLightShadowColor); view->StrokeLine(bounds.RightTop(), bounds.RightBottom()); } else { BRect rect(bounds); view->SetHighColor(sShadowColor); view->StrokeRect(rect); view->BeginLineArray(4); // draw lighter gray and white inset lines rect.InsetBy(1, 1); view->AddLine(rect.LeftBottom(), rect.RightBottom(), pressed ? sLightShadowColor : sLightShadowColor); view->AddLine(rect.LeftTop(), rect.RightTop(), pressed ? sDarkShadowColor : sShineColor); view->AddLine(rect.LeftTop(), rect.LeftBottom(), pressed ? sDarkShadowColor : sShineColor); view->AddLine(rect.RightTop(), rect.RightBottom(), pressed ? sLightShadowColor : sLightShadowColor); view->EndLineArray(); } }
StartWindow::StartWindow(void) : DWindow(BRect(0,0,400,300),"Paladin",B_DOCUMENT_WINDOW, B_NOT_ZOOMABLE) { RegisterWindow(); AddShortcut('O',B_COMMAND_KEY, new BMessage(M_SHOW_OPEN_PROJECT)); AddShortcut('N',B_COMMAND_KEY, new BMessage(M_NEW_PROJECT)); AddShortcut('I',B_COMMAND_KEY, new BMessage(M_SHOW_IMPORT)); AddCommonFilter(new EscapeCancelFilter()); MakeCenteredOnShow(true); BView *top = GetBackgroundView(); fNewButton = MakeButton("new","NewProjectButtonUp.png","NewProjectButtonDown.png", M_NEW_PROJECT); top->AddChild(fNewButton); fNewButton->MoveTo(10,10); ClickableStringView *label = MakeLabel(fNewButton,TR("Create a new project")); top->AddChild(label); label->SetMessage(new BMessage(M_NEW_PROJECT)); fOpenButton = MakeButton("open","OpenProjectButtonUp.png", "OpenProjectButtonDown.png", M_SHOW_OPEN_PROJECT); top->AddChild(fOpenButton); fOpenButton->MoveTo(10,fNewButton->Frame().bottom + 10.0); label = MakeLabel(fOpenButton,"Open a project"); top->AddChild(label); label->SetMessage(new BMessage(M_SHOW_OPEN_PROJECT)); fOpenRecentButton = MakeButton("openrecent","OpenRecentButtonUp.png", "OpenRecentButtonDown.png", M_OPEN_SELECTION); top->AddChild(fOpenRecentButton); fOpenRecentButton->MoveTo(10,fOpenButton->Frame().bottom + 10.0); SetToolTip(fOpenRecentButton,TR("Open a project in the list on the right. You " "can also press Command + a number key.")); label = MakeLabel(fOpenRecentButton,TR("Open the selected project")); top->AddChild(label); label->SetMessage(new BMessage(M_OPEN_SELECTION)); BRect r(Bounds()); r.left = label->Frame().right + 20.0; r.right -= B_V_SCROLL_BAR_WIDTH + 10.0; r.top += 10.0; r.bottom -= 10.0; fListView = new StartWindowList(r); BScrollView *scrollView = new BScrollView("scroller",fListView,0, B_FOLLOW_ALL, false, true); top->AddChild(scrollView); fListView->SetInvocationMessage(new BMessage(M_OPEN_SELECTION)); SetToolTip(fListView, "Open a recent project. You can also press Command + a number key."); fQuickImportButton = MakeButton("quickimport","QuickImportButtonUp.png", "QuickImportButtonDown.png",M_SHOW_IMPORT); top->AddChild(fQuickImportButton); fQuickImportButton->MoveTo(10,fOpenRecentButton->Frame().bottom + 10.0); label = MakeLabel(fQuickImportButton,"Import an existing project"); top->AddChild(label); label->SetMessage(new BMessage(M_SHOW_IMPORT)); SetToolTip(label,TR("Quickly make a project by importing all source files and resource files.\n" "You can also import a BeIDE project.")); SetToolTip(fQuickImportButton, TR("Quickly make a project by importing all source files and resource files.\n" "You can also import a BeIDE project.")); fOnlineImportButton = MakeButton("onlineimport","OnlineImportButtonUp.png", "OnlineImportButtonDown.png",M_ONLINE_IMPORT); top->AddChild(fOnlineImportButton); fOnlineImportButton->MoveTo(10,fQuickImportButton->Frame().bottom + 10.0); label = MakeLabel(fOnlineImportButton,"Import a project from online"); top->AddChild(label); label->SetMessage(new BMessage(M_ONLINE_IMPORT)); SetToolTip(label,TR("Import a project from an online repository")); SetToolTip(fQuickImportButton, TR("Import a project from an online repository")); #ifdef DISABLE_ONLINE_IMPORT fOnlineImportButton->Hide(); SetSizeLimits(scrollView->Frame().left + 110.0,30000, fQuickImportButton->Frame().bottom + 10.0,30000); ResizeTo(scrollView->Frame().left + 160.0,fQuickImportButton->Frame().bottom + 10.0); #else SetSizeLimits(scrollView->Frame().left + 110.0,30000, fOnlineImportButton->Frame().bottom + 10.0,30000); ResizeTo(scrollView->Frame().left + 160.0,fOnlineImportButton->Frame().bottom + 10.0); #endif BMessenger msgr(this); BEntry entry(gProjectPath.GetFullPath()); entry_ref ref; entry.GetRef(&ref); fOpenPanel = new BFilePanel(B_OPEN_PANEL,&msgr,&ref,B_FILE_NODE,true, new BMessage(M_OPEN_PROJECT)); BString titleString(TR("Open Project")); titleString.Prepend("Paladin: "); fOpenPanel->Window()->SetTitle(titleString.String()); fImportPanel = new BFilePanel(B_OPEN_PANEL,&msgr,&ref,B_DIRECTORY_NODE,true, new BMessage(M_QUICK_IMPORT)); titleString = TR("Choose Project Folder"); titleString.Prepend("Paladin: "); fImportPanel->Window()->SetTitle(titleString.String()); gSettings.Lock(); int32 index = 0; while (gSettings.FindRef("recentitems",index++,&ref) == B_OK) { if (!BEntry(&ref).Exists()) { index--; gSettings.RemoveData("recentitems",index); } else fListView->AddItem(new RefStringItem(ref),0); } gSettings.Unlock(); // Alt + number opens that number project from the list int32 count = (fListView->CountItems() > 9) ? 9 : fListView->CountItems(); for (int32 i = 0; i < count; i++) { BMessage *listMsg = new BMessage(M_OPEN_FROM_LIST); listMsg->AddInt32("index", i); AddShortcut('1' + i, B_COMMAND_KEY, listMsg); } fNewButton->MakeFocus(true); }
void BColumnTitle::Draw(BView* view, bool pressed) { BRect bounds(Bounds()); font_height height; view->GetFontHeight(&height); BPoint loc(0, bounds.top + ceilf(height.ascent) + 2); rgb_color baseColor = ui_color(B_PANEL_BACKGROUND_COLOR); if (pressed) { bounds.bottom--; BRect rect(bounds); rect.right--; baseColor = tint_color(baseColor, B_DARKEN_1_TINT); be_control_look->DrawButtonBackground(view, rect, rect, baseColor, 0, BControlLook::B_TOP_BORDER | BControlLook::B_BOTTOM_BORDER); } BString titleString(fColumn->Title()); view->TruncateString(&titleString, B_TRUNCATE_END, bounds.Width() - kTitleColumnExtraMargin); float resultingWidth = view->StringWidth(titleString.String()); switch (fColumn->Alignment()) { case B_ALIGN_LEFT: default: loc.x = bounds.left + 1 + kTitleColumnLeftExtraMargin; break; case B_ALIGN_CENTER: loc.x = bounds.left + (bounds.Width() / 2) - (resultingWidth / 2); break; case B_ALIGN_RIGHT: loc.x = bounds.right - resultingWidth - kTitleColumnRightExtraMargin; break; } view->SetHighUIColor(B_PANEL_TEXT_COLOR, pressed ? B_DARKEN_1_TINT : 1.0f); view->SetLowColor(baseColor); view->DrawString(titleString.String(), loc); // show sort columns bool secondary = (fColumn->AttrHash() == fParent->PoseView()->SecondarySort()); if (secondary || (fColumn->AttrHash() == fParent->PoseView()->PrimarySort())) { BPoint center(loc.x - 6, roundf((bounds.top + bounds.bottom) / 2.0)); BPoint triangle[3]; if (fParent->PoseView()->ReverseSort()) { triangle[0] = center + BPoint(-3.5, 1.5); triangle[1] = center + BPoint(3.5, 1.5); triangle[2] = center + BPoint(0.0, -2.0); } else { triangle[0] = center + BPoint(-3.5, -1.5); triangle[1] = center + BPoint(3.5, -1.5); triangle[2] = center + BPoint(0.0, 2.0); } uint32 flags = view->Flags(); view->SetFlags(flags | B_SUBPIXEL_PRECISE); if (secondary) { view->SetHighUIColor(B_PANEL_BACKGROUND_COLOR, 1.3); view->FillTriangle(triangle[0], triangle[1], triangle[2]); } else { view->SetHighUIColor(B_PANEL_BACKGROUND_COLOR, 1.6); view->FillTriangle(triangle[0], triangle[1], triangle[2]); } view->SetFlags(flags); } view->SetHighUIColor(B_PANEL_BACKGROUND_COLOR, B_DARKEN_1_TINT); view->StrokeLine(bounds.RightTop(), bounds.RightBottom()); }
HoI4::Event::Event(const std::string& theType, std::istream& theStream): type(theType) { registerKeyword(std::regex("id"), [this](const std::string& unused, std::istream& theStream) { commonItems::singleString idString(theStream); id = idString.getString(); } ); registerKeyword(std::regex("title"), [this](const std::string& unused, std::istream& theStream) { commonItems::singleString titleString(theStream); title = titleString.getString(); } ); registerKeyword(std::regex("desc"), [this](const std::string& unused, std::istream& theStream) { commonItems::stringOfItem descriptionString(theStream); descriptions.push_back("desc " + descriptionString.getString()); } ); registerKeyword(std::regex("picture"), [this](const std::string& unused, std::istream& theStream) { commonItems::singleString pictureString(theStream); picture = pictureString.getString(); } ); registerKeyword(std::regex("major"), [this](const std::string& unused, std::istream& theStream) { commonItems::singleString majorString(theStream); majorEvent = (majorString.getString() == "yes"); } ); registerKeyword(std::regex("is_triggered_only"), [this](const std::string& unused, std::istream& theStream) { commonItems::singleString triggeredString(theStream); triggeredOnly = (triggeredString.getString() == "yes"); } ); registerKeyword(std::regex("hidden"), [this](const std::string& unused, std::istream& theStream) { commonItems::singleString hiddenString(theStream); hidden = (hiddenString.getString() == "yes"); } ); registerKeyword(std::regex("trigger"), [this](const std::string& unused, std::istream& theStream) { commonItems::stringOfObject triggerString(theStream); trigger = triggerString.getString(); } ); registerKeyword(std::regex("mean_time_to_happen"), [this](const std::string& unused, std::istream& theStream) { commonItems::stringOfObject MTTHString(theStream); meanTimeToHappen = MTTHString.getString(); } ); registerKeyword(std::regex("immediate"), [this](const std::string& unused, std::istream& theStream) { commonItems::stringOfObject immediateString(theStream); immediate = immediateString.getString(); } ); registerKeyword(std::regex("option"), [this](const std::string& unused, std::istream& theStream) { commonItems::stringOfObject optionString(theStream); options.push_back(optionString.getString()); } ); parseStream(theStream); }
StartWindow::StartWindow(void) : BWindow(BRect(0, 0, -1, -1), "Paladin", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS) { RegisterWindow(); AddShortcut('O', B_COMMAND_KEY, new BMessage(M_SHOW_OPEN_PROJECT)); AddShortcut('N', B_COMMAND_KEY, new BMessage(M_NEW_PROJECT)); AddShortcut('I', B_COMMAND_KEY, new BMessage(M_SHOW_IMPORT)); AddCommonFilter(new EscapeCancelFilter()); // new button and label fNewButton = make_button("new", "NewProjectButtonUp.png", "NewProjectButtonDown.png", M_NEW_PROJECT); ClickableStringView* newLabel = make_label(fNewButton, TR("Create a new project")); newLabel->SetMessage(new BMessage(M_NEW_PROJECT)); // open button and label fOpenButton = make_button("open", "OpenProjectButtonUp.png", "OpenProjectButtonDown.png", M_SHOW_OPEN_PROJECT); ClickableStringView* openLabel = make_label(fOpenButton, "Open a project"); openLabel->SetMessage(new BMessage(M_SHOW_OPEN_PROJECT)); // open recent button and label fOpenRecentButton = make_button("openrecent", "OpenRecentButtonUp.png", "OpenRecentButtonDown.png", M_OPEN_SELECTION); SetToolTip(fOpenRecentButton, TR("Open a project in the list on the right. You " "can also press Command + a number key.")); ClickableStringView* openRecentLabel = make_label(fOpenRecentButton, TR("Open the selected project")); openRecentLabel->SetMessage(new BMessage(M_OPEN_SELECTION)); // quick import button and label fQuickImportButton = make_button("quickimport", "QuickImportButtonUp.png", "QuickImportButtonDown.png", M_SHOW_IMPORT); SetToolTip(fQuickImportButton, TR("Quickly make a project by importing all source files and resource files.\n" "You can also import a BeIDE project.")); ClickableStringView* quickImportLabel = make_label(fQuickImportButton, "Import an existing project"); quickImportLabel->SetMessage(new BMessage(M_SHOW_IMPORT)); SetToolTip(quickImportLabel, TR("Quickly make a project by importing all source files " "and resource files.\n You can also import a BeIDE project.")); // online import button and label fOnlineImportButton = make_button("onlineimport", "OnlineImportButtonUp.png", "OnlineImportButtonDown.png", M_ONLINE_IMPORT); SetToolTip(fQuickImportButton, TR("Import a project from an online repository")); ClickableStringView* onlineImportLabel = make_label(fOnlineImportButton, "Import a project from online"); onlineImportLabel->SetMessage(new BMessage(M_ONLINE_IMPORT)); SetToolTip(onlineImportLabel, TR("Import a project from an online repository")); // recent projects list view and scroller fRecentProjectsListView = new RecentProjectsList(); // set the minimum width to 16em float minWidth = fRecentProjectsListView->StringWidth("M") * 16; fRecentProjectsListView->SetExplicitMinSize(BSize(minWidth, B_SIZE_UNSET)); fRecentProjectsListView->SetInvocationMessage(new BMessage(M_OPEN_SELECTION)); SetToolTip(fRecentProjectsListView, "Open a recent project. You can also press Command + a number key."); BLayoutBuilder::Group<>(this, B_HORIZONTAL) .AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING) .Add(fNewButton, 0, 0) .Add(newLabel, 1, 0) .Add(fOpenButton, 0, 1) .Add(openLabel, 1, 1) .Add(fOpenRecentButton, 0, 2) .Add(openRecentLabel, 1, 2) .Add(fQuickImportButton, 0, 3) .Add(quickImportLabel, 1, 3) .Add(fOnlineImportButton, 0, 4) .Add(onlineImportLabel, 1, 4) .End() .AddStrut(20) .AddGroup(B_VERTICAL, B_USE_SMALL_SPACING) .Add(new BStringView("recentProjectsLabel", TR("Recent projects:"))) .Add(new BScrollView("recentProjectsScroller", fRecentProjectsListView, 0, false, true)) .End() .SetInsets(B_USE_DEFAULT_SPACING) .End(); #ifdef DISABLE_ONLINE_IMPORT fOnlineImportButton->Hide(); #endif BMessenger messager(this); BEntry entry(gProjectPath.GetFullPath()); entry_ref ref; entry.GetRef(&ref); fOpenPanel = new BFilePanel(B_OPEN_PANEL, &messager, &ref, B_FILE_NODE, true, new BMessage(M_OPEN_PROJECT)); BString titleString(TR("Open Project")); titleString.Prepend("Paladin: "); fOpenPanel->Window()->SetTitle(titleString.String()); fImportPanel = new BFilePanel(B_OPEN_PANEL, &messager, &ref, B_DIRECTORY_NODE, true, new BMessage(M_QUICK_IMPORT)); titleString = TR("Choose Project Folder"); titleString.Prepend("Paladin: "); fImportPanel->Window()->SetTitle(titleString.String()); gSettings.Lock(); int32 index = 0; while (gSettings.FindRef("recentitems", index++, &ref) == B_OK) { if (!BEntry(&ref).Exists()) { index--; gSettings.RemoveData("recentitems",index); } else fRecentProjectsListView->AddItem(new RefStringItem(ref),0); } gSettings.Unlock(); // Alt + number opens that number project from the list int32 count = (fRecentProjectsListView->CountItems() > 9) ? 9 : fRecentProjectsListView->CountItems(); for (int32 i = 0; i < count; i++) { BMessage* listMessage = new BMessage(M_OPEN_FROM_LIST); listMessage->AddInt32("index", i); AddShortcut('1' + i, B_COMMAND_KEY, listMessage); } fNewButton->MakeFocus(true); CenterOnScreen(); }