I develop an app with plugins. Each plugin should have it's own settings window (QDialog type).
If plugin's settings form was included in main project, I'll simply create it with passing main form as parent as said here: http://developer.qt.nokia.com/doc/qt-4.8/qdialog.html#QDialog (and in Google results for this problem).
But when QDialog declared in separated plugin, I think that it's ugly and insecure to pass main form as parent from main app to plugin instance.
Any ideas? Stub QWidget?
I have a small idea. This is different approach but it might work in your case too. As I understand you are trying to create settings manager for you application. You can use QSettings for example and store settings for each plugin in different subgroup. For example you have a main app settings and two other plugins.
[Main App]
key1=val1
key2=val2
[Plugin1]
key1=val1
key2=val2
[Plugin1]
key1=val1
key2=val2
This way you could easily construct a QDialog in your main appication and change/save the settings. In turn the main application notifies plugins via signal that settings have changed and need to be reloaded. This way you encapsulate you main application from your plugins.
update
Thanks for a quick feedback. The approach I proposed is MainApplication centric but it can be redesigned to be decentralized. Since QSettings is application specific your plugins can store their settings in one configuration with main app as before. One modification I would make is the following. You can create a QDialog within your plugin and modify the settings without necessity for main app to be aware of this process.
Ok, I'd just create stub QWidget as suggest earlier:
QWidget *a = new QWidget();
settingsForm = new OpenFolderSettings(a);
...
delete settingsForm;
delete a;
So now dialog doesn't show button on taskbar. Also, no new window appear.
Related
I am developing a .NET core application with Identity login which provides a Bootstrap form In the /Identity/Account/Login page.
I have imported Materialize CSS files in the wwwroot/lib folder and want to change the Login page's design with materialize css as well.
The problem is /Identity/Account/Login page doesn't exist in project structure. Then how should I approach to solve this problem?
One way would be to scaffold the login page, which would add it to your project structure. Then you would be able to make any changes you want. You would have to do the following (from the link I provided):
From Solution Explorer, right-click on the project > Add > New Scaffolded Item.
From the left pane of the Add Scaffold dialog, select Identity > ADD.
In the ADD Identity dialog, select the options you want (in your case Login).
Select your existing layout page, or your layout file will be overwritten with incorrect markup. When an existing _Layout.cshtml
file is selected, it is not overwritten.
For example ~/Pages/Shared/_Layout.cshtml for Razor Pages
~/Views/Shared/_Layout.cshtml for MVC projects
To use your existing data context, select at least one file to override. You must select at least one file to add your data context.
Select your data context class.
Select ADD.
To create a new user context and possibly create a custom user class for Identity:
Select the + button to create a new Data context class.
Select ADD.
Note: If you're creating a new user context, you don't have to select
a file to override.
Another way would be to look at the Login page source code and see HTML elements' ids and classes. Then you could override the default CSS by writing your own CSS that would be more specific than the default one.
From Asp.net Core 2.1, Identity UI code are not included in project structure.
You can see this line of code in StartUp file -> method ConfigureServices
services.AddDefaultIdentity<IdentityUser>()
.AddDefaultUI(UIFramework.Bootstrap4)
If you want to customize the UI, you have to generate this bunch of code by 2 ways:
1. Using Visual Studio: right click at project -> add -> new scafolded item -> identity -> and choose which you want to be generate.
2. Using CLI: from the project directory run this command-line
dotnet aspnet-codegenerator identity -dc WebApplication.Data.ApplicationDbContext
The default Identity pages you see are generated behind the scenes from this dll in your project:
Microsoft.AspNetCore.Identity.UI.Views.V3.dll
-- located here --
Dependencies >> SDK >> Microsoft.AspNetCore.App(2.2.0).
Follow #Marko Papic step by step instructions to generate the Identity pages (or partials) you'd like to override with your Material css. Within these (now view-able pages) is all the logic and naming references to the Identity classes, methods, properties etc you'll need to build your own custom page.
Additionally, you don't need to stick to the default Areas/Identity/Pages/Account... file location or razor syntax. You could, if you wanted to, create your own MVC versions, or vue.js in whatever file structure/representation you like.
I keep a project off to the side that has overridden all of the Identity UI pages ( checkbox Override all files that serves as a handy reference where I can bring over what I need as I need it.
#Marko Papic has provided a nice answer for you, I'l suggesst you select his answer as the correct one..
The issue I'm having is that I can't make stand alone headless widgets. So I have to make a master widget, make subwidgets under that. But when I do this, I can't load the subwidgets from another widget application in another sub project. I just end up getting an "unresolved external symbol" error.
I'm not entirely certain what code to show.
My tree essentially looks like this:
main_project
sub_project
my_widget
my_widget.pro
Headers
my_widget.h
subWidget.h
Sources
my_widget.cpp
subWidget.cpp
main.cpp
Forms
my_widget.ui
subWidget.ui
different_sub_project
another_widget
another_widget.pro
Headers
another_widget.h
Sources
another_widget.cpp
main.cpp
Forms
another_widget.ui
SO that's what my tree looks like. I'm trying to make an instance of subwidget with another_widget. The reason is, I will have 3 or 4 (it keeps growing) widgets that all need to be able to access the same subwidgets. Nothing I have tried so far has worked. It would appear I have to duplicate every subwidget I want to use under the main widget it needs to be used in.
Just add widget from another subproject with "Add existing files" menu point. I.e. one your form will in 2 "pro" files. Possible you will need add path to form header to INCLUDEPATH variable of "pro" file.
In Alfresco Share the Search page is implemented with Aikau.
I'm interested in the more general question, is it possible to Debug Aikau widgets?
I have founds some links on this matter, but they talk more about logging and not actual javascript debugging:
http://docs.alfresco.com/5.1/tasks/dev-extensions-share-tutorials-debugging.html
https://github.com/Alfresco/Aikau/blob/master/tutorial/chapters/Tutorial4.md
Suppose I have the following Aikau widget alfresco/search/AlfSearchResult and the following method inside it:
/**
* This function is called to create a
* [SearchResultPropertyLink]{#link module:alfresco/renderers/SearchResultPropertyLink} widget
* to render the displayName of the result. It can be overridden to replace the default widget
* with a reconfigured version.
*
* #instance
*/
createDisplayNameRenderer: function alfresco_search_AlfSearchResult__createDisplayNameRenderer() {
// jshint nonew:false
var config = {
id: this.id + "_DISPLAY_NAME",
currentItem: this.currentItem,
pubSubScope: this.pubSubScope,
propertyToRender: "displayName",
renderSize: "large",
newTabOnMiddleOrCtrlClick: this.newTabOnMiddleOrCtrlClick,
defaultNavigationTarget: this.navigationTarget
};
if (this.navigationTarget)
{
config.navigationTarget = this.navigationTarget;
}
new SearchResultPropertyLink(config, this.nameNode);
}
Is there any way I could insert a breakpoint and stop execution at the line where this.currentItem is used in order for me to evaluate it's properties?
Yes, there are several ways in which you can debug Aikau... the first thing to do is to make sure that you're running with "client-debug" mode enabled (either in Share or in your custom Aikau client).
For example, in Share you'd want to update the /WEB-INF/classes/alfresco/share-config.xml file to change:
<config>
<flags>
<client-debug>false</client-debug>
...to be...
<config>
<flags>
<client-debug>true</client-debug>
You'll need to restart Share for the changes to take effect. You'll see then that you have a "Debug Menu" item in the main header menu bar. If you open this you can enable logging by toggling "Debug Logging" and "Show All Logs" to be true.
This will result in logging output appearing in your browser developer tools console. You can also fine tune the logging output to only show errors or warning and to provide a RegEx expression to match certain logging output.
With client debug enabled the JavaScript source being loaded by the browser will be uncompressed. This will make it easier for you to add break points.
Because Surf aggregates all of the required module source code into a single resource (for performance and caching reasons) you will want to find the Aikau source file - the easiest way to do this is to use "CTRL-P" (in Chrome) to open a resource and type "surf" into the box that appears - this will always find the Aikau source code first.
Firebug for Firefox handles finding across resources better, so you can just used "CTRL-F" and then paste in the line you want to break on.
You can add breakpoints in this resource as you normally would and the browser will break on them.
As well as setting break points you can also use the DebugLog widget. This can be toggled from the "Debug Menu" and shows all the publications and subscriptions that are being made.
It is also possible to directly include and configure the alfresco/services/LoggingService and the alfresco/logging/DebugLog widgets in your page as you are developing. We take this approach for all our unit test pages. This can be a handy approach during development and they can be removed when you're finished developing.
This presentation although quite old, also contains some useful debugging tips (see slide 56 onwards).
Can I avoid all the packaging and just create a Web application with a .ascx file and use that? The closest thing I can find is this article which is for 5.1 and does not completely work for v6.
http://mestanzasoft.wordpress.com/2011/03/27/creating-a-dotnetnuke-dnn-module-with-an-ascx-control/
So if there is a more up to date tutorial for v6 let me know please.
You should be able to choose Create New Module from the Host -> Extensions page, and then choose the control (which, I think, is what the blog post said). What specifically isn't working?
One thing that may be an issue you're running into is that the control needs to inherit from IModuleBase (probably via PortalModuleBase). You can't just drop a control that knows nothing about DNN in the website and get DNN to make it into a module (though you can make a thin wrapper around a control like that).
Yes you can.
If you go to Host > Module Definitions and click on Create New..., you will find there are there ways to create a new module:
New : That will allow you to create a simple module with single view control. You have to provide module information and create parent folder to do this.
Control: This will allow you to create new module from a control. If you don't want to create a new module folder and control at UI, you can just add a new folder to desktopmodules folder and drop an ascx control which inherits from DotNetNuke.Entities.PortalModuleBase and then use this option to provide correct folder and control that you have created and you are done.
Last option is to create it using manifest and generally useful when you want to split single module with multiple definition to different modules.
Please let me know if you have more questions.
Thanks
In DNN 6.0 you have to go to Host - Extensions...
then hover over the semi-transparent "Manage" button, which you can barely see (hidden behind the word EXTENSIONS, perhaps), and wait for the popup dialog, and THEN click "Create New Module".
:(
I'm trying to slightly modify the default WordPress tag cloud widget. I don't want to create my own widget because I literally want to adjust one small thing. I've looked through my WordPress installation but can't find the PHP file that contains the basic widgets.
Even though I assume that they are defined in each theme, I still looked in the core directories but came up empty handed.
So if any of you happen to have already figured this out, please make my life easier and let me know where I can find the default widgets...most importantly the tag cloud widget.
Thanks
Those are located in the default widget class:
/wp-includes/default-widgets.php
For more detail:
http://phpdoc.wordpress.org/trunk/WordPress/Widgets/WP_Widget_Tag_Cloud.html
The widget invokes a function deeper though that generates the actual output. You'll want to take a look at the wp_tag_cloud and wp_generate_tag_cloud functions in:
/wp-includes/category-template.php
do take into account however that you'll lose your change when you upgrade wordpress (which is why I eventually did create my own shabby category-cloud widget instead of changing the default tag-cloud code).
The tag cloud widget is defined near the bottom of the default-widgets.php file in the wp-includes folder.